Jump to content

How to Install MS SQL on Ubuntu Server 18.04


The AchieVer

Recommended Posts

How to Install MS SQL on Ubuntu Server 18.04

 

Wouldn't you love to have a MS SQL database server combined with the power, reliability, and security of Linux? Now you can.

 
 
 
20190102mssqljack.jpg

Back in 2016, Microsoft's relational database, MS SQL, was released under an open source license. If you're an MS SQL admin and would like to have that power, combined with the stability and security of Linux, you're in luck. Installing MS SQL on Ubuntu Server 18.04 is actually quite easy. Once you have it installed, the database server will function exactly as you've grown accustomed to.

 

So, let's install MS SQL on Ubuntu Server 18.04.

What you need

The only things you need are a working Ubuntu 18.04 Server instance and a user with sudo privileges. You can run the MS SQL Server with a trial license (or use the Developer or Express editions), but beyond that, you will need to purchase a license to put the MS SQL Server into production usage.

 

Update/upgrade

 

Before we install MS SQL, the Ubuntu Server should be updated and upgraded. Know that, should the kernel be upgraded, a reboot will be required. Because of this, you should run the update/upgrade process at a time when a server reboot is possible.

To run the update/upgrade, open a terminal and issue the commands:

sudo apt-get update
sudo apt-get upgrade -y

Once the above commands complete, reboot the server (if necessary), and you're ready to install.

Installation

The first thing to do is import the necessary repository key. From the terminal window, issue the following command:

sudo wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

Next, add the repository with the command:

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

Update apt with the command:

sudo apt-get update

And, finally, install MS SQL with the command:

sudo apt-get install mssql-server -y

Configure MS SQL server

Once the installation completes, you then need to run a setup script and answer the required questions. The script is run with the following command:

sudo /opt/mssql/bin/mssql-conf setup

After answering all of the questions (which includes creating an admin password), you will then need to restart the MS SQL server with the command:

systemctl restart mssql-server.service

Installing the command line tools

You now have a working MS SQL Server. However, in order to work with it you must install the necessary command line tools. To do this, issue the following commands:

sudo apt-get install curl -y
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update 
sudo apt-get install mssql-tools unixodbc-dev
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc

Where PASSWORD is the password you set up during the MS SQL installation.

That's it. You're ready to begin working with your MS SQL Server on Ubuntu 18.04.

 

 

Source

Link to comment
Share on other sites


  • Views 763
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...