Thursday, February 1, 2018

SQL Server 2017 Installation on Ubuntu 16


Once you have the Ubuntu machine ready we can proceed with the below installation steps.
  1. Import the public repository GPG keys:
    bash
    wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

  1. Register the Microsoft SQL Server Ubuntu repository:
    bash
    sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
    

  2. Run the following commands to install SQL Server:
    bash
    sudo apt-get update
    sudo apt-get install -y mssql-server
    

  1. After the package installation finishes, run mssql-conf setup and follow the prompts to set the SA password and choose your edition.
    bash
    sudo /opt/mssql/bin/mssql-conf setup
    

  2. Once the configuration is done, verify that the service is running:
    bash
    systemctl status mssql-server
    

  1. If you plan to connect remotely, you might also need to open the SQL Server TCP port (default 1433) on your firewall.
At this point, SQL Server is running on your Ubuntu machine and is ready to use!

You should be good to connect to the new engine through SSMS 17.4

You Can install the command-line tools using the below steps.

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: sqlcmd and bcp.
  1. Import the public repository GPG keys:
    bash
    wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
    
  2. Register the Microsoft Ubuntu repository:
    bash
    sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/prod.list)"
    
  3. Update the sources list and run the installation command with the unixODBC developer package:
    bash
    sudo apt-get update
    sudo apt-get install -y mssql-tools unixodbc-dev
    
  4. For convenience, add /opt/mssql-tools/bin/ to your PATH environment variable. This enables you to run the tools without specifying the full path. Run the following commands to modify the PATH for both login sessions and interactive/non-login sessions:
    bash
    echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
    echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
    source ~/.bashrc

No comments:

Post a Comment