You must have a RHEL 7.3 or 7.4 machine with at least 3.25 GB of memory.
To install Red Hat Enterprise Linux on your own machine, go to http://access.redhat.com/products/red-hat-enterprise-linux/evaluation.
To configure SQL Server on RHEL, run the following commands in a terminal to install the mssql-server package:
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo
sudo yum install -y mssql-server
sudo /opt/mssql/bin/mssql-conf setup
systemctl status mssql-server
sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
sudo firewall-cmd --reload
At this point, SQL Server is running on your RHEL machine and is ready to use!
To create a database, you need to connect with a tool that can run Transact-SQL statements on the SQL Server. The following steps install the SQL Server command-line tools: sqlcmd and bcp.
sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
sudo yum remove unixODBC-utf16 unixODBC-utf16-devel
sudo yum install -y mssql-tools unixODBC-devel
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
The following steps use sqlcmd to locally connect to your new SQL Server instance.
sqlcmd -S localhost -U SA -P '(YourPassword)'
The following sections walk you through using sqlcmd to create a new database, add data, and run a simple query.
The following steps create a new database named TestDB.
CREATE DATABASE TestDB
SELECT Name from sys.Databases
Next create a new table, Inventory, and insert two new rows.
CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT)
INSERT INTO Inventory VALUES (1, 'banana', 150); INSERT INTO Inventory VALUES (2, 'orange', 154);
Now, run a query to return data from the Inventory table.
SELECT * FROM Inventory WHERE quantity > 152;
To end your sqlcmd session, type QUIT:
SQL Server tools on Windows connect to SQL Server instances on Linux in the same way they would connect to any remote SQL Server instance.
If you have a Windows machine that can connect to your Linux machine, try the same steps in this topic from a Windows command-prompt running sqlcmd. Just verify that you use the target Linux machine name or IP address rather than localhost, and make sure that TCP port 1433 is open. If you have any problems connecting from Windows, see connection troubleshooting recommendations.
For other tools that run on Windows but connect to SQL Server on Linux, see: