Red Hat Enterprise Linux 7.2下使用RPM包安装SQL Server vNext
1.下载安装包
mssql-server:https://packages.microsoft.com/rhel/7/mssql-server/
mssql-tools:https://packages.microsoft.com/rhel/7/prod/
[root@FSZABBIX home]# ll
总用量 150072
-rw-r--r-- 1 root root 4036892 1月 23 14:59 msodbcsql-13.1.3.0-1.x86_64.rpm
-rw-r--r-- 1 root root 148973180 1月 23 14:33 mssql-server-14.0.200.24-2.x86_64.rpm
-rw-r--r-- 1 root root 254352 1月 23 14:58 mssql-tools-14.0.2.0-1.x86_64.rpm
2.安装mssql-server
[root@FSZABBIX home]# rpm -ivh mssql-server-14.0.200.24-2.x86_64.rpm
警告:mssql-server-14.0.200.24-2.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID be1229cf: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mssql-server-14.0.200.24-2 ################################# [100%]
+-------------------------------------------------------------------+
| Please run /opt/mssql/bin/sqlservr-setup to complete the setup of |
| Microsoft(R) SQL Server(R). |
+-------------------------------------------------------------------+
3.设置数据库并启动
[root@FSZABBIX home]# /opt/mssql/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:
The specified password does not meet SQL Server password policy requirements
because it is not complex enough. The password must be at least 8 characters
long and contain characters from three of the following five sets: uppercase
letters, lowercase letters, numbers, non-alphanumeric characters, or unicode
characters that are categorized as alphabetic characters, but are not
uppercase or lowercase.
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.
4.通过systemctl来检查mssql-server的服务的启动状态
[root@FSZABBIX home]# 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 一 2017-01-23 14:44:49 CST; 6min ago
Main PID: 9638 (sqlservr)
CGroup: /system.slice/mssql-server.service
├─9638 /opt/mssql/bin/sqlservr
└─9648 /opt/mssql/bin/sqlservr
1月 23 14:44:57 FSZABBIX sqlservr[9638]: 2017-01-23 06:44:57.90 spid20s The Service Broker endpoint is in disabled or stopped state.
1月 23 14:44:57 FSZABBIX sqlservr[9638]: 2017-01-23 06:44:57.90 spid20s The Database Mirroring endpoint is in disabled or stopped state.
1月 23 14:44:57 FSZABBIX sqlservr[9638]: 2017-01-23 06:44:57.93 spid20s Service Broker manager has started.
1月 23 14:44:57 FSZABBIX sqlservr[9638]: 2017-01-23 06:44:57.98 spid16s A self-generated certificate was successfully loaded for encryption.
1月 23 14:44:58 FSZABBIX sqlservr[9638]: 2017-01-23 06:44:58.01 spid16s Server is listening on [ 0.0.0.0 <ipv4> 1433].
1月 23 14:44:58 FSZABBIX sqlservr[9638]: 2017-01-23 06:44:58.05 Server Server is listening on [ 127.0.0.1 <ipv4> 1434].
1月 23 14:44:58 FSZABBIX sqlservr[9638]: 2017-01-23 06:44:58.08 Server Dedicated admin connection support was established for listening locally on port 1434.
1月 23 14:44:58 FSZABBIX sqlservr[9638]: 2017-01-23 06:44:58.08 spid16s Recovery is complete. This is an informational message only. No user action is required.
1月 23 14:44:58 FSZABBIX sqlservr[9638]: 2017-01-23 06:44:58.09 spid16s SQL Server is now ready for client connections. This is an informational message; no user action is required.
1月 23 14:50:00 FSZABBIX sqlservr[9638]: 2017-01-23 06:50:00.95 spid51 Using 'dbghelp.dll' version '4.0.5'
5.配置数据库
通过自带的mssql-conf命令进行一些简单的配置,可配置项不多,主要是监听端口,默认的数据文件所在目录,日志所在目录,备份所在目录等
[root@FSZABBIX home]# /opt/mssql/bin/mssql-conf list
Supported settings using the 'set' option:
tcpport
defaultbackupdir
defaultdumpdir
defaultlogdir
defaultdatadir
For all command line options use -h or –help
6.安装mssql-tool
如果希望在服务器上直接通过sqlcmd命令行登入数据库,还需要额外安装一个mssql-tools的RPM包,这个安装包里包括sqlcmd和bcp(Bulk import-export utility)
安装mssql-tool,需要先安装msodbcsql包
[root@FSZABBIX home]# rpm -ivh msodbcsql-13.1.3.0-1.x86_64.rpm
警告:msodbcsql-13.1.3.0-1.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID be1229cf: NOKEY
准备中... ################################# [100%]
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
Please enter YES or NO
Do you accept the license terms? (Enter YES or NO)
YES
正在升级/安装...
1:msodbcsql-13.1.3.0-1 ################################# [100%]
[root@FSZABBIX home]# rpm -ivh mssql-tools-14.0.2.0-1.x86_64.rpm
警告:mssql-tools-14.0.2.0-1.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID be1229cf: NOKEY
准备中... ################################# [100%]
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
正在升级/安装...
1:mssql-tools-14.0.2.0-1 ################################# [100%]
7.通过sqlcmd登录数据库