Monday, 24 December 2018

Install SQL Server 2019 preview CTP on Ubuntu Server 18.04

Pre-requisites

  • Ubuntu Server 18.04
  • Internet Connection to update the Ubuntu and Microsoft Packages 
  • If you are going for an offline install , you can download the packages from the link https://packages.microsoft.com/
  • Admin/root access to the user
I am using an Ubuntu Server version 18.04 with latest update patches and my host name is mssql2

Install and Configure SQLServer 2019

To configure SQL Server on Ubuntu, run the following commands in a terminal/putty to install the mssql-server package.

1.    Import the public repository GPG keys:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –



1       2.   Register the Microsoft SQL Server Ubuntu repository:




           3.   Run the following commands to install SQL Server:
                Run the below command to update the packages in the server
                   sudo apt-get update
                   sudo apt-get install -y mssql-server


After the package installation finishes, run mssql-conf setup and follow the prompts to set the SA password and choose your edition





































To Check the MSSQL-Server Service Status

sudo systemctl status mssql-server
















Install the SQL Server command-line tools

To create a database, you need to connect with a tool that can run Transact-SQL statements on the SQL Server. The following steps install the SQL Server command-line tools: 
Use the following steps to install the mssql-tools on Ubuntu.

1    1.  Import the public repository GPG keys.

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
1   
     2. Register the Microsoft Ubuntu repository.

curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

1.     3. Update the sources list and run the installation command with the unixODBC developer package.
sudo apt-get update
sudo apt-get install mssql-tools unixodbc-dev



4.Set the .bash_profile on Linux envireonment 

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc

source ~/.bashrc







 To check the MSSQL Processes

  ps -ef | grep mssql








To connect Sqlserver from SQLCMD utility 

sqlcmd -S mssql2 -U SA -P "Password"






















To connect SQLServer  from SQLServer Management Studio from outside






Done!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!