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
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
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. It would work on the new version, try it and comment if you have an update or a better solution.