centos上安装sqlserver

1、下载 Microsoft SQL Server Red Hat 存储库配置文件

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

2、安装 SQL Server

yum install -y mssql-server  

3、软件包安装完成后,运行mssql conf 安装命令(和2016的安装命令有区别),进行配置。

/opt/mssql/bin/mssql-conf setup  
[root@localhost 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&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): 1
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=855864&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: 
The specified password does not meet SQL Server password policy requirements because it is too short. The password must be at least 8 characters
Enter the SQL Server system administrator password: 
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 four sets: uppercase letters, lowercase letters, numbers, and symbols.
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 [Enterprise Evaluation 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.

4、配置完后,要验证一下服务是否启动了

[root@localhost bin]# 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 2018-06-11 14:58:56 CST; 4min 9s ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 794 (sqlservr)
   CGroup: /system.slice/mssql-server.service
           ├─794 /opt/mssql/bin/sqlservr
           └─820 /opt/mssql/bin/sqlservr

Jun 11 14:59:00 localhost.localdomain sqlservr[794]: 2018-06-11 14:59:00.80 spid6s      8 tran...d.
Jun 11 14:59:00 localhost.localdomain sqlservr[794]: 2018-06-11 14:59:00.80 spid6s      0 tran...d.
Jun 11 14:59:00 localhost.localdomain sqlservr[794]: 2018-06-11 14:59:00.81 spid11s     Polyba...d.
Jun 11 14:59:00 localhost.localdomain sqlservr[794]: 2018-06-11 14:59:00.81 spid11s     Cleari...e.
Jun 11 14:59:01 localhost.localdomain sqlservr[794]: 2018-06-11 14:59:01.29 spid11s     Starti...'.
Jun 11 14:59:01 localhost.localdomain sqlservr[794]: 2018-06-11 14:59:01.69 spid11s     The te...).
Jun 11 14:59:01 localhost.localdomain sqlservr[794]: 2018-06-11 14:59:01.75 spid22s     The Se...e.
Jun 11 14:59:01 localhost.localdomain sqlservr[794]: 2018-06-11 14:59:01.76 spid22s     The Da...e.
Jun 11 14:59:01 localhost.localdomain sqlservr[794]: 2018-06-11 14:59:01.78 spid22s     Servic...d.
Jun 11 14:59:01 localhost.localdomain sqlservr[794]: 2018-06-11 14:59:01.80 spid6s      Recove...d.
Hint: Some lines were ellipsized, use -l to show in full.

或者换个验证方式

[root@localhost bin]# ps -ef | grep mssql
mssql      794     1  0 Jun11 ?        00:00:00 /opt/mssql/bin/sqlservr
mssql      820   794  1 Jun11 ?        00:11:41 /opt/mssql/bin/sqlservr
root     13360   532  0 10:02 pts/3    00:00:00 grep --color=auto mssql

5、安装sqlserver 连接工具
5.1 curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
5.2 yum install -y mssql-tools
5.3 测试。

[root@localhost bin]# /opt/mssql-tools/bin/sqlcmd -S localhost -U sa
Password: 
1> select db_name();
2> go

--------------------------------------------------------------------------------------------------------------------------------
master                                                                                                                          

(1 rows affected)

猜你喜欢

转载自blog.csdn.net/u014608280/article/details/80661537