Partner with experts to accelerate your digital transformation journey
Bobcares

How to install MS SQL Server 2017 on Ubuntu 18.04

PDF Header PDF Footer

Wondering how to install MS SQL Server 2017 on Ubuntu 18.04? We can help you.

At Bobcares, we assist our customers with several installations as part of our Server Management Service.

Today, let us see how our Support Engineers install MS SQL Server 2017 on Ubuntu 18.04

 

How to install MS SQL Server 2017 on Ubuntu 18.04

In 2016, Microsoft’s relational database, MS SQL, was released under an open-source license.

Installing MS SQL on Ubuntu Server 18.04 is actually quite easy. Once you have it installed, the database server will function smoothly.

In order to begin the installation, our Support Engineers suggest having a working Ubuntu 18.04 Server instance and a user with

sudo
privileges.

We can run the MS SQL Server with a trial license, but beyond that, we will need to purchase a license to put the MS SQL Server into production usage.

How to install MS SQL Server 2017 on Ubuntu 18.04

Access the Ubuntu server using SSH

Moving ahead let us focus on the step-by-step process of accessing the Ubuntu Server using SSH.

  • Step 1: Update and upgrade the OS

To update, we run the following command:

$ sudo apt-get update

On the other hand, to upgrade, we run:

$ sudo apt-get upgrade

$ sudo apt install software-properties-common
  • Step 2: Import public repository GPG keys

We can import public repository GPS keys by running the following command:

$ sudo wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –
Expected Output: OK

However, if we get any error we try the following commands and retry the above command again:

$ sudo apt-get remove libcurl4
$ sudo apt-get install libcurl3
  • Step 3: Register the Microsoft SQL Server Ubuntu repository

In order to register the MS SQL SQL Server Ubuntu repository, we run:

$ sudo add-apt-repository “$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)”

Then we run:

$ sudo apt-get update
  • Step 4: Install SQL server
$ sudo apt-get install -y mssql-server

Wait at least five or six minutes for all packages to download and install.

After successful execution of the above command, SQL Server should finish installation on our machine.

  • Step 5: Set the SA password

After the package installation finishes, we run

mssql-conf
setup and follow the prompts to set the SA password and choose the edition.

For SQL Server 2017, Evaluation, Developer, and Express are freely licensed. We choose the version by entering a specified number in front of the version name and provide a strong password for SA (System Administrator) account.

$ sudo /opt/mssql/bin/mssql-conf setup
Choose an edition of SQL Server:

Evaluation (free, no production use rights, 180-day limit)
Developer (free, no production use rights)
Express (free)
Web (PAID)
Standard (PAID)
Enterprise (PAID)
Enterprise Core (PAID)
I bought a license through a retail sales channel and have a product key to enter.

Then type 2 then press Enter.

Do you accept the license terms? [Yes/No]: yes

Type SA password two times then.

  • Step 6: Verify if the service is running

Once the configuration is done, we need to verify that the server is running.

$ systemctl status mssql-server

In case we need to give the service a restart, we run:

$ systemctl restart mssql-server.service

Now the SQL Server has installed we can connect to this service remotely if we have SQL Server Management Studio on the Windows machine or install the command line tools from below.

 

Install the SQL Server command-line tools

  • Step 1: Install CURL

We need to install CURL if we do not have it already.

For the installation, we run:

$ sudo apt install curl
  • Step 2: Import the public repository GPG keys
$ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –
  • Step 3: Register the Microsoft Ubuntu repository.
$ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

Update the sources list and run the installation command with the unixODBC developer package.

$ sudo apt-get update
$ sudo apt-get install mssql-tools unixodbc-dev

If we want to update the

mssql-tools
, we run:

$ sudo apt-get update
$ sudo apt-get install mssql-tools

Now it is time to connect. But before that it is better to add /opt/mssql-tools/bin/ to the PATH environment variable

$ export PATH=”$PATH:/opt/mssql-tools/bin”

Connect locally:

$ sqlcmd -S localhost -U SA -P [YourPassword>]
sqlcmd
is executed with parameters for the SQL Server name (-S), the user name (-U), and the password (-P).

If we connect locally, the server name is localhost. The user name is SA and the password is the one we provided for the SA account during setup.

[Failed to connect remotely? We’d be happy to assist]

 

Conclusion

In short, installing MS SQL on Ubuntu Server 18.04 is actually quite easy. Once we follow the methods our Support Engineers suggest, the database server will function smoothly.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";
0 Comments

Submit a Comment

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

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF