CentOS 7にMicrosoft SQL Server 2017をインストールしてみました。
Linux および Windows 用 SQL Server 2017 | Microsoft
https://www.microsoft.com/ja-jp/sql-server/sql-server-2017
インストール方法は下記を参考にしました。
Install SQL Server and create a database on Red Hat
https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-red-hat
環境
・CentOS Linux release 7.4.1708 (Core)
・Kernel 3.10.0-693.2.2.el7.x86_64
- repositoryのダウンロード
- SQL Serverのインストール
- セットアップの実行
- SQL Serverの確認
- Firewallの許可
1 2 3 4 5 6 7 8 9 10 11 12 |
# 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 100 232 100 232 0 0 232 0 0:00:01 --:--:-- 0:00:01 490 # cat /etc/yum.repos.d/mssql-server.repo [packages-microsoft-com-mssql-server-2017] name=packages-microsoft-com-mssql-server-2017 baseurl=https://packages.microsoft.com/rhel/7/mssql-server-2017/ enabled=1 gpgcheck=1 gpgkey=https://packages.microsoft.com/keys/microsoft.asc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# yum info mssql-server Available Packages Name : mssql-server Arch : x86_64 Version : 14.0.1000.169 Release : 2 Size : 164 M Repo : packages-microsoft-com-mssql-server-2017 Summary : Microsoft SQL Server Relational Database Engine License : Commercial Description : The mssql-server package contains the Microsoft SQL Server Relational Database Engine. # repoquery --list mssql-server /opt/mssql/bin /opt/mssql/bin/compress-dump.sh /opt/mssql/bin/crash-support-functions.sh /opt/mssql/bin/generate-sql-dump.sh /opt/mssql/bin/handle-crash.sh /opt/mssql/bin/mssql-conf /opt/mssql/bin/paldumper /opt/mssql/bin/sqlservr /opt/mssql/lib /opt/mssql/lib/libc++.so.1 /opt/mssql/lib/libc++abi.so.1 /opt/mssql/lib/libjemalloc.so.1 /opt/mssql/lib/libsqlvdi.so /opt/mssql/lib/libunwind.so.8 /opt/mssql/lib/loc /opt/mssql/lib/loc/de_DE /opt/mssql/lib/loc/de_DE/LC_MESSAGES /opt/mssql/lib/loc/de_DE/LC_MESSAGES/sqlservr.mo /opt/mssql/lib/loc/en_US /opt/mssql/lib/loc/en_US/LC_MESSAGES /opt/mssql/lib/loc/en_US/LC_MESSAGES/sqlservr.mo /opt/mssql/lib/loc/es_ES /opt/mssql/lib/loc/es_ES/LC_MESSAGES /opt/mssql/lib/loc/es_ES/LC_MESSAGES/sqlservr.mo /opt/mssql/lib/loc/fr_FR /opt/mssql/lib/loc/fr_FR/LC_MESSAGES /opt/mssql/lib/loc/fr_FR/LC_MESSAGES/sqlservr.mo /opt/mssql/lib/loc/it_IT /opt/mssql/lib/loc/it_IT/LC_MESSAGES /opt/mssql/lib/loc/it_IT/LC_MESSAGES/sqlservr.mo /opt/mssql/lib/loc/ja_JP /opt/mssql/lib/loc/ja_JP/LC_MESSAGES /opt/mssql/lib/loc/ja_JP/LC_MESSAGES/sqlservr.mo /opt/mssql/lib/loc/ko_KR /opt/mssql/lib/loc/ko_KR/LC_MESSAGES /opt/mssql/lib/loc/ko_KR/LC_MESSAGES/sqlservr.mo /opt/mssql/lib/loc/pt_BR /opt/mssql/lib/loc/pt_BR/LC_MESSAGES /opt/mssql/lib/loc/pt_BR/LC_MESSAGES/sqlservr.mo /opt/mssql/lib/loc/ru_RU /opt/mssql/lib/loc/ru_RU/LC_MESSAGES /opt/mssql/lib/loc/ru_RU/LC_MESSAGES/sqlservr.mo /opt/mssql/lib/loc/zh_CN /opt/mssql/lib/loc/zh_CN/LC_MESSAGES /opt/mssql/lib/loc/zh_CN/LC_MESSAGES/sqlservr.mo /opt/mssql/lib/loc/zh_TW /opt/mssql/lib/loc/zh_TW/LC_MESSAGES /opt/mssql/lib/loc/zh_TW/LC_MESSAGES/sqlservr.mo /opt/mssql/lib/mssql-conf /opt/mssql/lib/mssql-conf/checkinstall.sh /opt/mssql/lib/mssql-conf/checkrunninginstance.sh /opt/mssql/lib/mssql-conf/collations.txt /opt/mssql/lib/mssql-conf/invokesqlservr.sh /opt/mssql/lib/mssql-conf/loc /opt/mssql/lib/mssql-conf/loc/mo /opt/mssql/lib/mssql-conf/loc/mo/mssql-conf-de_DE.mo /opt/mssql/lib/mssql-conf/loc/mo/mssql-conf-en_US.mo /opt/mssql/lib/mssql-conf/loc/mo/mssql-conf-es_ES.mo /opt/mssql/lib/mssql-conf/loc/mo/mssql-conf-fr_FR.mo /opt/mssql/lib/mssql-conf/loc/mo/mssql-conf-it_IT.mo /opt/mssql/lib/mssql-conf/loc/mo/mssql-conf-ja_JP.mo /opt/mssql/lib/mssql-conf/loc/mo/mssql-conf-ko_KR.mo /opt/mssql/lib/mssql-conf/loc/mo/mssql-conf-pt_BR.mo /opt/mssql/lib/mssql-conf/loc/mo/mssql-conf-ru_RU.mo /opt/mssql/lib/mssql-conf/loc/mo/mssql-conf-zh_CN.mo /opt/mssql/lib/mssql-conf/loc/mo/mssql-conf-zh_TW.mo /opt/mssql/lib/mssql-conf/mssql-conf.py /opt/mssql/lib/mssql-conf/mssqlconfhelper.py /opt/mssql/lib/mssql-conf/mssqlsettings.py /opt/mssql/lib/mssql-conf/mssqlsettingsmanager.py /opt/mssql/lib/mssql-conf/set-collation.sh /opt/mssql/lib/secforwarderxplat.sfp /opt/mssql/lib/sqldkxplat.sfp /opt/mssql/lib/sqlservr.sfp /opt/mssql/lib/system.certificates.sfp /opt/mssql/lib/system.common.sfp /opt/mssql/lib/system.netfx.sfp /opt/mssql/lib/system.sfp /usr/lib/systemd/system/mssql-server.service /usr/share/doc/mssql-server/THIRDPARTYNOTICES.TXT /usr/share/doc/mssql-server/license_Eval_Linux.txt /usr/share/doc/mssql-server/license_Eval_Linux_Chinese (Simplified).txt /usr/share/doc/mssql-server/license_Eval_Linux_Chinese (Traditional).txt /usr/share/doc/mssql-server/license_Eval_Linux_French.txt /usr/share/doc/mssql-server/license_Eval_Linux_German.txt /usr/share/doc/mssql-server/license_Eval_Linux_Italian.txt /usr/share/doc/mssql-server/license_Eval_Linux_Japanese.txt /usr/share/doc/mssql-server/license_Eval_Linux_Korean.txt /usr/share/doc/mssql-server/license_Eval_Linux_Portuguese (Brazil).txt /usr/share/doc/mssql-server/license_Eval_Linux_Russian.txt /usr/share/doc/mssql-server/license_Eval_Linux_Spanish.txt /usr/share/doc/mssql-server/license_Std_Linux.txt /usr/share/doc/mssql-server/license_Std_Linux_Chinese (Simplified).txt /usr/share/doc/mssql-server/license_Std_Linux_Chinese (Traditional).txt /usr/share/doc/mssql-server/license_Std_Linux_French.txt /usr/share/doc/mssql-server/license_Std_Linux_German.txt /usr/share/doc/mssql-server/license_Std_Linux_Italian.txt /usr/share/doc/mssql-server/license_Std_Linux_Japanese.txt /usr/share/doc/mssql-server/license_Std_Linux_Korean.txt /usr/share/doc/mssql-server/license_Std_Linux_Portuguese (Brazil).txt /usr/share/doc/mssql-server/license_Std_Linux_Russian.txt /usr/share/doc/mssql-server/license_Std_Linux_Spanish.txt /usr/share/man/man1/mssql-conf.1.gz /usr/share/man/man1/sqlservr.1.gz # yum install -y mssql-server Resolving Dependencies --> Running transaction check ---> Package mssql-server.x86_64 0:14.0.1000.169-2 will be installed --> Processing Dependency: libsss_nss_idmap for package: mssql-server-14.0.1000.169-2.x86_64 --> Processing Dependency: gdb for package: mssql-server-14.0.1000.169-2.x86_64 --> Processing Dependency: bzip2 for package: mssql-server-14.0.1000.169-2.x86_64 --> Running transaction check ---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed ---> Package gdb.x86_64 0:7.6.1-100.el7 will be installed ---> Package libsss_nss_idmap.x86_64 0:1.15.2-50.el7_4.6 will be installed --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================================== Package Arch Version Repository Size =========================================================================================================================== Installing: mssql-server x86_64 14.0.1000.169-2 packages-microsoft-com-mssql-server-2017 164 M Installing for dependencies: bzip2 x86_64 1.0.6-13.el7 base 52 k gdb x86_64 7.6.1-100.el7 base 2.4 M libsss_nss_idmap x86_64 1.15.2-50.el7_4.6 updates 130 k Transaction Summary =========================================================================================================================== Install 1 Package (+3 Dependent packages) Total download size: 167 M Installed size: 171 M Downloading packages: (1/4): bzip2-1.0.6-13.el7.x86_64.rpm | 52 kB 00:00:00 (2/4): libsss_nss_idmap-1.15.2-50.el7_4.6.x86_64.rpm | 130 kB 00:00:00 (3/4): gdb-7.6.1-100.el7.x86_64.rpm | 2.4 MB 00:00:13 warning: /var/cache/yum/x86_64/7/packages-microsoft-com-mssql-server-2017/packages/mssql-server-14.0.1000.169-2.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY Public key for mssql-server-14.0.1000.169-2.x86_64.rpm is not installed (4/4): mssql-server-14.0.1000.169-2.x86_64.rpm | 164 MB 00:01:59 --------------------------------------------------------------------------------------------------------------------------- Total 1.4 MB/s | 167 MB 00:01:59 Retrieving key from 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 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : bzip2-1.0.6-13.el7.x86_64 1/4 Installing : libsss_nss_idmap-1.15.2-50.el7_4.6.x86_64 2/4 Installing : gdb-7.6.1-100.el7.x86_64 3/4 Installing : mssql-server-14.0.1000.169-2.x86_64 4/4 +--------------------------------------------------------------+ Please run 'sudo /opt/mssql/bin/mssql-conf setup' to complete the setup of Microsoft SQL Server +--------------------------------------------------------------+ Verifying : gdb-7.6.1-100.el7.x86_64 1/4 Verifying : libsss_nss_idmap-1.15.2-50.el7_4.6.x86_64 2/4 Verifying : mssql-server-14.0.1000.169-2.x86_64 3/4 Verifying : bzip2-1.0.6-13.el7.x86_64 4/4 Installed: mssql-server.x86_64 0:14.0.1000.169-2 Dependency Installed: bzip2.x86_64 0:1.0.6-13.el7 gdb.x86_64 0:7.6.1-100.el7 libsss_nss_idmap.x86_64 0:1.15.2-50.el7_4.6 Complete! |
セットアップはライセンスの種類とライセンス許諾、SA(SQL Server system administrator)のパスワード設定を行います。
今回は無償版のExpressとしてインストールしました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# /opt/mssql/bin/mssql-conf setup Choose an edition of SQL Server: 1) Evaluation (free, no production use rights, 180-day limit) 2) Developer (free, no production use rights) 3) Express (free) 4) Web (PAID) 5) Standard (PAID) 6) Enterprise (PAID) 7) Enterprise Core (PAID) 8) I bought a license through a retail sales channel and have a product key to enter. Details about editions can be found at https://go.microsoft.com/fwlink/?LinkId=852748 Use of PAID editions of this software requires separate licensing through a Microsoft Volume Licensing program. By choosing a PAID edition, you are verifying that you have the appropriate number of licenses in place to install and run this software. Enter your edition(1-8): 3 The license terms for this product can be found in /usr/share/doc/mssql-server or downloaded from: https://go.microsoft.com/fwlink/?LinkId=855862 The privacy statement can be viewed at: https://go.microsoft.com/fwlink/?LinkId=853010 Do you accept the license terms? [Yes/No]:Yes Enter the SQL Server system administrator password: Confirm the SQL Server system administrator password: Configuring SQL Server... The licensing PID was successfully processed. The new edition is [Express Edition]. Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service. Setup has completed successfully. SQL Server is now starting. |
セットアップを実行すると自動起動が有効になりサービスが起動しています。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# systemctl list-unit-files | grep mssql-server mssql-server.service enabled # 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 Mon 2017-10-23 11:44:53 JST; 1min 41s ago Docs: https://docs.microsoft.com/en-us/sql/linux Main PID: 1649 (sqlservr) CGroup: /system.slice/mssql-server.service |-1649 /opt/mssql/bin/sqlservr `-1670 /opt/mssql/bin/sqlservr Oct 23 11:44:56 centos7.rootlinks.net sqlservr[1649]: 2017-10-23 11:44:56.31 spid18s SQL Server is now ready for...red. Oct 23 11:44:56 centos7.rootlinks.net sqlservr[1649]: 2017-10-23 11:44:56.44 spid6s 8 transactions rolled forwa...red. Oct 23 11:44:56 centos7.rootlinks.net sqlservr[1649]: 2017-10-23 11:44:56.45 spid6s 0 transactions rolled back ...red. Oct 23 11:44:56 centos7.rootlinks.net sqlservr[1649]: 2017-10-23 11:44:56.46 spid11s Polybase feature disabled. Oct 23 11:44:56 centos7.rootlinks.net sqlservr[1649]: 2017-10-23 11:44:56.46 spid11s Clearing tempdb database. Oct 23 11:44:56 centos7.rootlinks.net sqlservr[1649]: 2017-10-23 11:44:56.79 spid11s Starting up database 'tempdb'. Oct 23 11:44:57 centos7.rootlinks.net sqlservr[1649]: 2017-10-23 11:44:57.01 spid21s The Service Broker endpoint...ate. Oct 23 11:44:57 centos7.rootlinks.net sqlservr[1649]: 2017-10-23 11:44:57.01 spid21s The Database Mirroring endp...ate. Oct 23 11:44:57 centos7.rootlinks.net sqlservr[1649]: 2017-10-23 11:44:57.05 spid21s Service Broker manager has ...ted. Oct 23 11:44:57 centos7.rootlinks.net sqlservr[1649]: 2017-10-23 11:44:57.06 spid6s Recovery is complete. This ...red. Hint: Some lines were ellipsized, use -l to show in full. |
リモートで接続するならFirewallを許可します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# firewall-cmd --add-port=1433/tcp --permanent success # firewall-cmd --reload success # firewall-cmd --list-all public (active) target: default icmp-block-inversion: no interfaces: eno16777736 sources: services: dhcpv6-client ssh https ports: 1433/tcp protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: |