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 if a certain package is not available from the official repositories or you need to install the most recent package version from a specific third-party repository.

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 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

As you may know already, lxd is available in the official repositories. However, I have installed it from the xenial-backports repository in this case.

Recommended Read: How To List Installed Packages From A Certain Repository In Linux

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, all it’s dependencies might be retrieved from other repositories too. So, don’t disable all other repositories and try to install a package from a specific repository. You can’t install all packages from only one repository.

And, that’s all for now folks. Hope this helps. I will be soon here with another useful guide soon. If you find our work here useful, please share them on your social, professional networks and support OSTechNix.


Thanks for stopping by!

Help us to help you:

Have a Good day!!

You may also like...