Learn YUM configuration in Linux. Understand what is yum, features of yum, what is repository and how to configure it.
YUM is Yellow dog Updated Modified. It is developed to maintain RPM based system. RPM is Redhat Package Manager. YUM is a package manager with below features –
- Simple install, un-install, upgrade operations
- Automatic resolves software dependency
- Looks for more than one source for software
- Supports CLI and GUI
- Automatically detects architecture of system and search for best fit software version
- Works well with remote (network connectivity) and local (without network connectivity) repositories.
All these features made it best package manager. In this article we will walk through Yum configuration steps. You can also browse through below yum related posts :
- Yum automatic updates
- Download package using yum
- How to check if package is installed
- Package naming conventions
- YUM cheat sheet
YUM configuration basics
Yum configuration has repositories defined. Repositories are the places where package files
.rpm are located and yum searches, downloads files from repositories for installations. Repositories can be local mount point
file://path, remote ftp location
ftp://link, http location link
http://login:password@link, https link or remote NFS mount point.
Yum configuration file is
/etc/yum.conf and repository configuration files are located under
/etc/yum.repos.d/ directory. All repository configuration files must have
.repo extension so than yum can identify them and read their configurations.
Typical repo configuration file entry looks like below :
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
[rhrl-source-beta]is unique repository id.
nameis human readable repository name
baseurlis location from where packages should be scanned and fetched
enableddenotes if this repo is enabled or not i.e. yum should use it or not
gpgcheckenable/disable GPG signature check
gpgkeyis location of GPG key
Out of these first 4 entries are mandatory for every repo location. Lets see how to create repo from DVD ISO file.
Remember one repo configuration file can have more than one locations listed.
You can even configure internet proxy for yum in this configuration file.
YUM repo configuration for DVD ISO
RPM based Linux installation DVD has RPM files in it which are used to install packages at time of OS installation. We can use these package and build our repo so that yum can use those packages!
First you have to mount ISO file on system. Lets assume we have mounted it on
/mnt/dvd. Now we have to create yum repo file for it. Lets create file
/etc/yum.repos.d/ directory. It should looks like :
name=RedHat DVD ISO
Thats it! Your repo is ready. You can check using
yum repolist command.
# yum repolist
Loaded plugins: refresh-packagekit, security
repo id repo name status
dvdiso RedHat DVD ISO 25,459
In above output you can see repo is identified by yum. Now you can try installation any software from it with
yum install command.
Make sure your ISO is always mounted on system even after reboot (add entry in /etc/fstab to run this repo successfully.
YUM repo configuration for http repo
There are many official and un-official repositories are hosted on internet and can be accessed over http protocol. These repositories are large and may contains more packages than your DVD has. To use them in yum, your server should have active internet connection and it should be able to connect with http locations you are trying to configure.
Once connectivity is confirmed create new repo file for them e.g. named
weblocations.repo under directory
/etc/yum.repos.d/ with content as below (for example) :
name=Red Hat Enterprise Linux Server 6 Optional (RPMs)
In above example you can see 2 web locations are configured in repo. First is http for centOS whereas second one is RHEL supplied with https mirror list. Since https protocol is used other SSL realted config can be seen following it.
Time to check repo –
# yum repolist
Loaded plugins: rhui-lb, security
repo id repo name status
centos CentOS Repository 5,062
rhui-REGION-rhel-server-releases-optional Red Hat Enterprise Linux Server 6 Optional (RPMs) 11,057
Both repo are identified by yum. Configuration is successful.
Read about yum server configuration for ftp, http and client side yum configuration in our other articles.