Tuesday, February 28, 2012

RedHat Package Management

Red Hat Package Management

Description :

Every user of a linux system needs to install or remove software in his system. There are a few methods available by which one can install software into Red Hat Linux. One method is to user the source tarballs to install the packages into linux and the second method is to user per-compiled binaries into the system. These are usually called as RPM and in Debian it is call DPKG packages.
Red Hat package Management utility to install and remove packages from a Linux system.

Introduction:

Generally a package's name  will be in the following format.
packagename.version.release.architecture.rpm

Eg. firefox-4.0rc2.tar.bz2,firefox.9.0.0.1-0.1.mga1.x86_64.rpm

Redhat  Linux includes a tool name rpm to administer the software packages. Using rpm command you can:

  • Installing Packages
  • Upgrading Packages
  • Removing packages
  • Querying Packages
  • Removing Packages

Command Syntax: root@linux:~#rpm -I [option] package

Package is the complete name of the package to be installed. The options refine the installation process. The options are explained below.

-v                Turn on verbosity. Shows some useful information during the  
                   installation.
 -h               Print up to 50 hash marks (#) to illustrate the progress of the 
                   package installation.
 --force        Install the package even if it already is installed, install an older 
                   version or replace files already installed.
--nodeps     Do not perform dependency checks before installing or upgrading  
                   a package.
--test           Do not install the package or upgrade the database, just identify  
                   and display possible conflicts or dependency errors.

 In your installation CD-ROM RPMs are stored under REDHAT/RPMS directory. For installing software packages from the installation CD-ROM do the following steps.

Installing Packages:

  • Insert the CD-ROM in the drive mount the cdrom and select the package to install. Alternatively you can change your directory to the place where the RPMs have been downloaded.

#mount /dev/cdrom /mnt/cdrom or /media/cdrom
#cd /mnt/cdrom
#rpm -ivh firefox.9.0.0.1-0.1.mga1.x86_64.rpm

  • The next example shows the error generated by trying to install a package which is already installed. To work around we use the '--force' option.

#rpm -ivh firefox.9.0.0.1-0.1.mga1.x86_64.rpm
#rpm -ivh --force firefox.9.0.0.1-0.1.mga1.x86_64.rpm

Upgrading Packages:

The option for upgrading existing RPMs comes in 2 flavour , -U for gpgrade and -F for freshen. Upgrade will install the package even if an earlier version is not currently installed, but freshening package installs only if an earlier version is currently installed.


#rpm -Uvh firefox.9.0.0.1-0.1.mga1.x86_64.rpm

Note: You can use a program called 'alien' to convert between packages like rpm, dpkg, stampede sle and slackware tgz file formats.

The following table illustrates methods of using the RedHat Package Manager.

 
Question
RPM Command
How do I install a new package or upgrade it if it already exists?
#rpm -Uvh package.rpm


If I have a diretory containing updated packages, how do I insatll the only the ones that are currently in my system?
#rpm -Fvh *.rpm
How do I delete an insallted packase from my computer?
#rpm -e package
How do I see a list of all installed packages on my computer
#rpm -qa | less


I don't know what a certain installed package does. How can I get it to tell me about itself?
#rpm -qi package
How do I ask what files were installed by a package?
#rpm -ql package
There's a file in my system called /apth/to/file. How can i find out which package installed it?
#rpm -qf /path/to/file
How do I find out which package installed /apth/to/file and how do I get information on that package and see the other file that were installed by the package
#rpm -qifl /path/to/file
I delete a few files by accident but I don't know what are they. Can RPM chow me which files in its database are now missing?
#rpm -Va
'#rpm -Va' is taking a log time. How do I just verify that a certain package is OK?
#rpm -Vv package
I've downloaded an RPM package containing source code. How do I make a binary RPM out of it and then install it?
#rpm -ivh package.src.rpm
#cd /usr/src/redhat/SPECS/
#rpmbuild -ba package.spec
#cd /usr/src/redhat/RPMS/i386
#rpm -ivh package.rpm
How do I compress and rebuild my computer's RPM database?
#rpm -rebuilddb

















No comments: