Wednesday 31 October 2012

Installing RPM packages

Installing Extra Packages

When you are working with Operating system, you always need to install additional packages or softwares. The main advantage of Linux is that every software of this operating system is completely free. You can download the software from internet at no cost. Redhat operating system uses Redhat Package Manager (RPM) packages for installation. While installing the packages, you need to remember the architecture of your computer. Install only that package that support your system. For example, do not install 64 bit package on 32 bit architecture.

To install packages using command line :
# rpm -ivh package_name
This will replace the installed package with the new one. 

# rpm -Uvh package_name
This will remove the installed package.

# rpm -ev package_name

To see the list of packages installed.

# rpm -qa 

To see which file comes from which rpm.

# rpm -qf /etc/init.d/network

initscripts-9.03.17-1.el6.x86_64

To install packages without full filling the dependencies.

# rpm -ivh package.rpm --nodeps

To see what files are extracted by a given package.

# rpm -ql rpmname

However, If we are going to install package one by one, It very long process. As we deal with the dependencies of the packages. So we have another tool known as 'YUM'.

yum is the utility that helps to install the packages automatically. It automatically resolve the dependencies and install the selected packages.

Redhat provides some of the packages along with the distribution. These packages are inside any ISO distribution of redhat.

Copy those packages to any location as;
# cp -rv /media/Packages/ /var/www/html/Packages/

Then
# cd /var/www/html/Packages/

Install the package:

#rpm -ivh createrepo****.rpm

now run a command.

# createrepo -v /var/www/html/Packages/

Now edit a file;

# vim /etc/yum.repos.d/redhat.repo

enter the following text:

[Packages]
name=test
baseurl=file:///var/www/html/Packages/
gpgcheck=0

Now run the command:

# yum list all

If it shows the list of packages, means yum is configured on your machine.
After that use following command to install the packages:

# yum install package_name -y

# yum install php* -y

In this way you can install packages.

No comments:

Post a Comment