Installing SQL Server vNext CTP1 on Red Hat Linux 7.2

By:   |   Updated: 2017-01-16   |   Comments (4)   |   Related: > SQL Server on Linux


Problem

Microsoft announced bringing SQL Server to Linux in March 2016. It was a great move for SQL Server professionals because now this will enable them to run SQL Server across both Windows and Linux platforms. Microsoft released its first CTP/public preview for this version of SQL Server on November 16, 2016. Here I will show you how to install this version of SQL Server known as SQL Server vNext on Redhat Linux 7.2 version.

Solution

Microsoft released its first public preview for the next version of SQL Server on Linux on November 16, 2016. The next release of SQL Server brings the power of SQL Server to Linux. Now you can develop applications with SQL Server on Linux, Windows, Ubuntu, or Docker and deploy them as well on these platforms. Microsoft can now compete more directly with other RDBMS vendors like Oracle which are more popular on Linux.

The next version of SQL Server on Linux will include all the standard SQL Server management features that come with the Windows version. These include advanced features like always-encrypted, row-level security and columnstore indexes, but still a lot of features are not supported yet in this preview like SQL Server Agent, Replication, AlwaysOn, etc. You can get a full list of features which are supported in this Microsoft link: SQL Server on Linux Release Notes. You can also get all the known issues of this version of SQL Server.

SQL Server Installation on Redhat Linux 7.2

Before going ahead, you need to have a Linux box where you will install the next version of SQL Server. I downloaded a free version of Redhat Linux 7.2 from the Redhat website to install it on virtual machine on my lab server which is running Windows Server 2012 R2. I did not mentioned the steps of Linux server installation as it is not in scope of this article. Please let me know in the comment section if you need the step by step process for the Linux 7.2 installation. I will write it in my next tips or you can easily Google the Linux installation steps to move forward.

I followed the step by step method of the Microsoft online documentation for this installation. Now let's start the SQL Server installation on Linux.

Step 1: First we will check the version of Redhat Linux. I checked the host name and Linux version which are running on the host. Connect to the Linux box either using PUTTY or login to the Linux box using a valid username and password. Once you have connected to the box, type the below commands to display the hostname and version of Linux.

#To Get the host name of the machine.

hostname

#To get the version of installed Linux OS.

cat /etc/redhat-release

You can see the host name and the version of the installed OS in the below picture. The host name is "linux4mssql" and the version is showing as "Redhat Enterprise Linux Server release 7.2".

check hostname and version of linux

Step 2: Now we will use the superuser mode su for the next step. Superuser mode in Linux is similar to the system administrator account permission in Windows. Connect using the superuser mode by running the below command.

#Connect with superuser permission

sudo su

You can see that I have connected with the superuser account in the below screenshot.

connected with the superuser account

Step 3: Now we will run curl commands to download the installation packages from the Microsoft website to this Linux server. The downloaded file will be saved in location /etc/yum.repos.d/ as mentioned in the command line.

#Download installation configuration file.

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

We can see the progress, time and details of the downloaded configuration file in the below picture.

progress, time and details of the downloaded configuration file

Now we can check the location /etc/yum.repos.d/ to verify whether the above file has been saved in this location. As we are already in the etc folder, we need to go inside this folder to check the yum.repos.d folder. Go to the folder yum.repos.d folder and run ls -lrt to display all the files present in this folder.

#go to yum.repos.d folder.

cd yum.repos.d

#list all files/folders inside the yum.repos.d folder.

ls -lrt

You can see our target file mssql-server.repo is in this location in the below picture. You can exit the superuser mode here if you wish by typing exit followed by pressing enter.

check downloaded file

Step 4: Now our next step is to install SQL Server on this box. We will use the yum package to install it as we do for other applications on Linux. Run the below command to install SQL Server on this machine.

#Install SQL Server vNext

sudo yum install -y mssql-server

Once you press enter to execute the above command, the execution process will start first checking some dependencies followed by downloading the required packages. You can see the mssql-server-14.0.1.246-6.x86_64.rpm package is downloading with the status bar which is 11% at that moment. We can see the version of SQL Server vNext also which is 14.0.1.246.

install SQL Server

You can see the process bar increasing.

process bar is increasing to install SQL Server

Once the download process completes, the installation will start automatically. You can see the progress bar of the installation in the below screenshot which has been started after the package download.

Once the download process completes, the installation will start automatically

Once installation finishes, you will get the below screen with the name of installed product and its status as compete. You can see there is a to-do task showing in the dashed-rectangle box below saying "Please run /opt/mssql/bin/sqlservr-setup to complete the setup of Microsoft(R) SQL Server(R)". So our next step is to run this file to complete this installation.

Please run /opt/mssql/bin/sqlservr-setup to complete the setup of Microsoft(R) SQL Server(R)

Step 5: Before executing the suggested file to complete the installation, let's check the status of the SQL Server service installed on this machine. Run the below command to check the status of the mssql-server service.

#check the status of mssql-server service.

systemctl status mssql-server

We can see that mssql-server service is recognized by Linux, but it is not active and its status shows disabled. We will run this command again to check the mssql-server service status post installing the configuration files which is suggested in step 4.

check status of mssql-server service

Step 6: Now we will run the configuration script which was suggested in step 4 by the SQL Server setup. This allows us to configure our SQL Server like setting the sa password, license agreement and starting the service.

sudo /opt/mssql/bin/sqlservr-setup

Once you execute the above command, it will ask you to accept the license terms and conditions. Type YES on the below prompt to continue.

run configuration file sqlservr-setup

Once you type YES to accept the license terms and press enter to proceed, it will ask you to enter a strong password for the sa account. Enter the sa password and then re-enter the password again.

Enter the sa password and then re-enter the password again

Once the sa password is set, the configuration will ask you to start the SQL Server service by choosing Y to start. Type y and press enter to start the SQL Server service.

start the SQL Server service by choosing Y to start

Step 7: Now check the SQL Server service mssql-server status again as we did in step 5 to verify that SQL Server is up and running. Run the same command from step 5.

#check the status of mssql-server service.

systemctl status mssql-server

If we compare the below picture with the one in step 5, you can easily see the differences. The service status shows enabled and active (running) which I highlighted in green below.

SQL Server service status post running configuration file

The SQL Server installation on Linux is done. Go ahead and play with this instance. You will need the sqlcmd utility to connect to SQL Server from your Linux box, but you can also make a successful connection using SSMS from your Windows machine. Make sure to have a trust connection between both servers. I will explain how to install SQL Server tools like SQLCMD to access databases from Linux in my next tip.

Step 8: Now SQL Server is installed, but sometimes you may need to run the below commands to open the SQL Server port on the firewall on the Linux server.

#Open the SQL Server port on firewall.

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

sudo firewall-cmd --reload


open sql server port on firewall

Step 9: As we don't have any SQL Server tools installed on this Linux box to make a database connection, we will connect to this SQL Server instance using SQL Server Management Studio installed on Windows machine. First we need to the IP address of the Linux box through which we will connect to SQL Server database engine installed on Linux. Run the below command to get the IP address of the Linux machine.

 /sbin/ifconfig

The IP address of this machine is 192.168.209.128 as shown in the below screenshot.

The IP address of this machine is 192.168.209.128

Step 10: Now launch SSMS on your Windows machine and click on the Connect button to enter the connection details. Enter the details like instance name as the IP of the Linux box, choose SQL Server authentication and enter the sa login name followed by the password then press on the Connect button. You can see we made a successful database connection from this Windows machine using SSMS.

connect through ssms

We have connected using the sa account to this instance, since Windows authentication is not supported in this version of SQL Server on Linux. Right click on this instance in SSMS and select Properties to look at the server properties and check basic details of this SQL Server instance. We can see the name as linux4mssql along with other details.

Right click on this instance in SSMS and select Properties to look at the server properties and check basic details of this SQL Server instance
Next Steps
  • The next step is to install SQL Server tools on this Linux machine to enable us to make database connections from Linux boxes as well. I will explain the step by step process of this installation in my next tip.
  • Explore more knowledge on SQL Server Database Administration Tips.


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Manvendra Singh Manvendra Singh has over 5 years of experience with SQL Server and has focused on Database Mirroring, Replication, Log Shipping, etc.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips


Article Last Updated: 2017-01-16

Comments For This Article




Sunday, May 6, 2018 - 7:46:04 AM - Manvendra Back To Top (75874)

Hi Eric

Thanks for your response.

Follow below article to install Linux server in step  by step process:

https://techyaz.com/sql-server/sql-server-on-linux/step-step-process-install-red-hat-enterprise-linux/


Friday, May 4, 2018 - 9:25:17 AM - eric.simbozel Back To Top (75866)

 Hi,

could you please send me a link on how to install Linux step by step process for the linux 7.2


Tuesday, October 31, 2017 - 3:00:03 PM - patil Back To Top (69019)

 Thanks for the detailed step by step method.... How dow we Install the SQL services on linux  without ROOT or Super user permissions 

 


Tuesday, January 17, 2017 - 8:43:29 AM - Jimbo99 Back To Top (45369)

I was under the impression this port of SQL Server => Linux project was a partnership with Ubuntu ? Why install it on Red Hat as opposed to Ubuntu (LAMP) Server OS version ? Shouldn't there be a DEB installer out there being developed at the same time ? Ubuntu apps is based on a repository of maintained stable packages. That's how MySQL is maintained & installed. Why wouldn't Microsoft develop this port similarly in an unstable development repository that would be easily converted/migrated to a maintained stable repository model ? Sounds like Canonical needs to get SQL Server first.















get free sql tips
agree to terms