Skip to content

Instantly share code, notes, and snippets.

@ndamulelonemakh
Last active May 1, 2020 09:17
Show Gist options
  • Select an option

  • Save ndamulelonemakh/6e87bde146c4eab37855425540a37572 to your computer and use it in GitHub Desktop.

Select an option

Save ndamulelonemakh/6e87bde146c4eab37855425540a37572 to your computer and use it in GitHub Desktop.
#!bin/bash
# REFERENCE: https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-ver15
# 1. First add the Microsoft SQL Server repository
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)"
# 2. Then Install sql server using apt-install
sudo apt-get update
sudo apt-get install -y mssql-server
# 3. Setup the SA(System Administrator) account for your database server
sudo /opt/mssql/bin/mssql-conf setup
# 4. [Optional] Verify installation
systemctl status mssql-server --no-pager
# Make sure that port 1433 is enabled on the firewall, if not use
sudo ufw allow 1433
# This will allow any host to connect to your sql server instance
# You can alternatively restrict allowed hosts as follows
sudo ufw allow from <ip-address> proto tcp to any port 1433
## PART 2 [Optional] - Add command line tools
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update
sudo apt-get install mssql-tools unixodbc-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment