1. Microsoft SQL Server For Linux installation packages description
mssql-cli.x86_64 : Microsoft SQL Server CLI
mssql-mlservices-mlm-py-9.4.5.x86_64.x86_64 : Microsoft Machine Learning Services
mssql-mlservices-mlm-r-9.4.5.x86_64.x86_64 : Microsoft Machine Learning Services
mssql-mlservices-mml-py-9.4.5.x86_64.x86_64 : Microsoft Machine Learning Services
mssql-mlservices-mml-r-9.4.5.x86_64.x86_64 : Microsoft Machine Learning Services
mssql-mlservices-packages-py-9.4.5.x86_64.x86_64 : Microsoft Machine Learning Services
mssql-mlservices-packages-r-9.4.5.x86_64.x86_64 : Microsoft Machine Learning Services
mssql-mlservices-python-9.4.5.x86_64.x86_64 : Microsoft Machine Learning Services
mssql-server.x86_64 : Microsoft SQL Server Relational Database Engine
mssql-server-extensibility.x86_64 : Extensibility support for Microsoft SQL Server Relational Database Engine
mssql-server-extensibility-java.x86_64 : Extensibility Java language support for Microsoft SQL Server Relational Database Engine
mssql-server-fts.x86_64 : Microsoft SQL Server Full Text Search
mssql-server-ha.x86_64 : High Availability support for Microsoft SQL Server Relational Database Engine
mssql-server-is.x86_64 : Microsoft SQL Server Integration Services
mssql-tools.x86_64 : Tools for Microsoft(R) SQL Server (R)
mssql-server-polybase-15.0.4073.23-4.x86_64 : Microsoft SQL Server Polybase for SQL server,Oracle,Teradata,Mongodb
mssql-server-polybase-hadoop-15.0.4073.23-4.x86 : Microsoft SQL Server Polybase for Hadoop
2. MSSQL 2019在Centos 7.8上的安装
2.1 配置hosts
代码语言:javascript复制[root@lmssql2019 home]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# Microsoft SQL Server hosts configuration
10.10.251.147 lmssql2019
2.2 关闭防火墙
代码语言:javascript复制[root@lmssql2019 home]# systemctl stop firewalld
[root@lmssql2019 home]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.servic
2.3 永久关闭selinux
代码语言:javascript复制[root@lmssql2019 home]# vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targete
2.4 使用sftp上传安装包
代码语言:javascript复制[root@lmssql2019 home]# ll
total 274000
drwx------. 3 cts8 cts8 78 Dec 22 20:22 cts8
-rw-r--r--. 1 root root 807292 Dec 22 22:19 msodbcsql17-17.6.1.1-1.x86_64.rpm
-rw-r--r--. 1 root root 58954712 Dec 22 22:19 mssql-cli-1.0.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 220310804 Dec 22 21:32 mssql-server-15.0.4073.23-4.x86_64.rpm
-rw-r--r--. 1 root root 228628 Dec 22 22:19 mssql-tools-17.6.1.1-1.x86_64.rpm
-rw-r--r--. 1 root root 217872 Dec 22 22:27 unixODBC-2.3.7-1.rh.x86_64.rpm
-rw-r--r--. 1 root root 43504 Dec 22 22:19 unixODBC-devel-2.3.7-1.rh.x86_64.rpm
2.5 安装MSSQL数据库
代码语言:javascript复制
root@lmssql2019 home# rpm -ivh mssql-server-15.0.4073.23-4.x86_64.rpm
warning: mssql-server-15.0.4073.23-4.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Preparing... ################################# 100%
Updating / installing...
1:mssql-server-15.0.4073.23-4 ################################# 100%
--------------------------------------------------------------
Please run 'sudo /opt/mssql/bin/mssql-conf setup'
to complete the setup of Microsoft SQL Server
--------------------------------------------------------------
2.6 配置MSSQL数据库
代码语言:javascript复制[root@lmssql2019 home]# /opt/mssql/bin/mssql-conf setup
usermod: no changes
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) - CPU Core utilization restricted to 20 physical/40 hyperthreaded
7) Enterprise Core (PAID) - CPU Core utilization up to Operating System Maximum
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=2109348&clcid=0x409
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): 5 #选择标准版,客户购买的是标准版
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=2104294&clcid=0x409 # 许可条款
The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409 # 隐私声明
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 [Standard Edition].
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.
Setup has completed successfully. SQL Server is now starting.
2.7 查看mssql-server的服务状态
代码语言:javascript复制[root@lmssql2019 home]# 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 Tue 2020-12-22 21:42:41 CST; 38min ago
Docs: https://docs.microsoft.com/en-us/sql/linux
Main PID: 12580 (sqlservr)
CGroup: /system.slice/mssql-server.service
├─12580 /opt/mssql/bin/sqlservr
└─12604 /opt/mssql/bin/sqlservr
Dec 22 21:42:48 lmssql2019 sqlservr[12580]: 2020-12-22 21:42:48.90 spid9s ....
Dec 22 21:42:50 lmssql2019 sqlservr[12580]: 2020-12-22 21:42:50.42 spid9s ....
Dec 22 21:42:50 lmssql2019 sqlservr[12580]: 2020-12-22 21:42:50.42 spid9s ....
Dec 22 21:42:51 lmssql2019 sqlservr[12580]: 2020-12-22 21:42:51.41 spid9s ....
Dec 22 21:42:51 lmssql2019 sqlservr[12580]: 2020-12-22 21:42:51.45 spid28s ....
Dec 22 21:42:51 lmssql2019 sqlservr[12580]: 2020-12-22 21:42:51.45 spid28s ....
Dec 22 21:42:51 lmssql2019 sqlservr[12580]: 2020-12-22 21:42:51.57 spid28s ....
Dec 22 21:42:51 lmssql2019 sqlservr[12580]: 2020-12-22 21:42:51.57 spid8s ....
Dec 22 21:42:51 lmssql2019 sqlservr[12580]: 2020-12-22 21:42:51.74 spid14s ....
Dec 22 21:42:51 lmssql2019 sqlservr[12580]: 2020-12-22 21:42:51.74 spid14s ....
Hint: Some lines were ellipsized, use -l to show in full.
2.8 设置mssql-server开机启动
代码语言:javascript复制[root@lmssql2019 home]# systemctl enable mssql-serve
2.9 安装客户端# 安装依赖,从ISO镜像安装
代码语言:javascript复制
[root@lmssql2019 yum.repos.d]# yum -y install libunwind
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
c7-media | 3.6 kB 00:00:00
(1/2): c7-media/group_gz | 153 kB 00:00:00
(2/2): c7-media/primary_db | 3.3 MB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package libunwind.x86_64 2:1.2-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================
Package Arch Version Repository Size
==================================================================================
Installing:
libunwind x86_64 2:1.2-2.el7 c7-media 57 k
Transaction Summary
==================================================================================
Install 1 Package
Total download size: 57 k
Installed size: 150 k
Downloading packages:
warning: /media/Packages/libunwind-1.2-2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for libunwind-1.2-2.el7.x86_64.rpm is not installed
Retrieving key from 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-8.2003.0.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
Warning: RPMDB altered outside of yum.
Installing : 2:libunwind-1.2-2.el7.x86_64 1/1
Verifying : 2:libunwind-1.2-2.el7.x86_64 1/1
Installed:
libunwind.x86_64 2:1.2-2.el7
Complete!
# 安装unixODBC
[root@lmssql2019 home]# rpm -ivh unixODBC-2.3.7-1.rh.x86_64.rpm
warning: unixODBC-2.3.7-1.rh.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:unixODBC-2.3.7-1.rh ################################# [100%]
[root@lmssql2019 home]#
[root@lmssql2019 home]# rpm -ivh unixODBC-devel-2.3.7-1.rh.x86_64.rpm
warning: unixODBC-devel-2.3.7-1.rh.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:unixODBC-devel-2.3.7-1.rh ################################# [100%]
# 安装msodbcsql
[root@lmssql2019 home]# rpm -ivh msodbcsql17-17.6.1.1-1.x86_64.rpm
warning: msodbcsql17-17.6.1.1-1.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Preparing... ################################# [100%]
The license terms for this product can be downloaded from
https://aka.ms/odbc17eula 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
Updating / installing...
1:msodbcsql17-17.6.1.1-1 ################################# [100%]
# 安装mssql-tools
[root@lmssql2019 home]# rpm -ivh mssql-tools-17.6.1.1-1.x86_64.rpm
warning: mssql-tools-17.6.1.1-1.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Preparing... ################################# [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
Updating / installing...
1:mssql-tools-17.6.1.1-1 ################################# [100%]
# 安装mssql-cli
[root@lmssql2019 home]# rpm -ivh mssql-cli-1.0.0-1.el7.x86_64.rpm
warning: mssql-cli-1.0.0-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mssql-cli-1.0.0-1.el7 ################################# [100%]
2.10 设置环境变量
代码语言:javascript复制[root@lmssql2019 home]# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
[root@lmssql2019 home]# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
[root@lmssql2019 home]# source ~/.bashrc
2.11 黑屏客户端测试
代码语言:javascript复制[root@lmssql2019 ~]# sqlcmd -S localhost -U sa -P PP--ssw00rd
1> select name from sys.databases
2> go
name
---------------------------------------------------
master
tempdb model
msdb
(4 rows affected)
1>
2.12 版本查看
代码语言:javascript复制[root@lmssql2019 home]# sqlcmd -S localhost -U SA -Q 'select @@VERSION'
Password:
---------------------------------------------------------------------------
Microsoft SQL Server 2019 (RTM-CU8) (KB4577194) - 15.0.4073.23 (X64)
Sep 23 2020 16:03:08
Copyright (C) 2019 Microsoft Corporation
Standard Edition (64-bit) on Linux (CentOS Linux 7 (Core)) <X64>
2.13 mssql-cli测试
代码语言:javascript复制[root@lmssql2019 home]# mssql-cli -U sa
Password:
master> select name from sys.databases;
Time: 0.453s
--------
| name |
|--------|
| master |
| tempdb |
| model |
| msdb |
--------
(4 rows affected)
master>