How To Install MSSQL on Ubuntu 16.04
My environment setup
For this installation I used virtual box. It is best to use virtual box if you are first time user or testing this for the first time. I am assuming you already know how to setup virtual box. If not and need help, leave me an email.
There are few advantages of using virtual box. One you can take snapshots and restore back to snapshot in case you mess things up. I like to make a mess (that is how I learn). Second, you can start fresh if needed, while keeping your main machine clean, unless you have a test machine.
Thanks to Jeremy Morgan’s YouTube tutorial, it was helpful for me. Most of the steps are similar with added steps and changed URL to point to newer link. Here is the link to video for reference
Note: Use suggestions at your own risk. These are the steps I used that worked for me and put together after searching on google.
Open Terminal in Ubuntu and run following command
sudo apt-get update
If you do not have CURL installed, you will need it to be installed. Usually it is not present in fresh Ubuntu install. Run below command to install CURL
sudo apt-get install curl
Now we will import public libraries GPG Keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Register SQL repository (this is one line do not press enter while typing this command).
You can change the URL as needed. I am using mssql-server-2017. If you want to install preview only use alternate url
For MSSQL-Server-2017 use
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list | sudo tee /etc/apt/sources.list.d/mssql-server.list
For MSSQL-Server-2017-Preview use
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-preview.list | sudo tee /etc/apt/sources.list.d/mssql-server.list
You are almost done…… now we need to run updates and install mssql server. Run below commands in order
sudo apt-get update
sudo apt-get install -y mssql-server
If you had success in step 5 , we will now configure sqlserver. This is a quick setup to get it up and running and is crucial step. Run below command.
sudo /opt/mssql/bin/mssql-conf setup
You will be asked to select type of edition you want to use. Note that there are three free versions.
Evaluation (only for 180 days), Developer and Express (free). Select the version you want to try. I am using Developer version.
This is the last step. Once you have selected appropriate version you will be asked to accept terms and then select password. You can’t select a easy password, it will prompt you to select a strong password. So make sure to have a good password enough to pass the check.
Check if your MSSQL server is up and running…it may take sometime for service to kick in so give it at least 2 minutes. Run below command to confirm server is running.
systemctl status mssql-server
That’s IT YOU ARE DONE !
Originally published at https://sanchitwadhwa.com.