How to Install SQL Server 2017 on RedHat Linux without Internet – Offline Installation
We all know Microsoft has announced to launch SQL Server product for Linux platform. SQL Server used to run only on Windows platform till SQL Server 2016 version. Now starting from SQL Server 2017, we can run & deploy our applications on Linux based SQL Server Instances as well. Here I will explain step by step process to install SQL Server on RedHat Linux 7.3 server which are running without an internet connection.
We can easily install SQL Server on RHEL if we have internet and access to the online repositories on the RHEL server but what if we don’t have internet access to the server. Here i will explain how to perform offline installation of SQL Server on RHEL.
Before going ahead, we need a RedHat Linux server. If you have no idea about installing Linux server or creating a virtual machine where you can install Linux and SQL Server then i would recommend you to read below articles.
Offline Installation of SQL Server 2017 on RHEL
Installing SQL Server 2017 on Redhat Linux is straight forward method if your server has internet connection and able to access online repositories. But it becomes little painful if your RHEL server has no access of internet. We generally call it offline installation. Microsoft suggests below steps for offline installation of SQL Server on Red Hat Linux server.
- Download the database engine package which you need to install.
- Move this downloaded packages to your Red Hat Linux Machine.
- Install the copied rpm packages on the server.
- Resolve Missing Dependencies, if you get any.
- Complete the SQL Server Setup by running mssql-conf.
Now we will go step by step process with the screenshots that will be helpful for readers to understand this process.
Step by Step Installation
Let’s start with downloading the rpm package for SQL Server database engine. You can download the required rpm packages from the release note or from Microsoft Repositories. I downloaded database engine rpm package from SQL Server 2017 release notes. You can download this package on a machine or PC which is connected to the internet. Below is the image of downloaded packages.
Next, we need to copy above downloaded package to our RedHat Linux server which doesn’t have internet connection. You can use any tool, application or method to copy this file from local host to Linux server. I used WinSCP tool to copy this file from machine where i have downloaded the packge to the Linux server. Make sure that there should be connectivity between both machine.
If you have not installed WinSCP, download it and install on your PC. Launch WinSCP tool and make a connection to Red Hat Linux server. You can see i entered all details and credentials in below image to establish connection with Linux server. Once you save the details, login button will be enabled. Click on Login button to establish connection. You can copy downloaded file from downloads folder to my document folder for this copy process.
There are two panes in WinSCp window. The files shows in left side pane is your local system and right side pane is your target Linux server. Now we just need to drag the downloaded rpm packages from left side pane and drop it to right side pane to copy it to Linux server and it will be done. You can see the copy process in below screen.
You can see rpm packages is copied to location \home\techyaz\Documents\ in WinSCP window. So we can connect to Linux server and validate it whether file is copied there or not. Connect to Linux server.
Check the package in location \home\techyaz\Documents\. We can see downloaded file is very much there on Linux server. Now our next step is to install this package.
#Check Present Working Directory pwd #Change diretory to Documents cd Documents #Check the files in Document directory dir
Before installing SQL Server, we can check whether SQL Server is installed by someone else on this machine or not. Run below command to check it.
systemctl status mssql-server
We can see SQL Server is not installed on this machine yet. Let’s go ahead with the installation now.
sudo yum localinstall mssql-server-14.0.900.75-1.x84-64.rpm
I ran installation command which is showing in below image. A series of execution will start followed by checking the dependencies. If you will face any dependency issue, you should first resolve all missing dependencies then proceed with the installation. Best way to fix missing dependencies is to download the required packages, copy them to the Linux server and install them.
I did not face any dependency issue and you can see my dependencies are showing as resolved. We will use the yum package to install it as we do for other applications on Linux. I used yum localinstall because we are installing SQL Server offline with the help of local package which we just copied from local host.
Setup will process and show you details of the package which will be installing. You can see the details in below image. Setup is again asking us to enter y to proceed with the installation. i have entered y to proceed.
Once you enter y to proceed, installation will process. This will take few minutes to install the package. Now you can see SQL Server database engine is installed on this Red hat Linux server without any internet connection having on the server.
Installation is not completed yet because setup suggests us to run mssql-conf utility to complete the installation. So next step is to run this process.
sudo /opt/mssql/bin/mssql-conf setup
This execution will ask us to accept the License terms, select the SQL Server edition and also tell us to set the sa password. Let us do that to complete this installation. Once you execute above command, it will ask us to enter YES to accept the license terms. Type YES and press enter.
Once you press enter post accepting license terms, setup will give you options to choose SQL Server edition. Select correct edition as per your requirement. You can see only first three editions are free and rest of all are paid. I selected option 2 to proceed.
Once you choose SQL Server edition, it will ask you to set sa login password. Make sure to enter complex password for sa and do not share it to anybody. The moment you set the sa password, SQL Server configuration will be completed and ready to use.
Now SQL Server is installed, but sometimes you may face issue connecting to your SQL Server instance. You need to run below commands to open the SQL Server port on the firewall on the Linux server.
sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent sudo firewall-cmd --reload
Now, you can check the SQL Server service to validate this installation. Run the same command which we have run to check the SQL Server service before starting the installation.
Now your SQL Server is ready to use. You can connect to this instance using SSMS client tool. If you want to connect to SQL Server on this server only. You need to connect using sqlcmd utility that needs to be installed on this server separately. Read this article to learn how to install SQL Tools (sqlcmd and bcp) on Red Hat Linux server. If your server is connected to internet, you can read this article to install SQL Tools on RHEL. Stay tuned to this website to get new articles on SQL Server on Linux.
Read below articles if you want to learn:
- How to Create a Virtual Machine.
- How to Install RedHat Linux 7.3 on a virtual machine.
- How to Install SQL Tools on Red Hat Linux.
- How to Install SQL Server Agent on Red Hat Linux.
- SQL Server Update Statistics Best Practices - April 15, 2020
- Understanding Hybrid Buffer Pool in SQL Server - December 30, 2018
- Fix:VIEW SERVER STATE permission was denied on object ‘server’, database ‘master’ - August 30, 2018