How to install Microsoft SQL Server on Linux Ubuntu Systems. Terminal commands to install SQL Server vNext CTP1 on Ubuntu 16.04 Systems.
Install SQL Server on Ubuntu
To install the mssql-server Package on Ubuntu, follow these steps:
Import the public repository GPG keys:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Register the Microsoft SQL Server Ubuntu repository:
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee /etc/apt/sources.list.d/mssql-server.list
Run the following commands to install SQL Server:
sudo apt-get update
sudo apt-get install -y mssql-server
After the package installation finishes, run the configuration script and follow the prompts.
sudo /opt/mssql/bin/sqlservr-setup
Once the configuration is done, verify that the service is running:
systemctl status mssql-server
Install tools on Ubuntu
Import the public repository GPG keys:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Register the Microsoft Ubuntu repository:
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
Update the sources list and run the installation command:
sudo apt-get update
sudo apt-get install mssql-tools
Connect to SQL Server on Linux
After installation, connect to the SQL Server instance to create and manage databases. Ubuntu users can connect and query SQL Server on Linux with sqlcmd. Sqlcmd is part of the SQL Server command-line tools.
Run sqlcmd with parameters for your SQL Server name (-S), the user name (-U), and the password (-P). The following command connects to the local SQL Server instance (localhost) on Linux.
sqlcmd -S localhost -U SA -P ''
To connect to a remote instance, specify the machine name or IP address for the -S parameter.
sqlcmd -S 192.555.5.555 -U SA -P ''
Where, SQL Server name (-S), the user name (-U), and the password is denoted by (-P).
For more info, visit:
https://www.microsoft.com/en-us/sql-server/sql-server-vnext-including-Linux
https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-ubuntu