How to Install Microsoft SQL Server on Linux
Now Microsoft SQL Server supports on Linux platforms.
I have tested on Redhat, CentOS and Oracle Linux.
Here we will see step by step guide to install SQL server on Linux.
Supported platforms
Platform |
Supported version(s) |
Get |
Red Hat Enterprise Linux |
7.3 |
|
SUSE Linux Enterprise Server |
v12 SP2 |
|
Ubuntu |
16.04 and 16.10 |
|
Docker Engine |
1.8+ |
Prerequisites
- You need at least 3.25 GB of memory to run SQL Server on Linux.
Install SQL Server
- Login to root user using putty.
su - root
- We will download and install SQL server repositories by using following commands.
# curl https://packages.microsoft.com/config/rhel/7/mssql-server.repo
> /etc/yum.repos.d/mssql-server.repo
# curl https://packages.microsoft.com/config/rhel/7/prod.repo
> /etc/yum.repos.d/msprod.repo
- Verify .repo files under /etc/yum.repos.d/ directory
- To install SQL Server and MSSQL Tools package, run the following commands
# yum install -y mssql-server mssql-tools
- Run the configuration script to accept license terms and set SA password
# cd /opt/mssql/bin/
# sudo ./mssql-config setup
- To verify the mssql-server service is running
# systemctl status mssql-server
- To open tcp-1433 port on system firewall in order to allow external clients to communicate with the database server.
# firewall-cmd --add-port=1433/tcp --permanent # firewall-cmd --reload
- Testing SQL Server
# cd /opt/mssql-tool/bin/
# ./sqlcmd -S srv01 -U SA
Upgrade SQL Server
- To upgrade the mssql-server package on Linux, execute the following command
# yum update mssql-server
Uninstall SQL Server
- To uninstall or remove the mssql-server package on Linux, execute the following command
# yum remove mssql-server
(Remove or delete mssql-server package)
# rm -rf /var/opt/mssql/
(Remove or delete database files)
Advertisements