Name and summary matches only, use "search all" for everything.可以看到有两个版本,ha版本应该是做高可用性的版本。安装mssql-server:[root@linuxidc~]# yum search mssql Loaded plugins: fastestmirror, langpacks Repository packages-microsoft-com-mssql-server is listed more than once in the configuration Loading mirror speeds from cached hostfile =========================================================================== N/S matched: mssql ============================================================================ mssql-server.x86_64 : Microsoft(R) SQL Server(R) Relational Database Engine mssql-server-ha.x86_64 : Microsoft(R) SQL Server(R) Relational Database Engine
Name and summary matches only, use "search all" for everything. [root@linuxidc~]# yum install mssql-server -y Loaded plugins: fastestmirror, langpacks Repository packages-microsoft-com-mssql-server is listed more than once in the configuration packages-microsoft-com-mssql-server | 2.9 kB 00:00:00 Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package mssql-server.x86_64 0:14.0.1.246-6 will be installed --> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================================================== Package Arch Version Repository Size =========================================================================================================================================================================== Installing: mssql-server x86_64 14.0.1.246-6 packages-microsoft-com-mssql-server 138 M
Total download size: 138 M Installed size: 138 M Downloading packages: warning: /var/cache/yum/x86_64/7/packages-microsoft-com-mssql-server/packages/mssql-server-14.0.1.246-6.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY Public key for mssql-server-14.0.1.246-6.x86_64.rpm is not installed mssql-server-14.0.1.246-6.x86_64.rpm | 138 MB 00:00:05 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 : mssql-server-14.0.1.246-6.x86_64 1/1
+-------------------------------------------------------------------+ | Please run /opt/mssql/bin/sqlservr-setup to complete the setup of | | Microsoft(R) SQL Server(R). | +-------------------------------------------------------------------+
You can abort setup at anytime by pressing Ctrl-C. Start this program with the --help option for information about running it in unattended mode.
The license terms for this product can be downloaded from http://go.microsoft.com/fwlink/?LinkId=746388 and found in /usr/share/doc/mssql-server/LICENSE.TXT.
Do you accept the license terms? If so, please type "YES": YES
Please enter a password for the system administrator (SA) account: Please confirm the password for the system administrator (SA) account:
Setting system administrator (SA) account password... sqlservr: This program requires a machine with at least 3250 megabytes of memory. Microsoft(R) SQL Server(R) setup failed with error code 1. Please check the setup log in /var/opt/mssql/log/setup-20161117-184346.log for more information.我采用的是A1的机器,配置过程提示,内存需要大于3G。把机器升级到A2:[root@linuxidcserver bin]# ./sqlservr-setup Microsoft(R) SQL Server(R) Setup
You can abort setup at anytime by pressing Ctrl-C. Start this program with the --help option for information about running it in unattended mode.
The license terms for this product can be downloaded from http://go.microsoft.com/fwlink/?LinkId=746388 and found in /usr/share/doc/mssql-server/LICENSE.TXT.
Do you accept the license terms? If so, please type "YES": YES
Please enter a password for the system administrator (SA) account: Please confirm the password for the system administrator (SA) account:
Setting system administrator (SA) account password...
Do you wish to start the SQL Server service now? [y/n]: y Do you wish to enable SQL Server to start on boot? [y/n]: y Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service. Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server-telemetry.service to /usr/lib/systemd/system/mssql-server-telemetry.service.
Setup completed successfully.配置成功。检查状态:[root@linuxidcserver bin]# systemctl status mssql ● mssql.service Loaded: not-found (Reason: No such file or directory) Active: inactive (dead) [root@linuxidcserver bin]# systemctl status mssql-server ● mssql-server.service - Microsoft(R) SQL Server(R) Database Engine Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2016-11-17 19:52:06 UTC; 37s ago Main PID: 1539 (sqlservr) CGroup: /system.slice/mssql-server.service ├─1539 /opt/mssql/bin/sqlservr └─1547 /opt/mssql/bin/sqlservr
Nov 17 19:52:14 linuxidcserver sqlservr[1539]: 2016-11-17 19:52:15.06 spid17s SQL Server is now ready for client connections. This is an infor...equired. Nov 17 19:52:15 linuxidcserver sqlservr[1539]: 2016-11-17 19:52:15.13 spid6s Polybase feature disabled. Nov 17 19:52:15 linuxidcserver sqlservr[1539]: 2016-11-17 19:52:15.13 spid6s Clearing tempdb database. Nov 17 19:52:16 linuxidcserver sqlservr[1539]: 2016-11-17 19:52:16.91 spid6s Starting up database "tempdb". Nov 17 19:52:17 linuxidcserver sqlservr[1539]: 2016-11-17 19:52:17.58 spid6s The tempdb database has 1 data file(s). Nov 17 19:52:17 linuxidcserver sqlservr[1539]: 2016-11-17 19:52:17.58 spid20s The Service Broker endpoint is in disabled or stopped state. Nov 17 19:52:17 linuxidcserver sqlservr[1539]: 2016-11-17 19:52:17.58 spid20s The Database Mirroring endpoint is in disabled or stopped state. Nov 17 19:52:17 linuxidcserver sqlservr[1539]: 2016-11-17 19:52:17.67 spid20s Service Broker manager has started. Nov 17 19:52:17 linuxidcserver sqlservr[1539]: 2016-11-17 19:52:17.71 spid5s Recovery is complete. This is an informational message only. No ...equired. Nov 17 19:52:22 linuxidcserver sqlservr[1539]: 2016-11-17 19:52:22.59 spid35s The activated proc "[dbo].[sp_syspolicy_events_reader]" running on queue... Hint: Some lines were ellipsized, use -l to show in full.SQL Server已经在运行。3. 检查安装SQL Tools。SQL Tools:sqlcmd是mssql ODBC的一个工具,可以通过yum的repo直接yum安装。首先下载yum的repo:[root@linuxidcserver ~]# wget https://packages.microsoft.com/config/rhel/7/prod.repo --2016-11-17 19:59:49-- https://packages.microsoft.com/config/rhel/7/prod.repo Resolving packages.microsoft.com (packages.microsoft.com)... 13.75.127.55 Connecting to packages.microsoft.com (packages.microsoft.com)|13.75.127.55|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 193 [application/octet-stream] Saving to: "prod.repo"
100%[=================================================================================================================>] 193 --.-K/s in 0s
Total download size: 4.5 M Installed size: 4.5 M Is this ok [y/d/N]: y Downloading packages: (1/4): libtool-ltdl-2.4.2-21.el7_2.x86_64.rpm | 49 kB 00:00:00 (2/4): msodbcsql-13.0.1.0-1.x86_64.rpm | 3.8 MB 00:00:00 (3/4): mssql-tools-14.0.1.246-1.x86_64.rpm | 249 kB 00:00:00 (4/4): unixODBC-utf16-2.3.1-1.x86_64.rpm | 329 kB 00:00:00 ----------------------------------------------------------------------------------------------------------------------------------------------------------- Total 8.3 MB/s | 4.5 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : libtool-ltdl-2.4.2-21.el7_2.x86_64 1/4 Installing : unixODBC-utf16-2.3.1-1.x86_64 2/4 The license terms for this product can be downloaded from http://go.microsoft.com/fwlink/?LinkId=746838 and found in /usr/share/doc/msodbcsql/LICENSE.TXT . By entering "YES", you indicate that you accept the license terms.
Do you accept the license terms? (Enter YES or NO) YES Installing : msodbcsql-13.0.1.0-1.x86_64 3/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 Installing : mssql-tools-14.0.1.246-1.x86_64 4/4 Verifying : libtool-ltdl-2.4.2-21.el7_2.x86_64 1/4 Verifying : msodbcsql-13.0.1.0-1.x86_64 2/4 Verifying : unixODBC-utf16-2.3.1-1.x86_64 3/4 Verifying : mssql-tools-14.0.1.246-1.x86_64 4/4
Complete!安装成功!测试连接:[root@linuxidcserver ~]# sqlcmd -S localhost -U SA Password:登陆成功。创建数据库test:1> create database test; 2> go 1> use test; 2> go Changed database context to "test".查看数据库:1> select name from sys.databases; 2> go name -------------------------------------------------------------------------------------------------------------------------------- master tempdb model msdb test创建表hwtable:1> create table hwtable ( id int, name varchar(20), gender varchar(20), age int); 2> go插入数据:1> insert into hwtable values (1, "weiheng","male",20); 2> go查询:1> select * from hwtable; 2> go id name gender age ----------- -------------------- -------------------- ----------- 1 weiheng male 20
(1 rows affected)MSSQL Sever On Linux就这样安装完成了!本文永久更新链接地址