Over the past few years, Microsoft has developed many software products for Linux operating systems. These software are distributed via standard software repositories created by Microsoft development team. So that you can easily install applications, update and upgrade them using the your Linux distribution's default package manager. In this brief guide, we will see how to add Microsoft's Linux software repository in a Linux system.
Currently, Microsoft dev team has built APT
repository for DEB-based systems and YUM
repository for RPM-based systems. The Microsoft's software repository for Linux comprised of multiple sub-repositories, for instance prod and mssql-server.
The prod repository, short for production repository, contains the packages that can be used in production. Meaning - the packages in this repository are well tested, stable and suitable for using in the production environments.
As the names says, the mssql-server repository contains packages for Microsoft SQL server for Linux.
Important note:
Please be mindful that if you are going to install and use the packages in the Microsoft's Linux software repository, you must comply with Microsoft's terms and conditions. If you don't agree to the license terms, you should not use the application.
Add Microsoft's Linux Software Repository
When you install a Microsoft product on your Linux machine, it will automatically add the respective software repository in the system. Alternatively, you can add the common Microsoft Linux software repository as described below in order to install, update and upgrade all supported applications for Linux.
1. Add Linux software repository for Microsoft products in RHEL, CentOS, Fedora
If you are using Redhat-based systems, you can add the Microsoft's repository for Linux like below.
Add the Microsoft's GPG public key:
$ curl -sSL https://packages.microsoft.com/keys/microsoft.asc > ./microsoft.asc
$ sudo rpm --import ./microsoft.asc
Next add the repository depending upon the distribution's version you use:
For example, if you are using RHEL 6 / CentOS 6, use the following command:
$ sudo rpm -Uvh https://packages.microsoft.com/config/rhel/6/packages-microsoft-prod.rpm
On RHEL 7 / CentOS 7:
$ sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
On RHEL 8 / CentOS 8:
$ sudo rpm -Uvh https://packages.microsoft.com/config/rhel/8/packages-microsoft-prod.rpm
2. Add Microsoft's Linux software repository in SUSE, openSUSE
Add Microsoft's GPG public key:
$ curl -sSL https://packages.microsoft.com/keys/microsoft.asc > ./microsoft.asc
$ sudo rpm --import ./microsoft.asc
Next add the software repository on SUSE Linux Enterprise Server 12:
$ sudo rpm -Uvh https://packages.microsoft.com/config/sles/12/packages-microsoft-prod.rpm
On SUSE Linux Enterprise Server 15:
$ sudo rpm -Uvh https://packages.microsoft.com/config/sles/15/packages-microsoft-prod.rpm
3. Add Microsoft's Linux software repository in Ubuntu
Ever since Canonical has partnered with Microsoft, Ubuntu is receiving more support from Microsoft dev team than other Linux distributions.
If you are using Ubuntu 16.04 LTS, run the following commands one by one to add the Microsoft's GPG public key and the software repository:
$ curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ sudo apt-add-repository https://packages.microsoft.com/ubuntu/16.04/prod
$ sudo apt-get update
On Ubuntu 18.04 LTS:
$ curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ sudo apt-add-repository https://packages.microsoft.com/ubuntu/18.04/prod
$ sudo apt-get update
On Ubuntu 20.04 LTS:
$ curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod
$ sudo apt update
Verify repositories
You can verify if the repositories have been successfully added using any one of the following commands.
To list the installed repositories in Deb-based systems, run:
$ sudo apt-cache policy
List the installed repositories on RPM-based systems such as RHEL , CentOS, using the following command:
$ sudo dnf repolist
$ sudo yum repolist
Or,
$ sudo dnf repolist all
$ sudo yum repolist all
On SUSE/openSUSE:
$ zypper lr
Or,
$ zypper repos
For more details, refer the following guide:
Conclusion
You know now how to add Microsoft's software repository for Linux on DEB-based systems and RPM-based systems. Also you learned how to check whether the repositories are added or not.
Once you added the Microsoft's software repository for Linux, you will be notified about software updates, bug fixes and new features whenever they are available. You can then update them using your default package manager on your Linux system.
Reference:
4 comments
Mysql? On a MS server??
Are you sure???
My bad. I meant to write mssql, not mysql. Thanks for pointing it out. Updated the guide.
I went to the ftp site. There are more distro’s. As in a DEBIAN and others. Your article is a bit incomplete.
Could you please provide the ftp link? My google search doesn’t return any results.