9
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SQL Server 2017 Linuxのインストール(CentOS7.4)

Last updated at Posted at 2018-09-20

■初めに

SQLServer 2017 Linuxを、CentOS 7.4 にインストールします。
作業的には20分ぐらい。
#みんな人柱になぁれ

■システム要件(一部)

・サポートされているプラットフォーム(OS)

Red Hat Enterprise Linux 7.3 または 7.4 ワークステーション、サーバー、およびデスクトップ
SUSE Enterprise Linux Server v12 SP2
Ubuntu 16.04LTS
Docker エンジン 1.8 + では、Windows、Mac、または Linux
[Micorsoft Docs] Linux 上の SQL Server のインストールのガイダンスについて

・システム要件(最小リソース)

[メモリ] 2 GB
[ファイル システム] XFSまたはEXT4 (他のファイル システムでは、 BTRFSはサポートされていません)
ディスク領域 6 GB
プロセッサ速度 2 GHz
プロセッサ コア 2 コア
プロセッサの種類 x64 互換のみ
[Micorsoft Docs] Linux 上の SQL Server のインストールのガイダンスについて

・エディション(簡易に記載)

Enterprise  有料、商用利用可、機能制限無し
Standard  有料、商用利用可、機能制限有り
Web    有料、商用利用可、機能制限有り/ホスティングやVAP用途
Express   無料、商用利用可、機能制限がより厳しい
Developer  無料商用利用不可Enterpriseと同じ機能
Evaluation  無料商用利用不可Enterpriseと同じ機能180日間有効
[Micorsoft Docs] エディションと SQL Server 2017 on Linux のサポートされる機能

■今回インストールする環境

SQLServer 2017 Linux Developer Edition
#商用利用なく、検証目的で機能をフルに利用したいため

CentOS 7.4 x64
CPU 仮想2core / MEMORY 3GB / Disk 20GB
※インターネット接続環境

■インストール手順

手順1.SQLServerのインストール
  1.1.構成ファイルのダウンロード
  1.2.インストール
  1.3.セットアップ
  1.4.SQLServer サービス起動確認
  1.5.リモート接続ポートの開放
手順2.SQLServerコマンドラインツールのインストール
  2.1.SQLServerコマンドラインツールのダウンロード
  2.2.古いmssqlツールの削除
  2.3.インストール
手順3.SQLServer接続

■手順1.1.構成ファイルのダウンロード

コマンド:
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo

[root@cent74-gn01 ~]# sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql -server-2017.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   232  100   232    0     0    438      0 --:--:-- --:--:-- --:--:--   438
[root@cent74-gn01 ~]# 

■手順1.2.インストール

コマンド:
sudo yum install -y mssql-server
#以下長いですが、コマンド入れた後は操作不要

[root@cent74-gn01 ~]# sudo yum install -y mssql-server
読み込んだプラグイン:fastestmirror, langpacks
base                                                                                             | 3.6 kB  00:00:00     
extras                                                                                           | 3.4 kB  00:00:00     
packages-microsoft-com-mssql-server-2017                                                         | 2.9 kB  00:00:00     
updates                                                                                          | 3.4 kB  00:00:00     
(1/5): base/7/x86_64/group_gz                                                                    | 166 kB  00:00:00     
(3/5): extras/7/x86_64/primary_db             1% [-                                   ]  0.0 B/s | 166 kB  --:--:-- ETA 
(2/5): extras/7/x86_64/primary_db                                                                | 187 kB  00:00:00     
(4/5): packages-microsoft-com-mssql-server-20 11% [===-                               ] 1.6 MB/s | 1.3 MB  00:00:06 ETA 
(3/5): packages-microsoft-com-mssql-server-2017/primary_db                                       |  15 kB  00:00:00     
(5/5): updates/7/x86_64/primary_db            21% [=======-                           ] 1.8 MB/s | 2.5 MB  00:00:05 ETA 
(5/5): updates/7/x86_64/primary_db            31% [==========-                        ] 1.9 MB/s | 3.6 MB  00:00:04 ETA 

  ~中略:%が増えるだけ~

(5/5): updates/7/x86_64/primary_db            97% [================================== ] 891 kB/s |  11 MB  00:00:00 ETA 
(5/5): updates/7/x86_64/primary_db            99% [==================================-] 871 kB/s |  11 MB  00:00:00 ETA 
(5/5): updates/7/x86_64/primary_db                                                               | 5.2 MB  00:00:10     
Determining fastest mirrors
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ mssql-server.x86_64 0:14.0.3037.1-2 を インストール
--> 依存性の処理をしています: cyrus-sasl のパッケージ: mssql-server-14.0.3037.1-2.x86_64
--> 依存性の処理をしています: cyrus-sasl-gssapi のパッケージ: mssql-server-14.0.3037.1-2.x86_64
--> トランザクションの確認を実行しています。
---> パッケージ cyrus-sasl.x86_64 0:2.1.26-23.el7 を インストール
--> 依存性の処理をしています: cyrus-sasl-lib(x86-64) = 2.1.26-23.el7 のパッケージ: cyrus-sasl-2.1.26-23.el7.x86_64
---> パッケージ cyrus-sasl-gssapi.x86_64 0:2.1.26-23.el7 を インストール
--> トランザクションの確認を実行しています。
---> パッケージ cyrus-sasl-lib.x86_64 0:2.1.26-21.el7 を 更新
--> 依存性の処理をしています: cyrus-sasl-lib(x86-64) = 2.1.26-21.el7 のパッケージ: cyrus-sasl-plain-2.1.26-21.el7.x86_64
---> パッケージ cyrus-sasl-lib.x86_64 0:2.1.26-23.el7 を アップデート
--> トランザクションの確認を実行しています。
---> パッケージ cyrus-sasl-plain.x86_64 0:2.1.26-21.el7 を 更新
---> パッケージ cyrus-sasl-plain.x86_64 0:2.1.26-23.el7 を アップデート
--> 依存性解決を終了しました。

依存性を解決しました

========================================================================================================================
 Package                   アーキテクチャー
                                          バージョン             リポジトリー                                      容量
========================================================================================================================
インストール中:
 mssql-server              x86_64         14.0.3037.1-2          packages-microsoft-com-mssql-server-2017         168 M
依存性関連でのインストールをします:
 cyrus-sasl                x86_64         2.1.26-23.el7          base                                              88 k
 cyrus-sasl-gssapi         x86_64         2.1.26-23.el7          base                                              41 k
依存性関連での更新をします:
 cyrus-sasl-lib            x86_64         2.1.26-23.el7          base                                             155 k
 cyrus-sasl-plain          x86_64         2.1.26-23.el7          base                                              39 k

トランザクションの要約
========================================================================================================================
インストール  1 パッケージ (+2 個の依存関係のパッケージ)
更新                       ( 2 個の依存関係のパッケージ)

総ダウンロード容量: 168 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
警告: /var/cache/yum/x86_64/7/base/packages/cyrus-sasl-2.1.26-23.el7.x86_64.rpm: ヘッダー V3 RSA/SHA256 Signature、鍵 ID f4a80eb5: NOKEY
cyrus-sasl-2.1.26-23.el7.x86_64.rpm の公開鍵がインストールされていません
(1/5): cyrus-sasl-2.1.26-23.el7.x86_64.rpm                                                       |  88 kB  00:00:00     
(2/5): cyrus-sasl-gssapi-2.1.26-23.el7.x86_64.rpm                                                |  41 kB  00:00:00     
(3/5): cyrus-sasl-plain-2.1.26-23.el7.x86_64.rpm                                                 |  39 kB  00:00:00     
(4/5): cyrus-sasl-lib-2.1.26-23.el7.x86_64.rpm                                                   | 155 kB  00:00:00     
(5/5): mssql-server-14.0.3037.1-2.x86_64.rpm  0% [                                    ]  0.0 B/s | 324 kB  --:--:-- ETA 
(5/5): mssql-server-14.0.3037.1-2.x86_64.rpm  0% [                                    ] 156 kB/s | 499 kB  00:18:25 ETA 
(5/5): mssql-server-14.0.3037.1-2.x86_64.rpm  0% [                                    ] 191 kB/s | 723 kB  00:15:00 ETA 

  ~中略:%が増えるだけ~

(5/5): mssql-server-14.0.3037.1-2.x86_64.rpm  99% [==================================-] 704 kB/s | 168 MB  00:00:00 ETA 
(5/5): mssql-server-14.0.3037.1-2.x86_64.rpm  99% [==================================-] 711 kB/s | 168 MB  00:00:00 ETA 
警告: /var/cache/yum/x86_64/7/packages-microsoft-com-mssql-server-2017/packages/mssql-server-14.0.3037.1-2.x86_64.rpm: ヘッダー V4 RSA/SHA256 Signature、鍵 ID be1229cf: NOKEY
mssql-server-14.0.3037.1-2.x86_64.rpm の公開鍵がインストールされていません
(5/5): mssql-server-14.0.3037.1-2.x86_64.rpm                                                     | 168 MB  00:05:09     
------------------------------------------------------------------------------------------------------------------------
合計                                                                                    557 kB/s | 168 MB  00:05:09     
https://packages.microsoft.com/keys/microsoft.asc から鍵を取得中です。
Importing GPG key 0xBE1229CF:
 Userid     : "Microsoft (Release signing) <gpgsecurity@microsoft.com>"
 Fingerprint: bc52 8686 b50d 79e3 39d3 721c eb3e 94ad be12 29cf
 From       : https://packages.microsoft.com/keys/microsoft.asc
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 から鍵を取得中です。
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  更新します              : cyrus-sasl-lib-2.1.26-23.el7.x86_64 [                                                 ] 1/7
  更新します              : cyrus-sasl-lib-2.1.26-23.el7.x86_64 [#######                                          ] 1/7
  更新します              : cyrus-sasl-lib-2.1.26-23.el7.x86_64 [##############                                   ] 1/7

  ~中略:%が増えるだけ~

  更新します              : cyrus-sasl-lib-2.1.26-23.el7.x86_64 [################################################ ] 1/7
  更新します              : cyrus-sasl-lib-2.1.26-23.el7.x86_64                                                     1/7
  インストール中          : cyrus-sasl-2.1.26-23.el7.x86_64 [                                                     ] 2/7
  インストール中          : cyrus-sasl-2.1.26-23.el7.x86_64 [#####                                                ] 2/7

  ~中略:%が増えるだけ~

  インストール中          : cyrus-sasl-2.1.26-23.el7.x86_64 [#################################################### ] 2/7
  インストール中          : cyrus-sasl-2.1.26-23.el7.x86_64                                                         2/7
  インストール中          : cyrus-sasl-gssapi-2.1.26-23.el7.x86_64 [                                              ] 3/7
  インストール中          : cyrus-sasl-gssapi-2.1.26-23.el7.x86_64 [############################################# ] 3/7
  インストール中          : cyrus-sasl-gssapi-2.1.26-23.el7.x86_64                                                  3/7 
  インストール中          : mssql-server-14.0.3037.1-2.x86_64 [                                                   ] 4/7
  インストール中          : mssql-server-14.0.3037.1-2.x86_64 [#                                                  ] 4/7
  インストール中          : mssql-server-14.0.3037.1-2.x86_64 [##                                                 ] 4/7

  ~中略:%が増えるだけ~

  インストール中          : mssql-server-14.0.3037.1-2.x86_64 [################################################## ] 4/7  
  インストール中          : mssql-server-14.0.3037.1-2.x86_64                                                       4/7 

+--------------------------------------------------------------+
'sudo /opt/mssql/bin/mssql-conf setup' を実行し、
Microsoft SQL Server のセットアップを完了してください
+--------------------------------------------------------------+

この設定を適用するには SQL Server を再起動する必要があります。
'systemctl restart mssql-server.service' を実行してください。
  更新します              : cyrus-sasl-plain-2.1.26-23.el7.x86_64 [                                               ] 5/7  
  更新します              : cyrus-sasl-plain-2.1.26-23.el7.x86_64 [#######################                        ] 5/7  
  更新します              : cyrus-sasl-plain-2.1.26-23.el7.x86_64 [############################################## ] 5/7  
  更新します              : cyrus-sasl-plain-2.1.26-23.el7.x86_64                                                   5/7 
  整理中                  : cyrus-sasl-plain-2.1.26-21.el7.x86_64                                                   6/7 
  整理中                  : cyrus-sasl-lib-2.1.26-21.el7.x86_64                                                     7/7 
  検証中                  : mssql-server-14.0.3037.1-2.x86_64                                                       1/7 
  検証中                  : cyrus-sasl-plain-2.1.26-23.el7.x86_64                                                   2/7 
  検証中                  : cyrus-sasl-2.1.26-23.el7.x86_64                                                         3/7 
  検証中                  : cyrus-sasl-lib-2.1.26-23.el7.x86_64                                                     4/7 
  検証中                  : cyrus-sasl-gssapi-2.1.26-23.el7.x86_64                                                  5/7 
  検証中                  : cyrus-sasl-plain-2.1.26-21.el7.x86_64                                                   6/7 
  検証中                  : cyrus-sasl-lib-2.1.26-21.el7.x86_64                                                     7/7 

インストール:
  mssql-server.x86_64 0:14.0.3037.1-2                                                                                   

依存性関連をインストールしました:
  cyrus-sasl.x86_64 0:2.1.26-23.el7                       cyrus-sasl-gssapi.x86_64 0:2.1.26-23.el7                      

依存性を更新しました:
  cyrus-sasl-lib.x86_64 0:2.1.26-23.el7                     cyrus-sasl-plain.x86_64 0:2.1.26-23.el7                    

完了しました!
[root@cent74-gn01 ~]# 

■手順1.3.セットアップ

セットアップでは、ライセンス許諾のための「YES」入力に加え、「エディション」、「言語」、「システム管理者(SA)のパスワード」を入力します。

今回は「2) Developer (無料、製品使用権なし)」、「(6) 日本語」、およびパスワードを入力しています。

コマンド:
sudo /opt/mssql/bin/mssql-conf setup

[root@cent74-gn01 ~]# sudo /opt/mssql/bin/mssql-conf setup
SQL Server のエディションを選択します:
  1) Evaluation (無料、製品使用権なし、期限 180 日間)
  2) Developer (無料、製品使用権なし)
  3) Express (無料)
  4) Web (有料)
  5) Standard (有料)
  6) Enterprise (有料)
  7) Enterprise Core (有料)
  8) 小売販売チャネルを介してライセンスを購入し、入力するプロダクト キーを持っています。

エディションの詳細については、以下を参照してください
https://go.microsoft.com/fwlink/?LinkId=852748&clcid=0x411

このソフトウェアの有料エディションを使用するには、個別のライセンスを以下から取得する必要があります
Microsoft ボリューム ライセンス プログラム。
有料エディションを選択することは、
このソフトウェアをインストールおよび実行するための適切な数のライセンスがあることを確認していることになります。

エディションを入力してください(1-8): 2
この製品のライセンス条項は
/usr/share/doc/mssql-server で参照できるほか、次の場所からダウンロードすることもできます:
https://go.microsoft.com/fwlink/?LinkId=855862&clcid=0x411

プライバシーに関する声明は、次の場所で確認できます:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x411

ライセンス条項に同意しますか? [Yes/No]:Yes


SQL Server の言語の選択:
(1) English
(2) Deutsch
(3) Espanol
(4) Francais
(5) Italiano
(6) 日本語
(7) ???
(8) Portugues
(9) Русский
(10) 中文 ? ?体
(11) 中文 (繁体)
オプション 1-11 を入力: 6
SQL Server システム管理者パスワードを入力してください: 
SQL Server システム管理者パスワードを確認入力してください: 
SQL Server を構成しています...

ForceFlush is enabled for this instance. 
ForceFlush feature is enabled for log durability.
Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service.
セットアップは正常に完了しました。SQL Server を起動しています。

■手順1.4.SQLServer サービス起動確認

コマンド
systemctl status mssql-server

[root@cent74-gn01 ~]# systemctl status mssql-server
● mssql-server.service - Microsoft SQL Server Database Engine
   Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
   Active: active (running) since 火 2018-09-18 20:19:01 JST; 8s ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 1884 (sqlservr)
   CGroup: /system.slice/mssql-server.service
           tq1884 /opt/mssql/bin/sqlservr
           mq1905 /opt/mssql/bin/sqlservr

 9月 18 20:19:06 cent74-gn01 sqlservr[1884]: 2018-09-18 20:19:06.46 spid7s      0 2018-09-18 20:19:06.46 spid7s...ired.
 9月 18 20:19:06 cent74-gn01 sqlservr[1884]: 2018-09-18 20:19:06.47 spid7s      2018-09-18 20:19:06.47 spid7s  ...ired.
 9月 18 20:19:06 cent74-gn01 sqlservr[1884]: 2018-09-18 20:19:06.54 spid11s     Polybase 2018-09-18 20:19:06.54...bled.
 9月 18 20:19:06 cent74-gn01 sqlservr[1884]: 2018-09-18 20:19:06.54 spid11s     tempdb 2018-09-18 20:19:06.54 s...base.
 9月 18 20:19:07 cent74-gn01 sqlservr[1884]: 2018-09-18 20:19:07.06 spid11s     2018-09-18 20:19:07.06 spid11s ...pdb'.
 9月 18 20:19:07 cent74-gn01 sqlservr[1884]: 2018-09-18 20:19:07.38 spid11s     tempdb 2018-09-18 20:19:07.38 s...e(s).
 9月 18 20:19:07 cent74-gn01 sqlservr[1884]: 2018-09-18 20:19:07.40 spid24s     Service Broker 2018-09-18 20:19...tate.
 9月 18 20:19:07 cent74-gn01 sqlservr[1884]: 2018-09-18 20:19:07.41 spid24s     Database Mirroring 2018-09-18 2...tate.
 9月 18 20:19:07 cent74-gn01 sqlservr[1884]: 2018-09-18 20:19:07.43 spid24s     Service Broker 2018-09-18 20:19...rted.
 9月 18 20:19:07 cent74-gn01 sqlservr[1884]: 2018-09-18 20:19:07.52 spid7s      2018-09-18 20:19:07.52 spid7s  ...ired.
Hint: Some lines were ellipsized, use -l to show in full.
[root@cent74-gn01 ~]# 

■手順1.5.リモート接続ポートの開放

SQLServerで利用するTCP1433ポートを開放します。

コマンド:
sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
sudo firewall-cmd --reload

[root@cent74-gn01 ~]# sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
sudo firewall-cmd --reloadsuccess
[root@cent74-gn01 ~]# sudo firewall-cmd --reload
success
[root@cent74-gn01 ~]# 

■手順2.1.SQLServerコマンドラインツールのダウンロード

コマンド:
sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo

[root@cent74-gn01 ~]# sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  100   193  100   193    0     0    388      0 --:--:-- --:--:-- --:--:--   389
[root@cent74-gn01 ~]# 

■手順2.2.古いmssqlツールの削除

今回のOSは新品同然なので、結果として削除対象はありませんでした。

コマンド:
sudo yum remove unixODBC-utf16 unixODBC-utf16-devel

[root@cent74-gn01 ~]# sudo yum remove unixODBC-utf16 unixODBC-utf16-devel
読み込んだプラグイン:fastestmirror, langpacks
引数に一致しません: unixODBC-utf16
引数に一致しません: unixODBC-utf16-devel
削除対象とマークされたパッケージはありません。
[root@cent74-gn01 ~]# 

■手順2.3.インストール

※ライセンス許諾のため、途中で数度「YES」と入力する必要があります。

コマンド:
sudo yum install -y mssql-tools unixODBC-devel

[root@cent74-gn01 ~]# sudo yum install -y mssql-tools unixODBC-devel
読み込んだプラグイン:fastestmirror, langpacks
packages-microsoft-com-prod                                                                      | 2.9 kB  00:00:00     
packages-microsoft-com-prod/primary_db        0% [                                    ]  0.0 B/s |    0 B  --:--:-- ETA 
packages-microsoft-com-prod/primary_db                                                           | 142 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ mssql-tools.x86_64 0:17.2.0.1-1 を インストール
--> 依存性の処理をしています: msodbcsql17 < 17.3.0.0 のパッケージ: mssql-tools-17.2.0.1-1.x86_64
--> 依存性の処理をしています: msodbcsql17 >= 17.2.0.0 のパッケージ: mssql-tools-17.2.0.1-1.x86_64
---> パッケージ unixODBC-devel.x86_64 0:2.3.1-11.el7 を インストール
--> 依存性の処理をしています: unixODBC(x86-64) = 2.3.1-11.el7 のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libtemplate.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libtdsS.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libsapdbS.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: liboraodbcS.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: liboplodbcS.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libodbctxtS.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libodbcnnS.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libodbcminiS.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libodbcdrvcfg2S.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libodbcdrvcfg1S.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libodbccr.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libnn.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libmimerS.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> 依存性の処理をしています: libesoobS.so.2()(64bit) のパッケージ: unixODBC-devel-2.3.1-11.el7.x86_64
--> トランザクションの確認を実行しています。
---> パッケージ msodbcsql17.x86_64 0:17.2.0.1-1 を インストール
---> パッケージ unixODBC.x86_64 0:2.3.1-11.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

========================================================================================================================
 Package                    アーキテクチャー   バージョン                 リポジトリー                             容量
========================================================================================================================
インストール中:
 mssql-tools                x86_64             17.2.0.1-1                 packages-microsoft-com-prod             253 k
 unixODBC-devel             x86_64             2.3.1-11.el7               base                                     55 k
依存性関連でのインストールをします:
 msodbcsql17                x86_64             17.2.0.1-1                 packages-microsoft-com-prod             4.3 M
 unixODBC                   x86_64             2.3.1-11.el7               base                                    413 k

トランザクションの要約
========================================================================================================================
インストール  2 パッケージ (+2 個の依存関係のパッケージ)

総ダウンロード容量: 5.1 M
インストール容量: 6.0 M
Downloading packages:
(1/4): unixODBC-devel-2.3.1-11.el7.x86_64.rpm                                                    |  55 kB  00:00:00     
(2/4): unixODBC-2.3.1-11.el7.x86_64.rpm                                                          | 413 kB  00:00:00     
(4/4): mssql-tools-17.2.0.1-1.x86_64.rpm      9% [===                                 ]  0.0 B/s | 467 kB  --:--:-- ETA 
(4/4): mssql-tools-17.2.0.1-1.x86_64.rpm      13% [====-                              ] 230 kB/s | 675 kB  00:00:19 ETA 
(3/4): mssql-tools-17.2.0.1-1.x86_64.rpm                                                         | 253 kB  00:00:00     
(4/4): msodbcsql17-17.2.0.1-1.x86_64.rpm      22% [=======-                           ] 306 kB/s | 1.1 MB  00:00:13 ETA 
(4/4): msodbcsql17-17.2.0.1-1.x86_64.rpm      23% [========                           ] 303 kB/s | 1.2 MB  00:00:13 ETA 

  ~中略:%が増えるだけ~

(4/4): msodbcsql17-17.2.0.1-1.x86_64.rpm      95% [=================================  ] 581 kB/s | 4.8 MB  00:00:00 ETA 
(4/4): msodbcsql17-17.2.0.1-1.x86_64.rpm                                                         | 4.3 MB  00:00:08     
------------------------------------------------------------------------------------------------------------------------
合計                                                                                    643 kB/s | 5.1 MB  00:00:08     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : unixODBC-2.3.1-11.el7.x86_64 [                                                        ] 1/4  
  インストール中          : unixODBC-2.3.1-11.el7.x86_64 [#                                                       ] 1/4  
  インストール中          : unixODBC-2.3.1-11.el7.x86_64 [##                                                      ] 1/4  

  ~中略:%が増えるだけ~

  インストール中          : unixODBC-2.3.1-11.el7.x86_64 [######################################################  ] 1/4  
  インストール中          : unixODBC-2.3.1-11.el7.x86_64 [####################################################### ] 1/4  
  インストール中          : unixODBC-2.3.1-11.el7.x86_64                                                            1/4 
The license terms for this product can be downloaded from
https://aka.ms/odbc172eula and found in
/usr/share/doc/msodbcsql17/LICENSE.txt . By entering 'YES',
you indicate that you accept the license terms.

Do you accept the license terms? (Enter YES or NO)
YES
  インストール中          : msodbcsql17-17.2.0.1-1.x86_64 [                                                       ] 2/4  
  インストール中          : msodbcsql17-17.2.0.1-1.x86_64 [#                                                      ] 2/4  
  インストール中          : msodbcsql17-17.2.0.1-1.x86_64 [##                                                     ] 2/4  
  イ

  ~中略:%が増えるだけ~

  インストール中          : msodbcsql17-17.2.0.1-1.x86_64 [###################################################### ] 2/4  
  インストール中          : msodbcsql17-17.2.0.1-1.x86_64                                                           2/4 
The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746949 and found in
/usr/share/doc/mssql-tools/LICENSE.txt . By entering 'YES',
you indicate that you accept the license terms.

Do you accept the license terms? (Enter YES or NO)
YES
  インストール中          : mssql-tools-17.2.0.1-1.x86_64 [                                                       ] 3/4  
  インストール中          : mssql-tools-17.2.0.1-1.x86_64 [###                                                    ] 3/4  
  インストール中          : mssql-tools-17.2.0.1-1.x86_64 [#######                                                ] 3/4  

  ~中略:%が増えるだけ~

  インストール中          : mssql-tools-17.2.0.1-1.x86_64 [###################################################### ] 3/4  
  インストール中          : mssql-tools-17.2.0.1-1.x86_64                                                           3/4 
  インストール中          : unixODBC-devel-2.3.1-11.el7.x86_64 [                                                  ] 4/4  
  インストール中          : unixODBC-devel-2.3.1-11.el7.x86_64 [#                                                 ] 4/4  

  ~中略:%が増えるだけ~

  インストール中          : unixODBC-devel-2.3.1-11.el7.x86_64 [################################################  ] 4/4  
  インストール中          : unixODBC-devel-2.3.1-11.el7.x86_64 [################################################# ] 4/4  
  インストール中          : unixODBC-devel-2.3.1-11.el7.x86_64                                                      4/4 
  検証中                  : mssql-tools-17.2.0.1-1.x86_64                                                           1/4 
  検証中                  : unixODBC-2.3.1-11.el7.x86_64                                                            2/4 
  検証中                  : msodbcsql17-17.2.0.1-1.x86_64                                                           3/4 
  検証中                  : unixODBC-devel-2.3.1-11.el7.x86_64                                                      4/4 

インストール:
  mssql-tools.x86_64 0:17.2.0.1-1                          unixODBC-devel.x86_64 0:2.3.1-11.el7                         

依存性関連をインストールしました:
  msodbcsql17.x86_64 0:17.2.0.1-1                             unixODBC.x86_64 0:2.3.1-11.el7                            

完了しました!
[root@cent74-gn01 ~]# 

■手順2.4.環境変数追加

コマンド:
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc

[root@cent74-gn01 ~]# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
[root@cent74-gn01 ~]# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
[root@cent74-gn01 ~]# source ~/.bashrc
[root@cent74-gn01 ~]# 

■手順3.SQLServer接続

最後に、SQLServer接続することで動作確認を行います。

以下コマンドではパスワードオプション(-P)をつけていないため、
パスワード入力が求められます。

コマンド:
sqlcmd -S <ホスト名またはIPアドレス> -U <ユーザ>

[root@cent74-gn01 ~]# sqlcmd -S cent74-gn01 -U SA
Password:
1> quit
[root@cent74-gn01 ~]#

ここまでくれば、インストール自体は完了です。 あとはsqlcmdからコマンド入力するなり、 SQLServer Management StudioからGUIで操作することが可能です。

■参考/出典

[Micorsoft Docs] SQL Server on Linux
https://docs.microsoft.com/ja-jp/sql/linux/sql-server-linux-overview?view=sql-server-2017

[Micorsoft Docs] Linux 上の SQL Server のインストールのガイダンスについて
https://docs.microsoft.com/ja-jp/sql/linux/sql-server-linux-setup?view=sql-server-2017

[Micorsoft Docs] エディションと SQL Server 2017 on Linux のサポートされる機能
https://docs.microsoft.com/ja-jp/sql/linux/sql-server-linux-editions-and-components-2017?view=sql-server-2017

[Micorsoft Docs] クイック スタート: SQL Server をインストールし、Red Hat でデータベースを作成します。
https://docs.microsoft.com/ja-jp/sql/linux/quickstart-install-connect-red-hat?view=sql-server-2017

SQL Server on Linux を試してみた
https://dev.classmethod.jp/server-side/db/get-started-sql-server-on-linux/

SQL Server 2017 を CentOS 7.4 で試す
https://qiita.com/bezeklik/items/3f88046dd779e86029a2

SQLServer Mangement Studio 2017(SSMS 2017)のインストール(Windows7)
https://qiita.com/Higemal/items/76ce7c21a262fe534f00

9
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?