In this article, we show you how to install software packages in CentOS 7 and how to find out in which repository the software can be found.
Follow the steps in this article from command-line as root user, or with sudo.
Installing a package
In CentOS, you install packages with the command:
yum -y install packagename
Yum is a meta package handler with which you can manage packages, for example, or create repositories.
By adding -y, you automatically give permission when you are asked for permission to install the relevant package.
Finding out in which package software is included
Do you want to use a command, but does CentOS say that the command cannot be found? Then you can find out if you can install it by checking if it is part of a package that is included in a repository which you use in CentOS. You do this with the command:
yum whatprovides */commandonaam
If you want to use netstat, for example, you use the command:
yum whatprovides */netstat
For example, the output looks like this:
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.nluug.nl * extras: centos.mirror.transip.nl * updates: centos.mirror.transip.nl ctdb-tests-4.8.3-4.el7.x86_64 : CTDB clustered database test suite Repo : base Matched from: Filename : /usr/share/ctdb/tests/eventscripts/stubs/netstat net-tools-2.0-0.24.20131004git.el7.x86_64 : Basic networking tools Repo : base Matched from: Filename : /bin/netstat
The last one is the package you need. Therefore, to use the netstat command, you install net-tools in this case:
yum -y install net-tools
Finding out in which repository software is included
It may happen that the software you want to install is not included in a repo that you are currently using. In that case, the relevant software cannot be installed. This applies, for example, to a default installation of CentOS when you try to install Fail2Ban, which is part of the EPEL repository.
You can exclude whether this is the case by seeing if the software is part of a package included in your current repositories. You use one of the commands for this:
Insert your awesome code here!
If you get the message 'No matches found', or you do not see any results with the line Filename: /bin/softwarename, then this means that the required package does not exist, or is part of another repository.
In Linux, the idea is that, for security reasons, you can only search and install software in your own sphere of influence, but not outside of it. So, you have access to repositories that you have installed, but you cannot perform a search in uninstalled repositories. The only option to find out in which repository a package is included if you have not yet installed the repository is to look it up via a search engine such as Google / DuckDuckGo, or, for example, on Gitlab.
Updating installed software
You can easily update all installed software in CentOS 7 with the command:
yum -y update
Do you want to update a specific package? Then use the command:
yum -y update packagename
This concludes this tutorial on installing software in CentOS. Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach them via the ‘Contact Us’ button at the bottom of this page.