YUM stands for "Yellow dog Updater, Modified" because it is based on YUP, the Yellow Dog Updater (Yellow Dog is an RPM-based version of Linux for the Power Architecture hardware).
Some of the advantages of YUM include
• Automatic resolution of software dependencies.
• Command-line and graphical versions. YUM can install or upgrade software by using either the command-line version (yum command) or one of two graphical programs:
• Pirut: For adding and removing software.
• Pup: Package updater that only shows software updates available from RHN.
• Multiple software locations at one time. YUM can be configured to look for software packages in more than one location at a time.
• Ability to specify particular software versions or architectures.
YUM downloads software from repositories located over the network, either on the local network or over the Internet. The files, including the RPM package files, in these repositories are organized in a specific way so that they can be found by the YUM client.
How to create a local YUM repository
The yum can download a lot of information in the form of RPM headers and files, which may consume large amount of available bandwidth. If you have more servers on a local network, you can create a local yum repository and the updates can be distributed from the local repository. This can save a large amount of available bandwidth.
The createrepo-0.4.4-2.fc6.noarch.rpm package should be installed to continue here. To check whether the createrepo-0.4.4-2.fc6.noarch.rpm package is installed on your server, use the command
root@RHEL01 Server]# rpm –qa | grep createrepo
If the createrepo package is not installed, install it with the following command.
[root@RHEL01 Server]# rpm -Uvh http://localhost/server/createrepo-0.4.4-2.fc6.noarch.rpm
Confirm the installation by again running the above command.
[root@RHEL01 Server]# rpm –qa | grep createrepo
Copy the rpm files to the folder, which is the repository and run the createrepo command there to create the repository. The repodata folder will be created the the command is executed successfully.
[root@RHEL01 server]# createrepo /var/www/html/server/
Change the /etc/yum.conf file in clients to contact the yum server using http, as shown below.
Sample YUM Configuration file (/etc/yum.conf)
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
######First yum repo at 192.168.1.101######
YUM Configuration file in detail (/etc/yum.conf)
• [main] - The first line in YUM configuration file, "/etc/yum.conf" shows that it's the main configuration file.
• cachedir=/var/cache/yum - The cachedir directive in YUM configuration file, "/etc/yum.conf" specifies the directory where yum downloads are stored:
• keepcache=0 - The keepcache setting in YUM configuration file, "/etc/yum.conf", allows you to save the downloaded RPMs in “/var/ cache/yum” subdirectory.
• debuglevel=2 - The debuglevel directive in YUM configuration file, "/etc/yum.conf" specifies the level of messages specified in the file associated with the logfile directive.
• logfile=/var/log/yum.log - The logfile directive in YUM configuration file, "/etc/yum.conf" specifies the yum log file.
• pkgpolicy=newest - The pkgpolicy directive in YUM configuration file, "/etc/yum.conf" specifies that yum uses the latest package version.
•distroverpkg=redhat-release - The distroverpkg directive in YUM configuration file, "/etc/yum.conf" shown takes the version number from the /etc/redhat-release file:
• tolerant=1 - The tolerant directive in YUM configuration file, "/etc/yum.conf" allows yum to work even with minor errors.
• exactarch=1 - The exactarch directive makes sure that yum downloads correspond to your CPU architecture:
• obsoletes=1 - The obsoletes directive in YUM configuration file, "/etc/yum.conf" checks for and uninstalls any obsolete packages.
• gpgcheck=1 - The gpgcheck directive in YUM configuration file, "/etc/yum.conf" enables a gpc check.
• plugins=1 - The plugins directive in YUM configuration file, "/etc/yum.conf" includes plug-ins as defined in the /etc/yum/pluginconf.d/ and /usr/lib/yum-plugins/ directories as part of the yum configuration:
• metadata_expire=1800 - The metadata_expire directive in YUM configuration file, "/etc/yum.conf" defines the lifetime for headers. This means, if you haven’t used the yum command in 30 minutes (1800 seconds), the next use of the yum command downloads the latest header information.
• The /etc/yum.repos.d directory shown in the in YUM configuration file, "/etc/yum.conf" is the default location for third-party repository configuration files.
• The baseurl=http://192.168.1.101/server in YUM configuration file, "/etc/yum.conf" shows the yum repository location.
Basic yum usage
On client side, to Search a package, use the following syntax “yum search <package_name>”
[root@RHEL03 Server]# yum search httpd
On client side, to import the GPG key, use the following syntax “rpm -–import <url>”
root@RHEL03 Server]# rpm --import http://192.168.1.101/server/RPM-GPG-KEY-redhat-release
On client side, to install a package, use the following syntax “yum install <package_name>”. YUM will find out if there is any dependency, and install that dependency before the installation. The following command can be used to install the httpd (Apache Web Server) package.
[root@RHEL03 Server]# yum install httpd
To remove an installed package, use the following syntax “yum remove <package_name>”.
[root@RHEL03 Server]# yum remove httpd
• How to compress, uncompress and view files using Linux commands gzip, gunzip and zcat
• How to compress uncompress view files using Linux commands bzip2 bunzip2 and bzcat
• How to use Linux tar (tape archive) command to create archives
• Introduction to RedHat Package Manager (RPM)