Before we install MS SQL, we need to be updated and upgrade Ubuntu Server.
Run the command to update/upgrade, open a terminal.
sudo apt-get update sudo apt-get upgrade -y
Installation
The first thing to do is to import the necessary repository key. From the terminal window,
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
Now install MS SQL with the command:
sudo apt-get install mssql-server -y
Configure MS SQL server
sudo /opt/mssql/bin/mssql-conf setup
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.