09 September, 2013

Software Installation with RPM & YUM

Installation with RPM:

RPM stands for Red Hat Package Manager. Red Hat introduced RPM in 1995. RPM is now the package management system used for packaging in the Linux Standard Base (LSB). The rpm command options are grouped into three subgroups for:

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

RPM command is used for installing, uninstalling, upgrading, querying, listing, and checking RPM packages on your Linux system. With root privilege, you can use the rpm command with appropriate options to manage the RPM software packages.

Installing a RPM package Using rpm -ivh

RPM filename has packagename, version, release and architecture name.

For example, In the MySQL-client-3.23.57-1.i386.rpm file:

    MySQL-client – Package Name
    3.23.57 – Version
    1 – Release
    i386 – Architecture

When you install a RPM, it checks whether your system is suitable for the software the RPM package contains, figures out where to install the files located inside the rpm package, installs them on your system, and adds that piece of software into its database of installed RPM packages.

The following rpm command installs Mysql client package.

[root@linuxguide ]# rpm -ivh  MySQL-client-3.23.57-1.i386.rpm
    Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]

rpm command and options

    -i : install a package
    -v : verbose
    -h : print hash marks as the package archive is unpacked.

Query a Particular RPM Package using rpm -q

The above example lists all currently installed package. After installation of a package to check the installation, you can query a particular package and verify as shown below.

[root@linuxguide ]# rpm -q MySQL-client
MySQL-client-3.23.57-1

[root@linuxguide ]# rpm -q MySQL
package MySQL is not installed

Note: To query a package, you should specify the exact package name. If the package name is incorrect, then rpm command will report that the package is not installed.

Upgrading a RPM Package using rpm -Uvh

Upgrading a package is similar to installing one, but RPM automatically un-installs existing versions of the package before installing the new one. If an old version of the package is not found, the upgrade option will still install it.

[root@linuxguide ]# rpm -Uvh MySQL-client-3.23.57-1.i386.rpm
Preparing...             ########################################### [100%]
1:MySQL-client          ###########################################

Uninstalling a RPM Package using rpm -e

To remove an installed rpm package using -e as shown below. After uninstallation, you can query using rpm -qa and verify the uninstallation.

[root@linuxguide ]# rpm -ev MySQL-client

Information about Installed RPM Package using rpm -qi

rpm command provides a lot of information about an installed pacakge using rpm -qi

If you have an RPM file that you would like to install, but want to know more information about it before installing, you can do the following:

[root@linuxguide ]# rpm -qip MySQL-client-3.23.57-1.i386.rpm

Name        : MySQL-client                 Relocations: (not relocatable)
Version     : 3.23.57                           Vendor: MySQL AB
Release     : 1                                     Build Date: Mon 09 Jun 2003 11:08:28 PM CEST
Install Date: (not installed)                Build Host: build.mysql.com
Group       : Applications/Databases        Source RPM: MySQL-3.23.57-1.src.rpm
Size        : 5305109                          License: GPL / LGPL
Signature   : (none)
Packager    : Lenz Grimmer
URL         : http://www.mysql.com/
Summary     : MySQL - Client
Description : This package contains the standard MySQL clients.

    -i : view information about an rpm
    -p : specify a package name


Installation with YUM:

The yum command requires a repository as the source of the packages. If you are connected to the internet, you may choose to use the repository provided by your Linux distribution.
Installing, removing, and updating packages is a typical activity on Linux. Most of the Linux distributions provides some kind of package manager utility. For example, apt-get, dpkg, rpm, yum, etc.

yum is the default package manager on some Linux distributions.

Install a package using yum install

To install a package, do ‘yum install packagename’. This will also identify the dependencies automatically and install them.

The following example installs postgresql package.

[root@linuxguide ]# yum install postgresql.x86_64
Resolving Dependencies
Install       2 Package(s)
Is this ok [y/N]: y

Package(s) data still to download: 3.0 M
(1/2): postgresql-9.0.4-5.fc15.x86_64.rpm          | 2.8 MB     00:11
(2/2): postgresql-libs-9.0.4-5.fc15.x86_64.rpm    | 203 kB     00:00
------------------------------------------------------------------
Total                                        241 kB/s | 3.0 MB     00:12    

Running Transaction
Installing : postgresql-libs-9.0.4-5.fc15.x86_64             1/2
Installing : postgresql-9.0.4-5.fc15.x86_64                   2/2

Complete!

By default ‘yum install’, will prompt you to accept or decline before installing the packages. If you want yum to install automatically without prompting, use -y option as shown below.

[root@linuxguide ]# yum -y install postgresql.x86_64

Uninstall a package using yum remove

To remove a package (along with all its dependencies), use ‘yum remove package’ as shown below.

[root@linuxguide ]# yum remove  postgresql.x86_64
Resolving Dependencies
---> Package postgresql.x86_64 0:9.0.4-5.fc15 will be erased

Is this ok [y/N]: y

Running Transaction
  Erasing    : postgresql-9.0.4-5.fc15.x86_64       1/1

Removed:
  postgresql.x86_64 0:9.0.4-5.fc15

Complete!

Upgrade an existing package using yum update

If you have a older version of a package, use ‘yum update package’ to upgrade it to the latest current version. This will also identify and install all required dependencies.

[root@linuxguide ]# yum update postgresql.x86_64

Install a specific software group using yum groupinstall

To install specific software group, use groupinstall option as shown below. In the following example, ‘DNS Name Server’ group contains bind and bind-chroot.

[root@linuxguide ]# yum groupinstall 'DNS Name Server'

Dependencies Resolved
Install       2 Package(s)
Is this ok [y/N]: y

Package(s) data still to download: 3.6 M
(1/2): bind-9.8.0-9.P4.fc15.x86_64.rpm             | 3.6 MB     00:15
(2/2): bind-chroot-9.8.0-9.P4.fc15.x86_64.rpm   |  69 kB     00:00
-----------------------------------------------------------------
Total               235 kB/s | 3.6 MB     00:15

Installed:
  bind-chroot.x86_64 32:9.8.0-9.P4.fc15

Dependency Installed:
  bind.x86_64 32:9.8.0-9.P4.fc15

Complete!

Upgrade an existing software group using groupupdate

If you’ve already installed a software group using yum groupinstall, and would like to upgrade it to the latest version, use ‘yum groupupdate’ as shown below.

[root@linuxguide ]# yum groupupdate 'Graphical Internet'

Dependencies Resolved
Upgrade       5 Package(s)
Is this ok [y/N]: y  

Running Transaction
  Updating   : evolution-data-server-3.0.2-1.fc15.x86_64     1/10
  Updating   : evolution-3.0.2-3.fc15.x86_64                 2/10
  Updating   : evolution-NetworkManager-3.0.2-3.fc15.x86_64  3/10
  Updating   : evolution-help-3.0.2-3.fc15.noarch            4/10
  Updating   : empathy-3.0.2-3.fc15.x86_64                   5/10
  Cleanup    : evolution-NetworkManager-3.0.1-1.fc15.x86_64  6/10
  Cleanup    : evolution-help-3.0.1-1.fc15.noarch            7/10
  Cleanup    : evolution-3.0.1-1.fc15.x86_64                 8/10
  Cleanup    : empathy-3.0.1-3.fc15.x86_64                   9/10
  Cleanup    : evolution-data-server-3.0.1-1.fc15.x86_64     10/10

Complete!

Uninstall a software group using yum groupremove

To delete an existing software group use ‘yum groupremove’ as shown below.

[root@linuxguide ]# yum groupremove 'DNS Name Server'
Dependencies Resolved
Remove        2 Package(s)
Is this ok [y/N]: y

Running Transaction
  Erasing    : 32:bind-chroot-9.8.0-9.P4.fc15.x86_64  1/2
  Erasing    : 32:bind-9.8.0-9.P4.fc15.x86_64            2/2

Complete!

Install from a disabled repositories using yum --enablerepo

By default yum installs only from the enabled repositories. For some reason if you like to install a package from a disabled repositories, use --enablerepo option in the ‘yum install’ as shown below.

[root@linuxguide ]# yum --enablerepo=fedora-source install vim-X11.x86_64
Dependencies Resolved
Install       1 Package(s)
Is this ok [y/N]: y

Running Transaction
  Installing : 2:vim-X11-7.3.138-1.fc15.x86_64   1/1

Complete!

After that, you will be able to install softwares using rpm and yum.

No comments:

Post a Comment