Microsoft has released SQL Server for Redhat Enterprise Linux and Ubuntu; you can now start testing this latest preview of SQL Server in your environment.
This version is still in preview; it is meant for testing and development purpose only. Try it on your own.
Supported Operating Systems:
Redhat Enterprise Linux 7.2
Ubuntu 16.04
Setup Repository:
### Ubuntu 16.04 ### $ sudo apt-get install -y wget $ wget https://packages.microsoft.com/keys/microsoft.asc $ sudo apt-key add microsoft.asc $ curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee /etc/apt/sources.list.d/mssql.list $ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list ### CentOS 7 ### # yum -y install wget # wget https://packages.microsoft.com/config/rhel/7/mssql-server.repo # wget https://packages.microsoft.com/config/rhel/7/prod.repo # mv *.repo /etc/yum.repos.d/mssql.repoInstall MS SQL Server on Linux:
### Ubuntu 16.04 ### $ sudo apt-get update $ sudo apt-get install -y mssql-server ### CentOS 7 ### # yum install -y mssql-serverSetup MS SQL server.
### Ubuntu 16.04 ### $ sudo /opt/mssql/bin/sqlservr-setup ### CentOS 7 ### # /opt/mssql/bin/sqlservr-setup
Output:
Microsoft(R) SQL Server(R) Setup You can abort setup at anytime by pressing Ctrl-C. Start this program with the --help option for information about running it in unattended mode. The license terms for this product can be downloaded from http://go.microsoft.com/fwlink/?LinkId=746388 and found in /usr/share/doc/mssql-server/LICENSE.TXT. Do you accept the license terms? If so, please type "YES": YES Please enter a password for the system administrator (SA) account: Enter Admin Password Please confirm the password for the system administrator (SA) account: Re Enter Admin Password Setting system administrator (SA) account password... Do you wish to start the SQL Server service now? [y/n]: n You can use sqlservr-setup --start-service to start SQL Server, and sqlservr-setup --enable-service to enable SQL Server to start at boot. Setup completed successfully.Start the MS SQL Service.
### Ubuntu 16.04 ### $ sudo systemctl start mssql-server $ sudo systemctl enable mssql-server ### CentOS 7 ### # systemctl start mssql-server # systemctl enable mssql-server
Install SQL Server tools on Linux:
It provides command line tools (sqlcmd and bcp), ODBC drivers and their dependencies.
### Ubuntu 16.04 ### $ sudo apt-get install -y mssql-tools ### CentOS 7 ### # yum install -y mssql-toolsSteps:
Accept License terms
Firewall (CentOS / RHEL):
Configure the firewall to allow 1433 port so that we can access the SQL server from external machines.
# firewall-cmd --permanent --zone=public --add-port=1433/tcp # firewall-cmd --reloadConnect to MS SQL server:
Once the installation is complete, connect to MS SQL server using the following command.
sqlcmd -H 127.0.0.1 -U sa Password: 1>
Microsoft Official Document Here