Install RPM File On CentOS / RedHat

by lifeLinux on May 8, 2011

rpm is a powerful Package Manager, which can be used to build, install, query, verify, update, and erase individual software packages. A package consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package. Packages come in two varieties: binary packages, used to encapsulate software to be installed, and source packages, containing the source code and recipe necessary to produce binary packages.

Install RPM File

To install an rpm file, open a terminal and then type the following command:

[root@server2 ~]# rpm -ivh file.rpm

Note:
-i: Installs a new package
-v: Print verbose information – normally routine progress messages will be displayed.
-h: Print 50 hash marks as the package archive is unpacked. Use with -v|–verbose for a nicer display.

Upgrade RPM File

[root@server2 ~]# rpm -Uvh file.rpm

Note:
-U: Upgrades or installs the package currently installed to a newer version. This is the same as install, except all other version(s) of the package are removed after the new package is installed.

Erase RPM File

[root@server2 ~]# rpm -ev ile.rpm

Note:
-e: Erase command
The following options may also be used:

--nodeps

Don’t check dependencies before uninstalling the packages.

List of all install packages

Type the following command:

[root@server2 ~]# rpm -qa 

Sample outputs:

...
libxslt-devel-1.1.17-2.el5_2.2
perl-libwww-perl-5.805-1.1.1
libc-client-devel-2004g-2.2.1
libidn-devel-0.6.5-1.1
libjpeg-devel-6b-37
gmp-devel-4.1.4-10.el5
libmcrypt-devel-2.5.8-4.el5.centos
libtidy-0.99.0-12.20070228.el5.centos
libtool-ltdl-1.5.22-7.el5_4
gpg-pubkey-1aa78495-3eb24301
openssl-0.9.8e-12.el5_5.7
NetworkManager-glib-0.7.0-10.el5_5.2
perl-XML-NamespaceSupport-1.09-1.2.1
perl-XML-Filter-BufferText-1.01-1.2.el5.rf
perl-XML-Simple-2.14-4.fc6
rsnapshot-1.3.1-1.el5.rf

List the files and state the installed version of the package called package. Example

[root@server2 ~]# rpm -ql mysql-5.0.77-4.el5_5.5

Sample outputs:

/etc/ld.so.conf.d/mysql-i386.conf
/etc/my.cnf
/usr/bin/msql2mysql
/usr/bin/my_print_defaults
/usr/bin/mysql
/usr/bin/mysql_config
/usr/bin/mysql_find_rows
/usr/bin/mysql_tableinfo
/usr/bin/mysql_waitpid
/usr/bin/mysqlaccess
/usr/bin/mysqladmin
/usr/bin/mysqlbinlog
/usr/bin/mysqlcheck
/usr/bin/mysqldump
/usr/bin/mysqlimport
/usr/bin/mysqlshow
/usr/lib/mysql

Read the man page

[root@server2 ~]# man rpm

Related Posts:

Previous post:

Next post: