Skip to content

Instantly share code, notes, and snippets.

@ddeveloperr
Created October 14, 2019 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddeveloperr/d8783e4da9679dfbed283c85a789846b to your computer and use it in GitHub Desktop.
Save ddeveloperr/d8783e4da9679dfbed283c85a789846b to your computer and use it in GitHub Desktop.
How to install MS SQL on Ubuntu Server 18.04

#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment