We can easily install SQL Server 2017 on Ubuntu server if we have internet access to the online repositories but little painful if we don’t have internet access to the server. You can read attached article to learn how to install SQL Server on Ubuntu server where there is no internet connection. Here i will explain how to perform online installation of SQL Server on Ubuntu 16.04 Server that are connected to internet.
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.
Install SQL Server on Ubuntu Server
Below are the steps you should follow to install SQL Server 2017 on your Ubuntu 16.04 machine that are connected to internet.
1- First step is to connect to Ubuntu Server locally or using PuTTY.
2- Once you are connected to Ubuntu server, run below command to download the public repository GPG keys:
#Download GPG Keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –
3- We can see curl package is not installed on this machine so first we should install curl here. Run below command to install CURL package.
#Install CURL Package.
Sudo apt install curl
Once curl will be installed, run curl command that are given in step 2 again to download the GPG keys.
4- Register the Microsoft Ubuntu Repository by running any of the below commands. First command is older one and for RC (Release Candidate) version. If you want to install SQL Server 2017 general availability version then run second command.
#Register Microsoft Ubuntu Repository for RC version
sudo add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
#Run this command if you are downloading GA (General Availability) Repository.
sudo curl https://packages.microsoft.com/keys/microsoft.asc \| sudo apt-key add - && sudo add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
We can see add-apt-repository command is not found so we will first install the required package for this command on this server.
#Install add-apt-repository package
Sudo apt-get install software-properties-common
Type y to proceed in above image. Once installed, again run command given in this step initially. Run the one given for general availability.
5- Update the repository by running below command. A series of executions will start during update process.
#Update All Packages
Sudo apt-get update
6- Install SQL Server by running below command.
#Install SQL Server 2017
Sudo apt-get install -y mssql-server
7- Install above suggested package mssql-conf to configure SQL Server 2017. This package will ask you to accept license terms and choose SQL Server edition as shown in below image.
#Run below utility to configure SQL Server sudo /opt/mssql/bin/mssql-conf setup
8- Now check the SQL Server service by running below command. We can see service is running now.
#Check SQL Server service systemctl status mssql-server
9- Now, you can connect to this instance using SSMS client from your local host or from the server where you have installed SSMS. Make sure that there should be connectivity between both servers. SQL Agent is disabled because it is not installed yet. Read this article to install SQL Server Agent on Ubuntu Server to get it enabled for Agent jobs and other agent related features.
10- If you face any issue during connectivity, you can check SQL Server port no 1433. If it is not open, run below command to enable port no 1433 and then establish the connection.
#Open port 1433
sudo ufw allow 1433
I hope you like this article. Please follow us on our facebook page and on Twitter handle to get latest updates.
- How to Fix SQL Error 1005: A Comprehensive Guide - April 9, 2023
- How to Fix SQL Server Error 207 – Invalid Column Name - April 9, 2023
- How to Fix SQL Error 1045: Resolving Access Denied Issues - April 8, 2023
Leave a Comment