Installing Software

Essential Reading for all New Members of the Fora.

Installing Software

Postby toracat » 2010/11/02 15:14:57

Now you have your shiny new CentOS operating system installed, one of the first things you may want to do is install some software on it. This document aims to bring together articles already on the CentOS Wiki relating to installing software on your system. It is recommended that new users take the time to read and understand this documentation.

The preferred way to install software on your CentOS system is to use the provided package management tools. CentOS uses the Red Hat Package Management (RPM) system and YUM as a front end to it. YUM is the preferred tool for installing software on your system. Online documentation for YUM is available here:

http://www.centos.org/docs/6/html/yum/ Links currently broken.
(Meanwhile see http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-yum.html)

YUM is a command line tool and, despite being extremely powerful, is very easy to use so users new to Linux need not be afraid of it. To use YUM to install software on your system you will need to be root. In it's basic form, YUM uses the following syntax:

Code: Select all
yum install <package>

So if we wanted to install Firefox, we would do:

Code: Select all
yum install firefox

Note that package names are case sensitive and trying to install the package "Firefox" would result in the message "Nothing to do". To find the correct spelling or capitalization, we can use the yum list command to list all matching packages:

Code: Select all
yum list *Firefox*
[i]<snip>[/i]
Installed Packages
firefox.i386                             3.6.9-2.el6.centos installed

and you can use YUM to automatically update your system to the latest versions by simply doing:

Code: Select all
yum update

Note that if you install software with YUM it will always install the latest version so you do not need to do an update after installing a new package.

Using YUM really is that easy.

There is a page with some rather nifty RPM and YUM tips & tricks here:

http://wiki.centos.org/TipsAndTricks/YumAndRPM

See also:

http://wiki.centos.org/PackageManagement/Yum

Groups

Another powerful feature of YUM is the concept of groups of software. This is software related to a task grouped together. For example, suppose you chose not to install support for printing or any office-based software when you installed CentOS. Having to find and install packages we need individually could be time consuming so we can simply choose to install the whole software group.

To see a list of groups, we can do:

Code: Select all
yum grouplist

(I won't list all the available groups - I'll leave that as an exercise for the reader to try)

and to install a software group, we would do:

Code: Select all
yum groupinstall 'Printing Support'

or

Code: Select all
yum groupinstall 'Office/Productivity'

and we can use groupinfo to return information about packages that make up a particular group:

Code: Select all
 yum groupinfo 'Printing Support'
[i]<snip>[/i]

Group: Printing Support
 Description: Install these tools to enable the system to print or act as a print server.
 Mandatory Packages:
   ghostscript
   cups
 Default Packages:
   enscript
   samba-client
   system-config-printer
   hal-cups-utils
   hplip
   a2ps
   paps
 Optional Packages:
   bluez-utils-cups


Repositories

All of the above works fine for installing software that is provided as part of the CentOS system, but what about if you want to install a software package that isn't provided by CentOS? This is where 3rd party repositories come in. A vast amount of software has been packaged and is maintained by the packagers and placed into 3rd party software repositories such that it can be installed using YUM. Please read the Wiki page on repositories here:

http://wiki.centos.org/AdditionalResources/Repositories

RPMForge and ATrpms are two of the larger 3rd party repositories that provide software packages for CentOS. However, before we can use any additional repositories, we must first configure them. There is a Wiki page on how to configure RPMForge here:

http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

However, we need to be careful when enabling 3rd party repositories so that they don't conflict with CentOS packages. For example, they may contain newer versions of software packages that may break your system. For this reason we strongly advise not to update packages provided by CentOS with versions from 3rd party repositories as this may break things. Remember - if you break your system, you get to keep the pieces.

To get around this problem we can use a plugin for YUM called 'priorities'. Priorities allows us to rank repositories from 1 to 99 such that packages installed from a repository with a lower number (higher ranking) will never be overwritten or upgraded by a package from a repository with a higher number (lower ranking). For example, if the CentOS base and updates repositories have a priority of 1 and RPMForge has a priority of 10, a package from RPMForge will never be able to replace a package from CentOS base or updates.

If you are going to enable 3rd party repositories then it is highly recommended that you also install and configure the priorities plugin to manage them.

http://wiki.centos.org/PackageManagement/Yum/Priorities


What if you can't find an RPM package for CentOS / RHEL

Are you absolutely sure you've looked everywhere? If you're absolutely sure that an RPM for the software package you want to install doesn't exist then you have a number of options:

1) If there is a Fedora RPM package, then attempting to rebuild the corresponding source RPM package on your CentOS system may be a way to create a working binary RPM package.

2) Consider building your own RPM package. If you package the software yourself then it makes it far easier to handle updates.

3) As an absolute last resort you could compile the package from source. In an rpm-based distribution like CentOS you should avoid compiling from source whenever possible because doing so may break your system and it is highly recommended that you do NOT follow this route. Please read this Wiki article for an explanation as to why:

http://wiki.centos.org/PackageManagement/SourceInstalls
User avatar
toracat
Forum Moderator
 
Posts: 6694
Joined: 2006/09/03 16:37:24
Location: California, US

Return to CentOS 6 - FAQ & Readme First

Who is online

Users browsing this forum: No registered users and 2 guests