| title | Install SQL Server Tools on Linux - SQL Server vNext | Microsoft Docs |
|---|---|
| description | This topic describes how to install the SQL Server Tools on Linux. |
| author | rothja |
| ms.author | jroth |
| manager | jhubbard |
| ms.date | 1/20/2017 |
| ms.topic | article |
| ms.prod | sql-linux |
| ms.technology | database-engine |
| ms.assetid | eff8e226-185f-46d4-a3e3-e18b7a439e63 |
The following steps install the command-line tools, Microsoft ODBC drivers, and their dependencies. The mssql-tools package contains:
- sqlcmd: Command-line query utility.
- bcp: Bulk import-export utility.
Install the tools for your platform:
-
Enter superuser mode.
sudo su
-
Download the Microsoft Red Hat repository configuration file.
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo -
Exit superuser mode.
exit -
Run the following commands to install 'mssql-tools' with the unixODBC developer package.
sudo yum update sudo yum install mssql-tools unixODBC-devel
Note
To update to the latest version of 'mssql-tools' run the following commands:
sudo yum check-update
sudo yum update mssql-toolsOptional Step: Create symlinks to 'SQLCMD' and 'BCP' under /usr/bin/.
sudo ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd
sudo ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp-
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 with the unixODBC developer package.
sudo apt-get update sudo apt-get install mssql-tools unixodbc-dev
Note
To update to the latest version of 'mssql-tools' run the following commands:
sudo apt-get update
sudo apt-get install mssql-tools Optional Step: Create symlinks to 'SQLCMD' and 'BCP' under /usr/bin/.
sudo ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd
sudo ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp-
Add the Microsoft SQL Server repository to Zypper.
sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/prod.repo sudo zypper --gpg-auto-import-keys refresh
-
Install 'mssql-tools' with the unixODBC developer package.
sudo zypper install mssql-tools unixODBC-devel
Note
To update to the latest version of 'mssql-tools' run the following commands:
sudo zypper refresh
sudo zypper update mssql-toolsOptional Step: Create symlinks to 'SQLCMD' and 'BCP' under /usr/bin/.
sudo ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd
sudo ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcpSqlcmd and bcp are not available on macOS.
Use sql-cli from macOS. For more information, see sql-cli.
After installation, connect to the SQL Server instance to create and manage databases. To get started, see Connect and query SQL Server on Linux.