What is yum package in linux

YUM repository and package management: Complete Tutorial

it also mentions the architecture, version and also the release of the package.

An important fact to note is that, it also gives the information about the file’s that are going to be installed on the system, if you install this package. Installing this package, will install two files namely ,

/etc/php.d/mbstring.ini

/usr/lib/php/modules/mbstring.so

Wow isnt that cool? So that filelists.xml.gz will contain the complete information about all the packages in the repository. This file will be used by YUM to fetch details of all the packages in the repository.

what is primary.xml.gz in YUM?

Let’s get the detail’s of that exact same package from primary.xml.gz file. Lets see what’s inside this file.

php53-mbstringi386e4d153d1ac6f71fa50bb6587cf13b324ee44537cA module for PHP applications which need multi-byte string handlingThe php-mbstring package contains a dynamic shared object that will add

So this file also consists of package details. But it contains some additional information’s like the following.

If you have noticed the file «filelists.xml.gz» contains the information about the file’s a particular package will install on the system. So if you dont have «filelists.xml.gz» inside your repository, then you will not be able to search the repository with your required file(this kind of searching is done to identify, which package provides a particular file.)

Most of the packages install a lot number of files on the system. Thats why the file «filelists.xml.gz» is too large.

What is repomd.xml in yum?

the file remomd.xml contains the details about all the files in the repsitory. the contents of remomd.xml is as shown below.

    53349b063023303c5976135a7e485b0aa932ba6f 1360494599 2245d5a3cf0c3398a28b0c63948ecdf58668041e   35d6d80d5b115f0da3452534c1f5cf9c0efcef3f 1360494599 5d1f2791794e1cc20590099a962cf5260f942b7a   afe11b0976096135357e11e2ff1707d88ebef6fd 1360494599 976baa466007d496accfa24922f2f0722c56f1dd   

It tell’s the details about all the other files in the repository metadata, or call it repodata.

  • Location of primary.xml.gz,filelists.xml.gz,other.xml.gz
  • their modification time stamp
  • their checksum

What is other.xml.gz in yum?

this file contains the complete information about a package like the following

  • Author
  • Version details
  • Changelog
  • Bug fixes from previous versions etc

This file is used when a user queries information about a package with the help of «repoquery» command. this command is part of yum-utils package.

We will be discussing «YUM» commands, and other util’s that can be used to query repositories in another post, because that needs special attention.

Читайте также:  Настройка kali linux usb

other.xml.gz is the biggest repo file because it contains a lot of version specific details and change log of a particular package.

How to enable the YUM repo, i just created with createrepo for my system?

the primary configuration file for yum is /etc/yum.conf . Let’s see the contents of that file.

[root@localhost ~]# cat /etc/yum.conf [main] cachedir=/var/cache/yum keepcache=0 debuglevel=2 logfile=/var/log/yum.log distroverpkg=redhat-release tolerant=1 exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 bugtracker_url=http://bugs.centos.org/yum5bug # Note: yum-RHN-plugin doesn't honor this. metadata_expire=1h installonly_limit = 5 # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d [root@localhost ~]#

the second last line in the file «yum.conf» , says that you can either put your repository configuration details here, or inside /etc/yum.repos.d/ , with the extension of .repo .

So let’s now create the file called local.repo ( You can do that with any name of your wish. Only remember that the extension must be .repo. )

[root@localhost yum.repos.d]# pwd /etc/yum.repos.d [root@localhost yum.repos.d]# cat local.repo [localrepo] baseurl=file:///var/yum/ gpgcheck=0 [root@localhost yum.repos.d]#

In the above example i have created the file named local.repo inside /etc/yum.repos.d/ wih three lines.

The first line indicates the repo name,

the second line indicates the URL of the repository. I have used file:/// , because its in my local system. the first two «//» , in the URL indicates the protocol slashes, the third slash indicates the Linux root filesystem «/»

You can also place your repository inside your FTP home directory to run with FTP protocol(You will be using ftp://YOURIP/FTP HOME as the baseurl) .

Also you can use HTTP protocol, after placing this in your document ROOT in Apache and giving appropriate URL in «baseurl» argument.

the third line ask’s to ignore key checking(Don’t worry, i will include them in my second post about yum.)

let’s try installing one package through our newly created repository.

[root@localhost yum.repos.d]# yum install php-mbstring Loaded plugins: fastestmirror, security Repository 'localrepo' is missing name in configuration, using id Loading mirror speeds from cached hostfile Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package php-mbstring.i386 0:5.1.6-32.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================================================================= Installing: php-mbstring i386 5.1.6-32.el5 localrepo 996 k Transaction Summary ============================================================================================================================================================================================================================================= Install 1 Package(s) 
vafopoulos.org/easy-money-on-internet
Upgrade 0 Package(s) Total download size: 996 k Is this ok [y/N]:

There is a cache directory for yum, where yum saves all the required files of a repository. It contains all the files that we created, with the help of «createrepo» command. they are downloaded and kept when you initially use a repository.

[root@localhost ~]# cd /var/cache/yum/ [root@localhost yum]# ls base extras localrepo myrepo timedhosts.txt updates [root@localhost yum]# cd localrepo/ [root@localhost localrepo]# ls cachecookie packages primary.xml.gz primary.xml.gz.sqlite repomd.xml [root@localhost localrepo]#

From the above output you can clearly see that, our cache directory has got separate directories for separate yum repositories.

Читайте также:  How to disable password in linux

you can create as many repositories as you want (and put their .repo files containing the URL inside /etc/yum.repos.d/).

there are also some publicly know yum repositories, which you can use. Some of them are listed below.

Will cover some of the advanced topics and other configuration options in the second part of this yum tutorial.

Источник

Linux package management with YUM and RPM

Gift package wrapped in purple with lavender ribbon

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
Читайте также:  Драйвер линукс xerox 3215

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.

yum-history

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.

rpm-ivh

To query for a package using RPM issue following command:

rpm -q query-options package

Option a queries all installed packages on the system.

rpm-qa

To erase a package, use the following command:

rpm -e erase-options package-name

rpm-evh

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. ]

Источник

Оцените статью
Adblock
detector