Pages

Tuesday, July 17, 2012

Package Management


Previously Linux programs used to come in source code with all files, configuration stuff so that the user has to build them to work. Now days they are coming in the form of packages which ship ready for installation. In this article we will see the available package management tools in linux. Package management system is a collection of tools to automate the process of installing, upgrading, configuring, and removing software packages from a computer

Red Hat Package Manager (RPM)

RPM is a package management system used for packaging in the linux standard base. The rpm command options are grouped into three sub groups for ,

Querying and verifying packages
Installing, upgrading and removing packages
Performing miscellaneous functions

Normally rpm is the command available for performing the above operations and a rpm file will normally contain an extension of .rpm.

An RPM is delivered in a single file, normally in the format:

'name'-'version'-'release'.'architecture'.rpm

such as: libgnomeuimm-2.0-2.0.0-3.i386.rpm

Some rpm refer to package which do not depend on certain artchitecture.These includes graphics, text for another program to use.

The Rpm contents also include a package label , which contains the following information ,

  • the software name
  • the software version
  • the package release (the number of times the package has been rebuilt using the same version of the software)
  •  the architecture the package was built for (i386, i686) 
The package label does not necessarily need to match the name of the file.

Libraries are distributed in two separate packages for each version. One contains the precompiled code for use at run-time, while the second one contains the related development files such as headers, etc. Those packages have "-devel" appended to their name field. The system administrator should ensure that the versions of the binary and development packages match.

The Basic syntax for the rpm command would be,

Rpm

Where options include i (install), v (verbose), h (hash check), e (erase), u (Update), U (Upgrade)

Some Examples of rpm include,

 To install a RPM package
rpm -ivh httpd-1.0-2.i386.rpm
 To uninstall a RPM package
rpm -e httpd
To upgrade a RPM package
rpm -Uvh httpd-1.0-2.i386.rpm
To query a RPM package
rpm -q httpd
Verify an Installed Package
rpm --verify mysql
List Files in Installed Package
rpm -ql httpd
Find Out Which Package this file belongs
rpm -qf /etc/httpd/conf/httpd.conf
Find Out the Docs that came with the package
rpm -qd httpd
Learn about a package before installing
rpm -qip zsh-html-4.2.6-5.el5.i386.rpm
Learn What files a package contains
rpm -qa | grep httpd
Find all packages that match a specific pattern
rpm -qa | grep httpd
To verify whether a package is installed or not
rpm -V zsh-html-4.2.6-5.el5.i386.rpm
 To check a RPM signature package
rpm  --checksig httpd



YUM: Yellow Dog Update Modifier

There were some issues when we use rpm as a package management tool.Rpm cannot handle the dependencies. For this reason yum was released.YUM is said to be a high level wrapper for the rpm tool

A Local repository can be set up with all the packages. It can be seen here.

Some Examples of yum include,

 To install a package
Yum install httpd-1.0-2.i386.rpm
 To uninstall a package
Yum remove httpd
To update a package
Yum update httpd-1.0-2.i386.rpm
Display list of updates
Yum list updates
List all the installed packages
Yum list installed
Find information about package
Yum info httpd
Find for a specified package
Yum list installed | grep httpd
Search for a package name
Yum list httpd
Search for packages
Yum search httpd
Display list of available packages
Yum list all
Display list of grouped software
Yum grouplist
Install packages by group
Yum groupinstall pack (Install all packages that are under the group pack)
Remove all packages in a group
Yum groupremove pack
Find what packages provides a file
Yum whatprovides /etc/passwd
Find what packages need to be updated
Yum check-update


Yum also provides a interactive shell, called yum-shell which is invoked by ‘yum shell’. A Shell will be open which can allow multiple yum commands to be executed during a single executing of yum.

More To Come , Happy Learning J