The YUM Server
The RPM
Package Manager is used for distribution, installation, upgrading and removal
of software on Red Hat Systems. Originally designed to be used in Red Hat
Linux, the RPM is used by many GNU/Linux distributions. [1] The RPM system consists of
a local database, the rpm executable, the rpm package files.
The
local RPM database is maintained in /var/lib/rpm.
The database stores information about installed packages such as file
attributes and package prerequisites. Software to be installed using rpm is distributed through rpm package files, which
are essentially compressed archives of files and associated dependency
information.
Dependency Problems
When
installing software via rpm, one of the problems
that users face is dependency errors. The primary drawback of RPM is that it
not able to resolve
dependencies i.e. additional RPMs that have to be preinstalled before a certain
RPM can be installed. In worst cases, the pre-required rpm itself requires
another rpm to be preinstalled, and it would be up to the user to locate and
install each of them.
Solving Dependency Problems with YUM
To solve
the problems of dependency resolution and package locations, volunteer
programmers at Duke University have developed Yellow do Update, Modified, or
YUM for short. The system is based on repositories that hold RPMs and a
repodata filelist. The yum application can call upon several repositories for
dependency resolution, fetch the RPMs and install the needed packages. The
following example illustrates the YUM installation procedure-
[root@prime ~]# yum
install zsh
Dependencies
Resolved
=================================================================
Package
Arch Version Repository Size
=================================================================
Installing:
zsh
i386 4.2.6-1 rhel-debuginfo 1.7 M
Transaction
Summary
=================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download
size: 1.7 M
Downloading
Packages:
Running
Transaction Test
Finished
Transaction Test
Transaction Test
Succeeded
Running
Transaction
Installing:
zsh
######################### [1/1]
Installed:
zsh.i386 0:4.2.6-1
Complete!
Configuring YUM
Installing
RPMs
- createrepo (to create the repository)
- vasftpd (FTP would be used to transfer the necessary files from the Server to the client)
The IP address of my Server is 192.168.10.1 with hostname prime.example.org. The
first thing that YUM requires is to prepare a repository from which it can
access all the RPMs and call any of them as per necessary. To do this, the only
required RPM is createrepo.rpm. The
RPM can be found in the RHEL installation DVD in the Server
directory.
We would configure the YUM server in such manner
that any client Red Hat machine can use the repository of prime.example.org to
install RPMs. To do this, the client machine would use the FTP service. So, the
ftp service must be installed and run if it is not already installed. These
RPMs can easily be installed with the command-
[root@prime ~]# rpm
-ivh createrepo-*.rpm
[root@prime ~]# rpm
-ivh vsftpd-*.rpm
[root@prime ~]#
service vsftpd restart
[root@prime ~]#
chkconfig vsftpd on
Creating the
Repository
Creating
a repository can be done in the following procedure-
1.
Copying
the entire Server
directory to the hard drive. In this case, we copy the directory to FTP home
directory /var/ftp/pub/Server
cp
-r /mnt/Server /var/ftp/pub/Server
2.
Creating the repodata directory that contains
information about all the RPMs stored in the directory.
createrepo -v /var/ftp/pub/Server
Preparing
the Configuration File
The YUM configuration file can be found in /etc/yum.repos.d/filename.repo.
Even if the file name can be any, the file has to be named as filename.repo. We use the default /etc/yum.repos.d/rhel-debuginfo.repo as a reference. The lines in italic
are added/modified by the user.
#cp /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/MyYumServer.repo
#/etc/yum.repos.d/MyYumServer.repo
#repository name
[MyYumServer]
#the name can be any name
name=prime YUM server
#the location of the
repository
#access protocol may be
ftp://, http:// or file://
baseurl=ftp://192.168.10.1/pub/Server
#enabling or disabling the
repository
enabled=1
#enabling or disabling gpg
checking for digital signature
gpgcheck=0
#gpg key database
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
YUM Commands
The
following list contains frequently used commands associated with YUM.
1.
yum list
- If configured correctly, this command returns the list of all
available RPMs in the repository.
2.
yum
install rpm-name - This if the RPM exists in the repository, this
command installs the required RPM and resolves any dependencies automatically
if dependency RPMs also exist.
3.
yum
clean all - This command clears the YUM cache. Particularly
useful if installation of an RPM is cancelled or illegally aborted.
3. yum remove rpm-name - This command will remove the package but will keep any configuration file. Usually the configuration file is renamed as filename.rpmsave
3. yum erase rpm-name - This command will remove the package including any configuration file.
Client End
Configuration
To use
the YUM server setup in prime.example.org, any Red Hat client in the
network needs to modify the file /etc/yum.repos.d/rhel-debuginfo.repo configuration
file as below. The lines in italic are added/modified by the
user.
#cp /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/myyum.repo
#host: client.example.org
#/etc/yum.repos.d/rhel-debuginfo.repo
#repository name
[myyum]
#the name can be any name
name= prime YUM repository
#the location of the
repository
#access protocol may be ftp://,
http:// or file://
baseurl=ftp://192.168.10.1/pub/Server
#enabling or disabling the
repository
enabled=1
#enabling or disabling gpg
checking for digital signature
gpgcheck=0
#gpg key database
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Comments
Post a Comment