How To Install Packages From A Specific Repository In Linux
This brief tutorial explains how to install packages from a specific repository from command line in Unix-like operating systems. This can be useful when a certain package is not available from the official repositories or you just wanted to install the most recent version of a package from a specific third-party repository. It is not that difficult. Read on.
Install Packages From A Specific Repository In Linux
On YUM-based systems:
In RHEL, CentOS and other YUM-based systems, you can install packages from a specific repository, for example EPEL, as shown below.
$ sudo yum --enablerepo=epel install nagios
The above command will enable the EPEL repository and install nagios package.
If you don’t know the repository name or its ID, refer the following link.
On APT-based systems:
In Debian, Ubuntu and other APT-based systems, we use -t flag with apt-get package manager to install a package from a specific repository i.e specific release.
The following command installs the lxd package from xenial-backports repository.
$ sudo apt-get -t xenial-backports install lxd
Please note that lxd package is available in the official repositories. However, I have installed it from the xenial-backports repository for the demonstration purpose.
On SUSE/openSUSE systems:
In SUSE and openSUSE, we can install a package from specific repository by mentioning the repository name, alias with zypper package manager.
The following command will install Firefox web browser from Mozilla repository.
$ sudo zypper install mozilla:MozillaFirefox
Here, mozilla is the alias of the repository from which to install the package Firefox.
Please note that even though the packages are installed from a specific repository, the dependencies of the said packages might be retrieved from other repositories too. So, don’t disable other repositories and try to install a package from a specific repository. You can’t install all packages from only one repository.