Skip to content

Latest commit

 

History

History
79 lines (57 loc) · 2.42 KB

odbc-ubuntu.md

File metadata and controls

79 lines (57 loc) · 2.42 KB
author ms.author ms.date ms.service ms.topic ms.custom
rwestMSFT
randolphwest
01/21/2025
sql
include
linux-related-content

Use the following steps to install the mssql-tools18 on Ubuntu.

Note

  • Ubuntu 18.04 is supported starting with [!INCLUDE sssql19-md] CU 3.
  • Ubuntu 20.04 is supported starting with [!INCLUDE sssql19-md] CU 10.
  1. Import the public repository GPG keys.

    curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
  2. Register the Microsoft Ubuntu repository.

    • For Ubuntu 22.04, use the following command:

      curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
    • For Ubuntu 20.04, use the following command:

      curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
    • For Ubuntu 18.04, use the following command:

      curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
    • For Ubuntu 16.04, use the following command:

      curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
  3. Update the sources list and run the installation command with the unixODBC developer package.

    sudo apt-get update
    sudo apt-get install mssql-tools18 unixodbc-dev

    To update to the latest version of mssql-tools, run the following commands:

    sudo apt-get update
    sudo apt-get install mssql-tools18
  4. Optional: Add /opt/mssql-tools18/bin/ to your PATH environment variable in a bash shell.

    To make sqlcmd and bcp accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile file with the following command:

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

    To make sqlcmd and bcp accessible from the bash shell for interactive/non-login sessions, modify the PATH in the ~/.bashrc file with the following command:

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