- Linux package management with YUM and RPM
- What is YUM ? How to Install YUM in Linux ?
- What is YUM?
- Installation of Yum Server with local repository
- What is YUM? How to Configure YUM in RHEL8?
- How To Configure YUM Server in Rhel 8?
- 1. Mount RHEL 8 DVD or ISO file
- 2. Create a folder and Copy all DVD content into that folder
- 3. Copy media.repo file from mounted directory to /etc/yum.repos.d/
- 4. Add repository entries in “/etc/yum.repos.d/rhel8.repo” file
- 5. Clean Yum / DNF and Subscription Manager Cache
- 6. Check whether Yum / DNF is getting packages from Local Repo
- 6. Installing packages using DNF / Yum
Linux package management with YUM and RPM
Installing, patching, and removing software packages on Linux machines is one of the common tasks every sysadmin has to do. Here is how to get started with Linux package management in Linux Red Hat-based distributions (distros).
Package management is a method of installing, updating, removing, and keeping track of software updates from specific repositories (repos) in the Linux system. Linux distros often use different package management tools. Red Hat-based distros use RPM (RPM Package Manager) and YUM/DNF (Yellow Dog Updater, Modified/Dandified YUM).
Yellow Dog Updater, Modified (YUM)
[ Editor’s Note: DNF or Dandified YUM is the updated default since Red Hat Enterprise Linux 8, CentOS 8, Fedora 22, and any distros based on these. Generally, the options are the same. Read more about DNF here. ]
YUM is the primary package management tool for installing, updating, removing, and managing software packages in Red Hat Enterprise Linux. YUM performs dependency resolution when installing, updating, and removing software packages. YUM can manage packages from installed repositories in the system or from .rpm packages. The main configuration file for YUM is at /etc/yum.conf , and all the repos are at /etc/yum.repos.d .
You can learn more about adding repositories to your system from this article on how to add a YUM repo from Amy Marrich.
It’s easy to manage packages in Linux with YUM . At the command line, enter:
There are many options and commands available to use with YUM . I’ve listed some commonly-used commands for YUM below:
Command | Purpose |
yum install | Installs the specified packages |
remove | Removes the specified packages |
search | Searches package metadata for keywords |
info | Lists description |
update | Updates each package to the latest version |
repolist | Lists repositories |
history | Displays what has happened in past transactions |
The following are commonly-used options with YUM :
Options | Purpose |
-C | Runs from system cache |
—security | Includes packages that provide a fix for a security issue |
-y | Answers yes to all questions |
—skip-broken | Skips packages causing problems |
-v | Verbose |
The history option gives you an overview of what happened in past transactions. This provides some useful information, like the date when the transaction happened and what command was run.
You can undo or redo certain transactions using the history command. Here is an example of undoing a transaction:
YUM provides many options for package management. For detailed option information, look at man yum and yum –help . Also, here is a link to YUM documentation.
RPM is a popular package management tool in Red Hat Enterprise Linux-based distros. Using RPM , you can install, uninstall, and query individual software packages. Still, it cannot manage dependency resolution like YUM . RPM does provide you useful output, including a list of required packages. An RPM package consists of an archive of files and metadata. Metadata includes helper scripts, file attributes, and information about packages.
RPM maintains a database of installed packages, which enables powerful and fast queries. The RPM database is inside /var/lib , and the file is named __db* .
RPM has some basic modes: query, verify, install, upgrade, erase, show querytags, show configuration. At least one of these modes needs to be selected to perform package management tasks. Every mode has its own set of options. For example, install mode i has its own set of installation options. Options for the modes are found on the RPM man pages at man rpm .
Some commonly-used modes are listed below:
Mode | Description |
-i | Installs a package |
-U | Upgrades a package |
-e | Erases a package |
-V | Verifies a package |
-q | Queries a package |
Here are some commonly-used general options:
General options | Purpose |
-? | —help | Prints help |
—version | Prints version number |
-v | Prints verbose output |
To install or upgrade an .rpm package using RPM, issue this command:
The flag -i is for install, U is for upgrade, v for verbose, h for hash (this option displays the # as a progress bar for the operation). In this example, v and h are optional flags.
To query for a package using RPM issue following command:
rpm -q query-options package
Option a queries all installed packages on the system.
To erase a package, use the following command:
rpm -e erase-options package-name
Package management is a common task for every system. YUM and RPM provide efficient ways to install, upgrade, remove, and track software packages on Red Hat Enterprise Linux systems.
[ Want to try out Red Hat Enterprise Linux? Download it now for free. ]
What is YUM ? How to Install YUM in Linux ?
In this blog, we will learn about “What is YUM ?” and How to Install YUM in RHEL Linux with the local repository. YUM is the primary tool for getting, installing, deleting, querying, and managing Red Hat Enterprise Linux RPM software packages from official Red Hat software repositories, as well as other third-party repositories. So let’s start to the point. You can also find Yum Commands Cheat Sheet at the end of this blog.
What is YUM?
YUM (Yellowdog Updater Modified) is an open-source command-line as well as a graphical based package management tool for RPM (RedHat Package Manager) based Linux systems. It allows users and system administrators to easily install, update, remove or search software packages on a system. It was developed and released by Seth Vidal under GPL (General Public License) as an open-source, which means anyone can be allowed to download and access the code to fix bugs and develop customized packages. YUM uses numerous third-party repositories to install packages automatically by resolving their dependencies issues.
General Configuration file of yum is located at /etc/yum.conf
You can see this file with any editor
Installation of Yum Server with local repository
We can install a local repository for YUM with DVD/ISO file. If you have DVD then Copy the entire Linux OS DVD’s content to Hard-drive. Insert DVD into DVD-RW and go to the mounting point of DVD.
To make a directory (folder) on root.
[root@localhost ~]# cd / [root@localhost /]# mkdir rhel7
To go on the mounting point of DVD. cd [Mounting Location]
[root@localhost ~]# cd /run/media/root/rhel-server-7/
Copy all entire Linux OS DVD’s into /rhel7 directory (folder)
If you have an iso file of Rhel OS then follow how to mount ISO image in rhel.
Go where there you have copied the entire OS DVD. To go on the Packages Directory. Then Install the createrepo package. To install package
It gives dependencies error. Then you have install depend packages
# rpm -ivh deltarpm-* # rpm -ivh python- deltarpm-*
Then you have to again install the createrepo package
To make “Createrepo” Database for the local repository which is used for YUM. Go to packages directory which is copied already. Go to the location of packages.
Create a file with repo as an extension and specify the YUM details in /etc/yum.repos.d directory (folder)
yum.repos.d this is a directory which contains all repository. now we create our new repo with any editor.
# vim rhel.repo [RHEL] name=local_repo baseurl=file:/rhel7/Packages/ :wq!
[rhel] :- Title of yum repo, name=rhel :- name of yum repo baseurl=file:/rhel7/Packages/ :- location of Rpm packages gpgcheck=0 :- verify rpm to RPM-GPG-key (gpgcheck=0 Disabal, gpgcheck=1 Enable)
Now we can create successful YUM repository, Verify run the yum command
# yum check # yum repolist all
What is YUM? How to Configure YUM in RHEL8?
Yum is an RPM based server, we are using for package management. Through yum we can install, update, remove or search packages very easily. It is an open source management tool in Red hat. Its basic server, we need to configure in any organization where we are using Linux based OS, without yum rpm installation is not easy in Red hat, because of many dependency errors we are getting while installing RPM. Yum is used to resolve dependency errors.
We can set-up local yum or dnf repository using the installation DVD or ISO file.
In RHEL 8, we have two package repositories to yum server.
- BaseOS:- BaseOS repository we have all main OS packages
- Application Stream: – Application, Stream repository we have all application related packages, developer tools and databases etc.
How To Configure YUM Server in Rhel 8?
For configuration of yum we need packages first. We can find all packages in DVD or ISO file.
1. Mount RHEL 8 DVD or ISO file
2. Create a folder and Copy all DVD content into that folder
# mkdir /Package
# cp –rv /mnt/* /Package
3. Copy media.repo file from mounted directory to /etc/yum.repos.d/
# cp -v /opt/media.repo /etc/yum.repos.d/rhel8.repo
Set “644” permission on “/etc/yum.repos.d/rhel8.repo”
4. Add repository entries in “/etc/yum.repos.d/rhel8.repo” file
Edit rhel8.repo file.
vi /etc/yum.repos.d/rhel8.repo
[InstallMedia-BaseOS]
name=Red Hat Enterprise Linux 8 – BaseOS
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///Package/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[InstallMedia-AppStream]
name=Red Hat Enterprise Linux 8 – AppStream
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///Package/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
5. Clean Yum / DNF and Subscription Manager Cache
#dnf clean all
#subscription-manager clean
6. Check whether Yum / DNF is getting packages from Local Repo
Use dnf or yum repolist command to verify whether these commands are getting packages from Local repolist
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 1:32:44 ago on Sat 11 May 2019 08:48:24 AM BST.
repo id repo name status
InstallMedia-AppStream Red Hat Enterprise Linux 8 – AppStream 4,672
InstallMedia-BaseOS Red Hat Enterprise Linux 8 – BaseOS 1,658
To prevent message “This system is not registered with Red Hat Subscription Management. You can use the subscription-manager to register.” Go to /etc/yum/pluginconf.d/subscription-manager.conf”, changed the parameter “enabled=1” to “enabled=0”
[root@ssdntech~]# vi /etc/yum/pluginconf.d/subscription-manager.conf
vi /etc/yum/pluginconf.d/subscription-manager.conf
[main]
enabled=0
6. Installing packages using DNF / Yum
It will show you Packages and its dependencies and ask you for confirmation about installing packages. Press “Y” if you want to install any package.