0% found this document useful (0 votes)
1 views

How to Configure YUM Repository in RHEL Linux(hot)

This tutorial provides a step-by-step guide on how to configure a local YUM repository in RHEL/CentOS Linux, detailing the use of the YUM package management utility for installing, updating, and removing RPM packages. It explains the importance of repository configuration files, how to create a local repository from installation disks, and the necessary commands to manage packages using YUM. Additionally, it covers key options and commands for searching, installing, and removing packages effectively.

Uploaded by

itzzrch.irmog
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

How to Configure YUM Repository in RHEL Linux(hot)

This tutorial provides a step-by-step guide on how to configure a local YUM repository in RHEL/CentOS Linux, detailing the use of the YUM package management utility for installing, updating, and removing RPM packages. It explains the importance of repository configuration files, how to create a local repository from installation disks, and the necessary commands to manage packages using YUM. Additionally, it covers key options and commands for searching, installing, and removing packages effectively.

Uploaded by

itzzrch.irmog
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Home Networking Tutorials CCNA Study Guide Linux Tutorials Tutorials Collection Career Resources Networking Interviews

How to Configure YUM Repository in RHEL Linux RHCE 7 Study Guide


This tutorial explains how to create or configure local yum repository in Linux step by step including how to define baseurl and gpgcheck keys. Learn how Grep Command in Linux Explained with Practical
to List packages, get package information, search specific package and install & remove individual package or group packages with yum command in detail Examples
with examples. How to manage disk quota in Linux step by step
How to Configure RAID in Linux Step by Step
Guide
Learn How to Configure LVM in Linux step by step
How to create swap partition in Linux
Basic overview of Yum Linux Disk Management with parted command

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.

Yum Repository Configuration Files


This site uses cookies to provide better user experience, show personalized ads and analyze site traffic. By using our site, you consent to the use of cookies, as described in our privacy policy. ✖
Whenever we use Yum command, it checks yum repository configuration files to get the list of available repositories. Yum repository configuration files are
stored in /etc/yum.repos.d/ directory and have .repo extension. By default these files are configured to use only official online repositories. In RHCSA or
RHCE exam we are not allowed to use Internet. Luckily both exam and Yum command allows us to use local repository. In this tutorial we will learn how to
create and use a local 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.

How to create a local yum repository

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.

Let’s insert installation disk in system and mount it.

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.

Switch to /rhcelab/repo directory and install creatrepo package.

Now run createrepo /rhcelab/repo command.

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.

Can you figure out why?

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.

Create an rhcelab.repo file in /etc/repos.d/ directory with following contents

Let’s understand the meaning of above contents step by step

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.

name=rhcerepo This configuration value is used to set the name of repository.

baseurl=file:///rhcelab/repo This configuration value defines the location of rpm files.

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.

How to define the baseurl key


To define local directory path use file:///directory_path.
To define FTP path use ftp://hostname/path_to_directory_which_has_rpms
To define HTTP path use http://hostname/path_to_directory_which_has_rpms
To define NFS path use file://hostname/path_to_directory_which_has_rpms
You may use IP address at the place of hostname, if DNS is not configured.

The gpgcheck key


By default yum is configured to use online repositories. If repository server is compromised, a hacker may put some fake packages in repository or may
change existing packages. If these packages are installed in system, the system may get hacked also. The GPG key is the counter measurement of this kind
of security threat. The packages in repository are signed with GPG key. The owners of packages also provide the GPG keys. With GPG key yum can check
whether the package is in its original state or has been modified in repository. Since in our local repository we put all packages from original installation
disk, there is no need to enable the GPG check feature.

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.

Linux package management with yum command


Ads by Google

Yum Repository Fedora Yum Repo Yum

Update Yum Repository RPM Repository Update

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.

Option / Sub command Description

provides / whatprovides Perform a deep scan in all rpm for specified file.

search / search all Search for specified package

list installed List all installed packages in system

list List all packages available from all enabled repositories.

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

info Provide detailed information about package

install Install the specified package

remove Remove the specified package

update Update the specified package

Searching packages
Ads by Google

Update Yum Repository RPM Repository Update

Clean Computer Android APK Downloads Software Update

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

#yum search SearchString

For example to search any package which contains semanage in the name we can use following command

#yum search semanage

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.

Following figure illustrates the use of both commands.

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

#yum provides */chocon

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.

We can also use whatprovides sub command instead of provides command.

#yum whatprovides */chocon

There is no functional difference between provides and whatprovides sub command.

Following figure illustrates the use of booth commands.

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

Following command will install package without 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.

Following command will remove vsftpd package with confirmation.

That’s all for this tutorial. In next tutorial we will learn another Linux topic in detail.

Ads by Google

Clean Computer Android APK Downloads Software Update

Linux Server Centos Linux Linux Package

Created By ComputerNetworkingNotes Published On 2018-01-22 12:12:06 Last Updated 2018-02-03 06:49:36

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

You might also like