Learn Software Package Management in Red Hat Linux

0
1195
Learn-Software-Package-Management-in-Red-Hat-Linux-Administration-740X296

Learn-Software-Package-Management-in-Red-Hat-Linux-Administration-740X296
Whatever system you are working on: Hardware is the backbone of your system, and Software is considered as the soul of it. Without software, your system will be just a lifeless hardware machine. Software Management includes installing, updating, and removing software packages. This is one of your main tasks as a system administrator. In this article, we will tackle this important topic. So, bring your coffee, and give me your attention.

Software Management
I told you that part of your role as a system admin is to manage the software installation, upgrade, and removal. Red Hat Package Manager RPM is the format that Red Hat software installation files come in. The names of the installation package files end with .rpm.

Besides to Red Hat, many other Linux distributions are said to be RPM-based. The list of RPM-based Linux distros includes: Fedora, CentOS, Mandriva, and OpenSUSE.

The rpm Command
From its manual page:
The rpm command is a powerful package manager, which can be used to build, install, query, verify, update and erase “individual” software packages.

Note that I have quoted the word individual to clarify the fact that rpm mainly works on the package level, whereas other tools we are going to investigate can work on a group of packages.

Syntax
To install a package:

To upgrade a packages:

To remove a package:

To display all packages installed on the system:
rpm –qa

Examples

  • To install the time-1.7-38.el6.i686.rpm package file:

Blog1
Where –v prints details, and –h prints hashes to show the installation progress.

  • To remove the ntpdate package:

Blog2

  • To list all installed vim-related packages:

Blog3
Problems with rpm Command
Of course, noting goes without problems – even minor ones – in this life. Working with the rpm command tool is not that easy all the time. When you decide to install a package using the rpm tool, you need:

  • To obtain or download the package file.
  • To know all the dependencies of this package, obtain, install them.

This may sound easy when the package to install depends on one or two packages. But, what if it depends on twenty or thirty packages? Trying to download, and install the individual packages will be a real burden.

Consider the following case:
Blog4
The rdesktop package requires as a prerequisite four packages.
Now, consider this:
Blog5
Got the idea? Great!
So, what is the solution?
YUM has the answer.

The Yellowdog Updater Modified YUM
The YUM tool provides an efficient way to manage the installation, upgrade, and removal of both individual packages and package groups as well. It depends on what is called a software repository. A software repository is simply a directory where software packages are stored. The yum tool refers to one or more of such repositories to list the available packages, install a required package, update a package, or remove it.

The greatest feature of the yum tool is that it takes care of dependencies for you.

Configure YUM Repository
Before using the yum tool, we need to have one or more software repositories for yum to use. We have already configured a repo file that uses the repository located on the Red Hat installation media, earlier in this series. We will do the same job again with more details.
To use a repository we need it to be accessible either locally, via FTP, or HTTP. Our role is to configure a repo file that points at it.
The minimal needed configuration for a repo file are:

[REPONAME]

or

or

enabled=1
gpgcheck=0

Write these lines in a file, and save it as filename.repo under /etc/yum.repo.d directory.

Using the Red Hat Installation ISO Image File as Repository
Using the Installation DVD media as a repository is good option. However, this requires inserting the DVD, and mounting it every time a software package is to be installed or upgraded. If we could have our local copy of the installation source on our hard drive, it will be great alternative to having to physically insert DVD and mount it. This is what we are going to do now. Okay, let’s do it.

  1. Insert the installation DVD.
  2. In your terminal, type the following command:

This will copy an image of the installation media to a file called /opt/rhel67.iso
This process should take about 5 minutes.
Blog6

  1. Now, mount the resulting ISO image file. To do, use the following command:

The installation media should now be mounted under /mnt

  1. To make sure the ISO file will be mounted after the system reboots, we need to add the following line to the /etc/fstab file:

Blog7
Save and exit the file.

  1. Now, create a new repo file using the vim editor:

vim /etc/yum.repos.d/RHELiso.repo

  1. In the vim editor, type the following lines:

[ISOREPO]
baseurl=file:///mnt/Server
enabled=1
gpgcheck=0

  1. Save and exit the file.

Now, you have your own copy of the Red Hat installation media repository.
Let’s test it:

Do you remember what did we get when we try to install the same package rdesktop using the rpm command? We got a list of missing software packages needed as prerequisites to installing rdesktop.

But, with yum, the great tool has taken care of all this for you.

Now, let’s see the Syntax of the yum command.

That will be in the next article. See you.

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here