How to Configure YUM Repository in RHEL Linux(hot)
How to Configure YUM Repository in RHEL Linux(hot)
Yum is the default package management utility in RHEL/Centos Linux. Yum is used to search, install, update and remove necessary rpm files from system. Manage Linux Disk Partition with gdisk Command
RHEL/Centos Linux use .rpm file to manage the software. A .rpm file extension represents Linux software package file. Yum uses repository to manage the Manage Linux Disk Partition with fdisk Command
rpm files. A repository is the collection of RPM files. Since Yum depends on repository, there must be at least one working repository before it can be used. Linux Disk Management Tutorial
A repository can be configured either locally (on local hard) or remotely (on network or internet). RPM Command in Linux Explained with Examples
YUM stands for Yellow Dog Updater Manager.
Yum is the default package management utility in RHEL/Centos.
Yum uses repository to get the necessary rpm files.
A repository is collection of rpm files.
Repository may contain multiple versions of the same RPM package.
Repository may contain different builds for different architectures for example one for i686 and other for x86_64.
A repository can be configured locally or remotely.
Yum can automatically resolve software dependencies and based on system hardware it can automatically select appropriate version of RPM package
from repository.
Repositories are operating system specific. They will not work with other flavor of Linux for example a RHEL repositories will not work with Centos system
and vice versa a Centos repositories will not work with RHEL system. In Red Hat Linux repositories are provided through the RHN network. To use RHN
network we need to have an active subscription. During the installation, RHEL asks us to register the system with RHN network. If system is registered with
RHN network and subscription is active, default configuration is sufficient to install software packages. If system is not registered with RHN network, it will
never be able to connect with Red Hat official repositories. For this reason it is recommended to use Centos instead of Red hat, if free version of RHEL Linux
is needed.
Before we create repository, we need to get all necessary RPM package files. For this, we can use RHEL/Centos installation disk. As we know repository is
operating system specific, we have to use the same disk which we used to install the operating system. If RHEL is installed, we have to use the RHEL
installation disk. If Centos is installed then we have to use the Centos installation disk.
By default all media disks are mounted in /run/media/UserName/ directory. Here UserName is the name of logged in user.
Create a directory. Since this directory will be used to store all RPM package files from disk, make sure we have sufficient (at least 4GB) free disk space. In
this tutorial we will use /rhcelab/repo directory.
Copy all RPM package files from installation disk to /rchelab/repo directory. Replace /rchelab/repo with your own path, if you are using other directory.
During this process several cache files are generated. Let’s remove them.
That’s all we need, our local repository is ready to use. But wait at this point yum command can’t use this repository.
Yep, you got it right. Yum command uses repository configuration files to figure out the available repositories. And so far we haven’t created the necessary
repository configuration file for our local repository.
vi As we know repository configuration files are stored in /etc/yum.repos.d/ directory with an extension .repo, So we
/etc/yum.repos.d/rhcelab.repo executed this command to create the necessary configuration file for repository.
[rhcerepo] This is the label of repository. Usually a repository file contains configuration for multiple repositories. In that case
label is used as identifier of repository.
enabled=1 This key defines the state of repository. If value is set to 1 then repository is enabled. If value is set to 0 then
repository is disabled.
gpgcheck=0 This key defines whether the integrity of package should be check or not. If value is set to 1, integrity will be checked.
If value is set to 0, integrity will not be checked.
:wq We used vi editor to create the file. In vi editor, the command: wq is used to save and quit from file.
We can verify the newly created repository with yum repolist command.
As output confirms that our repository (name – rhcerepo and id - rhcerepo) is ready to use. Currently this repository contains 4751 packages.
Now we have a working repository, in remaining part of this tutorial we will learn how to use the repository.
The yum command is used to work with repository. Before we explore yum command in details let’s have a quick look on some important options used
with this command.
provides / whatprovides Perform a deep scan in all rpm for specified file.
list all List all packages available for installation from all enabled repositories as well as those that are already installed.
group list List all groups that are available for installation
Searching packages
Ads by Google
To install, remove or update a package we first need to know the exact name of the package. Since packages name contain a lot of information in name
(such as version, architecture, platform etc.), they are hard to remember. We can use two sub commands to get the exact name of a package; search and
provides.
To find out all packages which have specified string in name we can use following command
For example to search any package which contains semanage in the name we can use following command
By default this command will search for specified string only in name and summary.
To search everywhere in package we have to use all option with this command.
If we know the command but don’t the package name which provides the specific command, we can use provides or whatprovides sub command. For
example to know which package provides chocon command we can use following command
This command will perform a deep scan in all RPM for file name chocon. Linux commands have an associated script file which executes when command is
called at shell prompt.
Once we got the exact package name, we can use info sub command to get the more detailed information about the package. For instance, in above
example we figured out that chcon command is provided by coreutils package. To get more information about this package we can use following
command
Installing Package
When we install a package with yum command, it creates necessary directory tree at appropriate location and installs required files from package. It also
checks for dependencies. If any file in package depends on other files, yum will also install those files automatically. During installation if yum finds any file
which is already installed in system from package, it will check its current version. If package contains latest file, it will update the existing file. By default
yum command will ask for confirmation. To perform installation without confirmation we have to use –y option.
For example following command will install the vsftpd package with confirmation
Removing packages
To remove a package we can use remove sub command. Just like install, remove operation is also performed with dependency which means yum will not
only remove the specified package but all remove all the packages that depend on it. For this reason, even it supports –y option, we should not perform
remove operation without confirmation. Remove operation should always be performed with confirmation.
That’s all for this tutorial. In next tutorial we will learn another Linux topic in detail.
Ads by Google
ComputerNetworkingNotes RHCE 7 Study Guide How to Configure YUM Repository in RHEL Linux
How to Configure Samba Server in Redhat Linux How to configure NIS Server in Linux
We do not accept any kind of Guest Post. Except Guest post submission, for any other query (such as adverting opportunity, product advertisement, feedback, suggestion, copyright, error reporting and technical
issue) or simply just say to hello mail us [email protected]
Computer Networking Basic Tutorials and Study Guides © 2018. All Rights Reserved.
Terms and Conditions Privacy Policy