本文基于微软官方文档建立,原文地址:
https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-setup-red-hat
本文提供了在Red Hat Enterprise Linux (RHEL)系统中安装SQL Server vNext CTP 1.3的完整攻略。
注意
你需要至少3.25GB的内存来运行SQL Server的Linux版。 SQL Server引擎此次测试了最高1 TB内存。
安装 SQL Server
To install the mssql-server package on RHEL, follow these steps:
-
Enter superuser mode.
sudo su
-
Download the Microsoft SQL Server Red Hat repository configuration file:
curl https://packages.microsoft.com/config/rhel/7/mssql-server.repo > /etc/yum.repos.d/mssql-server.repo
-
Exit superuser mode.
exit
-
Run the following commands to install SQL Server:
sudo yum install -y mssql-server
-
安装完毕后,运行mssql-conf setup命令,按照出现的提示操作。请务必为超级管理员账户(SA)指定一个强密码(至少8位字符,包含大写和小写字母,数字和/或符号)。
sudo /opt/mssql/bin/mssql-conf setup
-
当配置完成后,请确认服务已经运行:
systemctl status mssql-server
-
如果允许远程连接,要在RHEL(CentOS)的防火墙开启SQL Server的端口。默认为1433。如果你的防火墙使用FirewallD。则可以使用以下命令:
-
sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent sudo firewall-cmd --reload
更新SQL Server
To upgrade the mssql-server package on RHEL, execute the following command:
sudo yum update mssql-server
These commands will download the newest package and replace the binaries located under /opt/mssql/
. The user generated databases and system databases will not be affected by this operation.
卸载SQL Server
To remove the mssql-server package on RHEL, follow these steps:
-
Run the
remove
command. This will delete the package and remove the files under/opt/mssql/
. However, this command will not affect user-generated and system database files, which are located under/var/opt/mssql
.Copy
bash
sudo yum remove mssql-server
-
Removing the package will not delete the generated database files. If you want to delete the database files use the following command:
Copy
bash
sudo rm -rf /var/opt/mssql/