Linux Installation
September 8, 2020 ยท View on GitHub
Stable installations of mssql-cli on Linux are hosted in the Microsoft Linux Software Repository. mssql-cli supports the following Linux distributions:
Debian-based
Ubuntu
Ubuntu 16.04 (Xenial)
# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# Register the Microsoft Ubuntu repository
sudo apt-add-repository https://packages.microsoft.com/ubuntu/16.04/prod
# Update the list of products
sudo apt-get update
# Install mssql-cli
sudo apt-get install mssql-cli
# Install missing dependencies
sudo apt-get install -f
Ubuntu 18.04 (Bionic)
# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# Register the Microsoft Ubuntu repository
sudo apt-add-repository https://packages.microsoft.com/ubuntu/18.04/prod
# Update the list of products
sudo apt-get update
# Install mssql-cli
sudo apt-get install mssql-cli
# Install missing dependencies
sudo apt-get install -f
Debian
apt-transport-httpsis required for importing keys. If not installed, callsudo apt-get install curl apt-transport-https.
Debian 8
# Import the public repository GPG keys
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# Register the Microsoft Product feed
echo "deb [arch=amd64] https://packages.microsoft.com/debian/8/prod jessie main" | sudo tee /etc/apt/sources.list.d/mssql-cli.list
# Update the list of products
sudo apt-get update
# Install mssql-cli
sudo apt-get install mssql-cli
# Install missing dependencies
sudo apt-get install -f
Debian 9
# Import the public repository GPG keys
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# Register the Microsoft Product feed
echo "deb [arch=amd64] https://packages.microsoft.com/debian/9/prod stretch main" | sudo tee /etc/apt/sources.list.d/mssql-cli.list
# Update the list of products
sudo apt-get update
# Install mssql-cli
sudo apt-get install mssql-cli
# Install missing dependencies
sudo apt-get install -f
Upgrade on Ubuntu/Debian
After registering the Microsoft repository once as superuser,
from then on, you just need to use sudo apt-get upgrade mssql-cli to update it.
Uninstall on Ubuntu/Debian
To uninstall mssql-cli, call sudo apt-get remove mssql-cli.
RPM-based
CentOS
CentOS 7
This package also works on Oracle Linux 7.
# Import the public repository GPG keys
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
# Register the Microsoft product feed
curl https://packages.microsoft.com/config/centos/7/prod.repo > /etc/yum.repos.d/msprod.repo
# Install dependencies and mssql-cli
sudo yum install libunwind
sudo yum install mssql-cli
CentOS 8
# Import the public repository GPG keys
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
# Register the Microsoft product feed
curl https://packages.microsoft.com/config/centos/8/prod.repo > /etc/yum.repos.d/msprod.repo
# Install dependencies and mssql-cli
sudo yum install libunwind
sudo yum install mssql-cli
Red Hat Enterprise Linux
RHEL 7
# Import the public repository GPG keys
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
# Register the Microsoft product feed
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
# Install dependencies and mssql-cli
sudo yum install libunwind
sudo yum install mssql-cli
Upgrade on CentOS/RHEL
After registering the Microsoft repository once as superuser,
from then on, you just need to use sudo yum update mssql-cli to update it.
Uninstall on CentOS/RHEL
To uninstall mssql-cli, call sudo yum remove mssql-cli.