How to Install SQL Server 2017 on Ubuntu Server without Internet – Offline Installation

Starting with SQL Server 2017, we can run & deploy our applications on Linux based SQL Server Instances. I have already explained step by step method to install SQL Server on Redhat Linux without any internet connection in my last article. Here I will explain step by step process to install SQL Server on Ubuntu 16.04 server that is also running without an internet connection.

We can easily install SQL Server on Ubuntu server if we have internet access to the online repositories 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 Ubuntu 16.04 Server.

Before going ahead, we need Ubuntu Linux 16.04 server. If you don’t have Ubuntu server then you can create a virtual machine and install Ubuntu 16.04 Server with the help of attached articles in the link.

Offline Installation of SQL Server 2017 on Ubuntu Server

Installing SQL Server 2017 on Ubuntu Linux is straight forward method if your server has internet connection and able to access online repositories. But it becomes painful if your Ubuntu server has no access of internet. We generally call it offline installation. Microsoft suggests below steps for offline installation of SQL Server on Ubuntu Linux server.

  • Download the database engine package which you need to install.
  • Move this downloaded packages to your Ubuntu Machine.
  • Install the copied Debian package on the server.
  • Resolve Missing Dependencies, if you get any. This is most painful step in Offline Installation.
  • Complete the SQL Server Setup by running mssql-conf.

Now we will go step by step process with the screenshots that will help readers to understand this process.

Download & Move SQL Server Debian Package on the Server

Let’s start with downloading the debian package for SQL Server database engine. You can download the required debian packages from release notes or from Microsoft repositories. I downloaded database engine 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 debian packages that can be downloaded.

download sql server package

Next, we need to copy above downloaded package to our Ubuntu server that doesn’t have internet connection. You can use any tool, application or method to copy this file from local host to Ubuntu server. I used WinSCP tool to copy this file from machine where i have downloaded the packge to the Ubuntu 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 Ubuntu server. You can see i entered all details and credentials in below image to make connection. Once you save the details, login button will enable. Click on Login button to establish connection.

connect to winscp

It will again ask you to enter password, type the password and press enter to make connection to the Ubuntu Server.

connect to Winscp

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 Ubuntu server.

WinSCP

Now we just need to drag the downloaded debian package from left side pane and drop it to right side pane to copy it to Ubuntu server. You can see the copy process in below screen.

copy files to ubuntu server

You can see debian package is copied to location \home\techyaz\ in below image. So, we can connect to Ubuntu server and validate whether file is copied there or not.

WinSCP post copy the package

Connect to Ubuntu server. Check the package in location \home\techyaz\. We can see downloaded file is very much there on Ubuntu server. I have also validated whether SQL Server is installed on this machine previously by someone else or not by checking its service in below image. We can see SQL Server is not installed on this machine yet.

connect to Ubuntu


#Check the copied package.
ls -lrt

#Check SQL Server Service.
systemctl status mssql-service

Now our next step is to install this package.

#Install SQL Server debian package.
sudo dpkg -i mssql-server_versionnumber_amd64.deb

dpkg is a package manager for Debian-based systems. It can install, remove, and build packages. I ran installation command using dpkg 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 package, copy them to the Ubuntu server and install them if you don’t have internet connection on Ubuntu server.

SQL Server Install failed

Resolve Dependencies

I faced few dependency issues while installing above debian package. I ran below command to check all dependencies for this SQL Server debian package.

#Check Package Dependency for below package
dpkg -I mssql-server_versionnumber_amd64.deb

Check SQL package dependencies

You can see the list of dependencies showing into highlighted area which needs to be installed before installing SQL Server package. It’s very easy to install all such packages into one go by executing below command if your server is connected to Internet. This will download and install all required packages from online repository.

#Install all dependencies
sudo apt-get -f install libunwind8 libnuma1 libc6 adduser libjemalloc1 libc++1 gdb debconf libcurl3 hostname openssl openssl python libgssapi-krb5-2 libsss-nss-idmap0 gawk sed

Install Dependencies

It will ask you to enter Y to proceed with the installation for all given packages in the command. You can see all such packages have been installed using online repository.

Install Dependencies

But here, we are installing SQL Server on ubuntu server into offline mode that means we don’t have access to internet on the server. In that case, we need to manually download each and every package, move them to Ubuntu server the way we moved SQL Server package and then install all of them there. This is time consuming task because every package has some other dependencies. I downloaded and installed all these packages on Ubuntu Server to proceed. There are lot of packages i installed to fix dependencies. It was not possible for me to take all screenshots so i did not attach them here.

Offline Installation

Once all dependencies have been resolved, move ahead to install SQL Server on this server. Run below command to execute the installation.

#Install SQL Server on Ubuntu
sudo dpkg -i mssql-server_versionnumber_amd64.deb

We can see SQL Server has been successfully installed on this Ubuntu server. You can see this in below image. Setup also suggests us to run another command to complete this installation. We will execute this command in next step.

SQL Server Installation on Ubuntu

Now we will run below command to set the sa password and accept the license terms for SQL Server using mssql-conf utility. mssql-conf is a Microsoft SQL Server Configuration utility that are used to configure such parameters.

#Run SQL Server Configuration
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 access the license terms. Type YES and press enter.

mssql-conf

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 proceed to complete the configuration and will be ready to use.

mssql-conf

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 Ubuntu server if you are facing issue during remote connections.

#Enable port 1433 for remote connection
sudo ufw allow 1433

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.

SQL Server Service

Now your SQL Server is ready to use. You can connect to this instance using SSMS client tool. Next step is to install SQL Tools  (sqlcmd & bcp utilities) and SQL Server Agent on this server.  Read below articles if you want to install SQL Tools and SQL Server Agent on Ubuntu Server.

I have connected to SQL Server installed on Ubuntu server from SSMS client. We can see SQL Server Agent is grayed out that is because SQL Server Agent is not installed yet. Read above attached articles to install SQL Server Agent on this Ubuntu Server.

Connect to SQL Server using SSMS

Read more about SQL Server on RedHat Linux:

I hope you like this article. Comment us if you have any question. Please follow us on our facebook page and on Twitter handle to get latest updates.

Follow me:

Manvendra Deo Singh

I am working as a Technical Architect in one of the top IT consulting firm. I have expertise on all versions of SQL Server since SQL Server 2000. I have lead multiple SQL Server projects like consolidation, upgrades, migrations, HA & DR. I love to share my knowledge. You can contact me on my social accounts for any consulting work.
Manvendra Deo Singh
Follow me:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *