Applications (installing and using)

Package Management for CentOS

Yum is the most widespread package manager for Red Hat derived distributions, including CentOS. Yum does dependency management, and handles security updates.

Working with yum


# upgrade currently installed packages to the most stable version
yum upgrade
 
# find what package provides some functionality you're after
yum search somekeyword
 
# install a new package
yum install nameofthepackage

# remove a currently installed package
yum remove nameofthepackage

Yum repositories

Yum stores repository information in /etc/yum.conf, and the files in /etc/yum.repos.d/ (files there must end with a .repo extension to be effective). A commonly used repository of extra packages for CentOS is EPEL. This can be added to yum (if it isn't already enabled) with the command yum install epel-release

Security and Stability updates

The yum upgrade command will upgrade packages on the system. If you don't change your yum repos, you can run this without risking upgrading to incompatible versions (e.g. that need different configuration files.)

You should update your system regularly, e.g. weekly, to ensure you are not vulnerable to known OS exploits. For further information on how to do that, see Keeping your server up to date.

Low-level package management - RPM

RPM is RedHat's Package Manager.  A huge amount of software is distributed in RPM format. Normally you would use yum to install software, but if you have a RPM package (ends in .rpm), you can install it with the rpm command. First make sure the RPM package is suitable for your version of CentOS (e.g. will work with CentOS 7, if that is what is on your server.) This information should be available at the location you donwnloaded the RPM from.

Working with rpm


# Install an RPM
# An http URL (e.g. "http://aserver.com/anrmpfile.rpm") will work just as well as a file name.
# FTP works also.
rpm -Uvfh anrpmfile.rpm

# To find out what files are in an RPM (and what scripts are run when you you install it
# e.g. what users are set up
# -q is query, -p means from a rpm file
rpm -qp --list --scripts --configfiles anrpmfile.rpm
rpm -qp --filesbypkg anrpmfile.rpm

#To find out what is installed on your server
rpm -qa # | grep thepackagenameyoureinterestedin

#To find out which RPM installed a particular file on your server, run: 
rpm -q --whatprovides /lib/ld-2.3.2.so