MSSQL Installation on Ubuntu Server
- September 1st, 2021
- Posted in Documentation
- Write comment
The installation itself is not too bad. It is pretty straightforward.
This process worked well on Ubuntu 18.x installing Microsoft SQL 2017 and 2019. The details in this post are for the 2017 version. The only thing that is different is the repository configuration, and in particular what you download configure the repository to support installing 2019.
Download and add the Microsoft public repository GPG key:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –
Add the Micorosft apt repository:
sudo add-apt-repository “$(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2017.list)”
Update repository mirror list:
sudo apt-get update
Install MSSQL 2017:
sudo apt-get install -y mssql-server
Run the MSSQL setup:
sudo /opt/mssql/bin/mssql-conf setup
The setup will ask just a couple questions. One is which version you want to run. I installed the Developer version. The second this is to accept the license agreement.
Check MSSQL status to verify it is running:
systemctl status mssql-server
Add the MSSQL tools repository:
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | tee /etc/apt/sources.list.d/msprod.list
Update repository mirror list:
sudo apt-get update
Install MSSQL 2017 tools:
sudo apt-get install mssql-tools unixodbc-dev
Add tools directory to account path:
echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bash_profile
Add tools directory to account path for non-interactive execution:
echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bashrc
source ~/.bashrc
Connect to MSSQL via command line:
sqlcmd -S localhost -U SA -P ‘
‘
No comments yet.