≡ Menu

rpm command

How do I install an RPM package into a different directory?

Q. How do I install an RPM package into a different directory like /home/chroot under RHEL / Fedora / CentOS Linux server?
[click to continue…]

List or Check Installed Linux Kernels

Q. How do I list all installed kernel on Linux operating system? How do I find out current kernel version?

A. You can use standard package listing command to list installed kernels.

RedHat / CentOS / RHEL / Fedora Linux user

You need to use standard rpm command to list installed software. Type the following command at shell prompt:
$ rpm -qa kernel


To list / display current kernel

Type the following command:
$ uname -r
$ uname -mrs


Linux 2.6.18-8.1.14.el5 x86_64

Debian / Ubuntu Linux user

Use dpkg command to list all installed kernel, enter:
$ dpkg --list | grep linux-image

ii  linux-image-2.6.20-15-generic        2.6.20-15.27                           Linux kernel image for version 2.6.20 on x86/
ii  linux-image-2.6.20-16-generic        2.6.20-16.32                           Linux kernel image for version 2.6.20 on x86/
ii  linux-image-generic                                 Generic Linux kernel image

Suse Linux install vmware tools

Q. I’m using OpenSuse as Guest OS (VPS). Installing SUSE Linux as a VMware Workstation guest operating system was easy task. But how do I setup and install SUSE Linux as a VMware Guest? How do I install vmware tools to improve performance?

A. In order to install Vmware tools, you need to build kernel modules. Building kernel modules is easy provided that following packages are installed on the guest OpenSuse / Suse Linux (VPS):

=> kernel-source

=> binutils

=> make

=> gcc

=> gcc-c++

Install required software

Login to guest oses using SSH or Vmware server console. Use yast command (yast control center) to install required software:
# yast
Select Software > Software management > Add above packages > Accept and install the softwares
The Software Management tool in YaST text mode
(YaST text mode software installation)

If you are using a GUI, you should see screen as follows (YaST2 screen):

Start VMWARE Tools installation

You need to start VMware tools installation from Vmware server console or Vmware Workstation VM menu.
Click on VM Menu > Select Install Vmware Tools... > Click on Install
Start VMWARE Tools installation

Mount the VMware Tools virtual CD

If you are using guest system’s desktop, you should have mounted a CD. If you are using text mode, run mount command as follows:
# mount /dev/hdc /media

mount: block device /dev/hdc is write-protected, mounting read-only

Replace /dev/hdc with actual virtual cd rom drive.

Install the VMware Tools RPM

Finally install rpm file,
cd /media
rpm -ivh VMwareTools-1.0.3-44356.i386.rpm

Configure Vmware tools

Next you need to run the VMware Tools configuration script. You must run script from VMWare server console / Workstation and not from SSH session:
# vmware-config-tools.pl
# vmware-config-tools.pl -default

Linux: Display rpm package architecture

Q. I’m using CentOS on 64 bit Linux. How do I find out rpm package architecture before installation such as i386 or x86_64 bit?

A. Almost each rpm package has i386 or x86_64 added to file extension. However some time you may see filename such as file-version.rpm. You can list all installed rpm packages with rpm -qa command but it will not display architecture. You can run following command to display rpm package architecture:
rpm -qa --qf "%{n}-%{arch}\n"


Another option is to use following command to display detailed information about package:
rpm -qi {package-name}
If you wish to display package version along with architecture, enter:
rpm -qa --qf "%{n}-%{v}-%{r}.%{arch}\n" | less
Run rpm command to print a list of all of the tags it knows about when it is invoked with the --querytags argument.
rpm --querytags | less

Linux rpm List Installed Packages

How do I list all installed packages using rpm command on CentOS/Suse/Fedora/RHEL/Scientific and Red Hat Enterprise Linux?
[click to continue…]

Q. I’m running Redhat Enterprise Linux 4.5 server along with Postfix and Cyrus mail server. However I’m getting following error in my log files:

Jun 10 18:00:04 server postfix/smtpd[7280]: sql_select option missing
Jun 10 18:00:04 server postfix/smtpd[7280]: auxpropfunc error no mechanism available

How do I fix this error? I’m not using mysql for postfix.

A. The cyrus software comes with various plugin. The cyrus-sasl-sql package contains the Cyrus SASL plugin which supports using a RDBMS for storing shared secrets.

If you are not using MySQL, just remove the plugin using rpm command:

# rpm -ev cyrus-sasl-sql

Note if you are using Debian or Ubuntu remove libsasl2-modules-sql package:
# apt-get remove libsasl2-modules-sql

Also on RHEL 3 / 4, make sure that file /etc/openldap/slapd.conf is owned by the user ldap:
# chown ldap.ldap /etc/openldap/slapd.conf

Other option is to configure the sql module. Now there should not be any sort of error in /var/log/messages or /var/log/maillog file.

Install PHP 5 in Red Hat Enterprise Linux 5

Q. I saw your earlier article about how to install PHP 5 under Red Hat Enterprise Linux version 4. But I’m using Red Hat enterprise Linux 5 and I don’t want to mess up with old version instructions. Is there a way that I can install PHP5 under RHEL 5 without using source rpm?

A. Redhat Enterprise 5 supports PHP version 5 out of box. You can install PHP 5 using any one of the following method:

Method #1: Download and install php 5 from RHN

Type the following command to install php 5:
# yum install php
You may also want to install Apache and other php 5 extensions:
# yum install httpd php-gd php-mysql

Method #2: CD/DVD

Mount CD/DVD rom and use rpm command to install PHP5:
# rpm -ivh php*

Method #3: Use GUI package manager

Type the following command to start GUI package manager:
# system-config-package
Now Select PHP (under Web Servers) and install the same.

Download and Install C, C++ Compiler on Red Hat Enterprise Linux 5 (RHEL)

I have Red hat enterprise Linux 5 installed on one of the production server. However, I noticed that there is no c/c++ compiler installed on the RHEL 5/RHEL 6 based system. I need to compile few applications on this box. How do I install C or C++ compiler on Red Hat Enterprise Linux 5/6? Where can I get / download compiler package?
[click to continue…]

List installed packages on Linux or FreeBSD / OpenBSD system

Q. How do I list all installed packages on Linux or FreeBSD system?

A. Most Linux distributions are based upon rpm or apt-get / dpkg packaging system.

RedHat, Fedora Core, Suse Linux, Cento os all are RPM based distribution

Use rpm command as follows to list all installed packages
rpm -qa
rpm -qa | grep 'package-name'
rpm -qa | grep -i '*httpd*'

Debian or Ubuntu Linux distribution

You can use dpkg command to list all installed packages:
dpkg --list
dpkg --list | grep 'package-name'
dpkg --list | grep -i '*php*'

Task: OpenBSD list installed package

Use pkg_info command for displaying information on all installed software packages
$ pkg_info
$ pkg_info | grep 'package-name'


bash-3.1.10_1       The GNU Project's Bourne Again SHell
expat-2.0.0_1       XML 1.0 parser written in C
gettext-0.14.5_2    GNU gettext package
lftp-3.4.0_3        Shell-like command line ftp client
libiconv-1.9.2_2    A character set conversion library
libstatgrab-0.12_1  Provides a useful interface to system statistics
nmap-4.01           Port scanning utility for large networks
pcre-6.6_1          Perl Compatible Regular Expressions library
pkgconfig-0.20      A utility to retrieve information about installed libraries
vim-lite-6.4.6_1    Vi "workalike", with many additional features (Lite package

Task: FreeBSD list installed package

Use pkg_info command as described above.

What Files Are In a RPM Package?

How do I find out what files are in RPM package called gnupg using command line option? How do I list the contents of a package using rpm or yum command on CentOS/RHEL/Fedora/Red Hat/OpenSuse/Novell Suse Linux?
[click to continue…]