[SQL Server]Install SQL2017 on CentOS

這篇來親自安裝SQL Server 2017在CentOS

安裝過程很單純,整體也相當快速。

Download the Microsoft SQL Server Red Hat repository configuration file:

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

Run the following commands to install SQL Server:

yum install -y mssql-server

Set the SA password and choose your edition

/opt/mssql/bin/mssql-conf setup

Set up firewall

firewall-cmd --zone=public --add-port=1433/tcp --permanent
firewall-cmd –reload

 

install sql command line tools(sqlcmd and bcp)

curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
yum install -y mssql-tools unixODBC-devel

Environment variable configuration

export PATH=$PATH:/opt/mssql-tools/bin

source /etc/profile

echo $PATH

 

Testing via sqlcmd

sqlcmd -S locahost -U sa -P 'your pwd'

testing via SSMS

note:預設使用mssql帳號和群組

 

參考

Installation guidance for SQL Server on Linux

Install SQL Server and create a database on Red Hat