The Yum Server Yum is an automatic updater and package installer/remover for rpm systems. It automatically computes dependencies and figures out what things should occur to install packages. It makes it easier to maintain groups of machines without having to manually update each one using rpm. There are several features of yum over rpm. It is to be noted that yum is not a replacement tool for RPM. It simply makes the process of installation / update more easier. Multiple Repositories Simple config file Correct dependency calculation & Fast operation rpm-consistent behavior Simple interface Below is brief syntax of the command. yum [option] packagename Yum requires repository of RPM files at some place. Configuration file can be written for multiple repositories. Let us do this with simple example. Example : In our example, we will assume two parts. 1. Configuring Yum Server (Say Server IP is 192.168.100.254) 2. Configuring Yum Client (Say Client IP is 192.168.100.7) 192.168.100.254 We will keep all RPM Files in /var/ftp/pub 192.168.100.7 This is our client, where we will install softwares from yum server.
Configuring yum Server : Below are the step by step instructions. 1. Make sure that your server should have FTP Server running. If it is not there then install the same from RPM command. You can also use file or http server. [root@server1 ~]# rpm -q vsftpd vsftpd-2.0.5-10.el5 [root@server1 ~]# 2. Also check createrepo package. It is required for creating repository. You can install the same from RPM command. [root@server1 ~]# rpm -q createrepo createrepo-0.4.4-2.fc6 [root@server1 ~]# 3. In our example we are assuming the complete RHEL5 package will be available via yum server. To achieve this just copy all the DVD in /var/ftp/pub Folder. The sequence is given below. [root@server1 ~]# mount /dev/scd0 /mnt/dvd [root@server1 ~]# cd /var/ftp/pub [root@server1 ~]# cp -R /mnt/dvd. This will copy complete DVD in /var/ftp/pub Folder. 4. The RPM packages can be found in Server folder. Now let us create repository from a set of rpms as below. [root@server1 ~]# cd /var/ftp/pub/server [root@server1 ~]# createrepo -v /var/ftp/pub/server This command will long time based on speed of machine and number of rpms in folder. At the end it will be creating repodata folder in /var/ftp/pub/server which contains following files. filelists.xml.gz other.xml.gz primary.xml.gz repomd.xml 5. Now restart the VSFTPD Server as below. [root@server1 ~]# service vsftpd restart This completes our server part.
Configuring yum Client : Now let us come to client machine 192.168.100.7. Here we need to write one.repo file in /etc/yum.repos.d folder. Say name of the file as server1.repo vi /etc/yum.repos.d/server1.repo [Magnum] name=my Software Store baseurl=ftp://192.168.100.254/pub/server/ enabled=1 gpgcheck=0 Save the configuration file. The baseurl tells client machine from where to fetch the software repository. That s all! Now we are ready to use the yum command. Using yum : Using yum command you can do following. 1. Clean the old cache data : Before you start using yum command, it is best practice to clean the old caching data. This can be achieved by following command. 2. Listing the softwares : The following command lists all the softwares installed as well as available software on repository. [root@server1 ~]# yum list You can list any specific software as below. [root@server1 ~]# yum list httpd 3. Getting information of the software : You can get small information of the software whether it is installed or not installed.
4. Removing the installed package : You can use remove option as below. Say let us remove zsh software. The command is # yum remove zsh
5. Installing software : The option install is used as below to installed the software. [root@server1 ~]# yum install zsh 6. Updating software : To update installed software with new one. [root@server1 ~]# yum update zsh 7. Getting file list of software before or after installation : [root@server1 ~]# yum whatprovides httpd This is particularly useful when one want to locate the path of configuration files, binaries etc. For more complete information you can refer [root@server1 ~]# man yum