0% found this document useful (0 votes)
22 views37 pages

Yum

yum install

Uploaded by

rwppak048
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views37 pages

Yum

yum install

Uploaded by

rwppak048
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 37

YUM stands for Yellowdog Updater, Modified.

Like all other program's in Linux, YUM is also


an open source tool.

It was initially used in Duke University, for managing package installation on their Red Hat
based system's. These day's its been widely used by almost all Red Hat based system's. In fact its
the default program installer and package management tool these days.

1
In Linux you can install packages through many ways like.

1. Through RPM,

2. Through shell script

3. Through source tar balls etc.

YUM(Yellow-dog Updater and Modifier) is another and advanced way of installing the
packages in Linux distro's such as Red-hat, Fedora and CentOS.

2
 What are packages in Linux?

 Red hat Linux, Fedora & all other red hat based distributions uses RPM as their main software
installation package tool.

 A Linux software package is nothing but a compressed archive of files, consisting of a particular
product information, program files, icons, libraries etc. which enables the functioning of that software
package.

 RPM is the default package installation tool used in Red Hat Linux. RPM stands for Red Hat Package
Manager.

 All required files of an application is compiled in a single file format called with a file extension
of .rpm. The Red Hat package manager tool, which is installed in all RPM based system, knows how to
open and install these .rpm files in the system(.rpm files are compiled and are ready to install, they also
perform a dependency prerequisite check for all required libraries before installing a particular
package.) 3
 So if RPM is already there, why was YUM made?

 RPM and YUM are completely two different things. RPM is the package manager tool which installs
the package. YUM is a repository management tool which will fetch the appropriate package for your
particular version of Linux(along with all other required packages).

 Repositories is an organized collection of packages that YUM uses. YUM can use these repositories to
fetch the correct and exact version of a particular package compatible for your system. Previously
before YUM(or before the existence of such repository management tools), the user had to fetch the
rpm package for installation, and if a dependency problem arises, the user had to fetch those
dependencies from internet or some other sources.

 YUM will contain the URL's(Uniform Resource Locators) of different repositories in its configuration
files. You can in fact update all the installed applications on your system, with the help of a single
YUM command(yum will fetch different packages from appropriate different repositories.)
4
In RHEL4 installing packages is a tedious process, some times it’s headache to install all the
dependencies. So Red-hat come with a solution to overcome this dependencies problem in most
situations, the solution for this is nothing but YUM implementation.

This will resolve this dependency issue and other known issues. Here we are going to present
some basic way how to use YUM utility to install packages locally(there are so many ways to
install packages from different sources either local or remote such as ftp, http).

5
 Follow the below steps to Configure Local YUM Repository Package Manager :

 Step : 1 Install Required Packages

 First we have to install all required packages to configure YUM Repository Package Manager.
So for that we need to install below packages :

 yum.xxx.xxx.xx.rpm
 yum-utils.xxx.xxx.xx.rpm
 createrepo.xxx.xxx.xx.rpm
 vsftpd.xxx.xxx.xx.rpm

6
 Follow the below steps to Configure Local YUM Repository Package Manager :

 Step : 1 Install Required Packages

7
 Follow the below steps to Configure Local YUM Repository Package Manager :

Step : 2 Configure the Vsftpd Server

As we are going to configure local yum repository package manager with FTP Server i.e Vsftps Server, So
before configure the YUM we need to prepare the Vsftpf Server.

For that just edit the main configuration file of Vsftpd Server i.e. (/etc/vsftpd.conf) and search for below
lines and comment-out by removing the #. 8
 Follow the below steps to Configure Local YUM Repository Package Manager :

Step : 2 Configure the Vsftpd Server

9
 Follow the below steps to Configure Local YUM Repository Package Manager

Step : 2 Configure the Vsftpd Server

After configure the Vsftpd Server mount the Installation media and copy all rpm packages to Vsftpd default directory i.e. /var/ftp/pub.

[root@localhost Packages]# mount /dev/cdrom /media # Mount the RHEL Installation media in /media Directory

[root@localhost Packages]#cd /media/CentOS-6.8-x86_64-bin-DVD1/Packages # Change the Directory to Packages

[root@localhost Packages]# cp * -rfv /var/ftp/pub/ # Copy all the rpm Packages to FTP default directory
10
 Follow the below steps to Configure Local YUM Repository Package Manager

 Step : 2 Configure the Vsftpd Server

 Then start the Vsftpd server by using below command.


 [root@localhost ~]# /etc/init.d/vsftpd start Starting vsftpd for vsftpd:

11
 Step : 3 Configure YUM Repository from Server Side

 Main configuration file of yum repository is yum.conf which is located at /etc directory i.e. /etc/yum.conf. Here in this file we can see that we have to put our .repo files on /etc/yum.repos.d directortory.

 Now edit the file.repo YUM Repository file and copy all below lines in that and then save the file.

 [root@localhost yum.repos.d]# nano file.repo

 [base]
 name=base

12
 baseurl=ftp://192.168.1.100/pub/
 enabled=1
 gpgcheck=0
 After configure the .repo file generate database for yum by using createrepo command as shown below. This
will create a .xml file and store all the package information it that and will get the from that xml file when user
try to install any package.

 [root@localhost ~]# createrepo /var/ftp/pub/ # Createing Database file for YUM Repository
 Spawning worker 0 with 3204 pkgs
 Workers Finished
 Gathering worker results
 Saving Primary metadata
 Saving file lists metadata
 Saving other metadata
 Generating sqlite DBs
 Sqlite DBs complete
13
 After running "createrepo" for our repository directory you will have an extra directory along with the packages
inside the repository. this directory is named as "repodata"

 Lets see what's inside that directory.

 [root@localhost repodata]# pwd


 /var/ftp/pub/repodata
 [root@localhost repodata]# ll
 total 13840
 -rw-r--r-- 1 root root 3021610 Feb 10 16:39 filelists.xml.gz
 -rw-r--r-- 1 root root 10148949 Feb 10 16:39 other.xml.gz
 -rw-r--r-- 1 root root 969664 Feb 10 16:39 primary.xml.gz
 -rw-r--r-- 1 root root 951 Feb 10 16:40 repomd.xml
 [root@localhost repodata]#
14
 You can clearly see there are four files inside that directory.

 Let's understand the contents of each and every file in detail.

 what is filelists.xml.gz in YUM?

 Let's see what's inside that compressed file with the help of "zcat". For explanation i have copied one line from
the file "filelists.xml.gz".

 <package pkgid="deee52b24486906ee52576ee471b57061ccd5544" name="php-mbstring"


arch="i386"><version epoch="0" ver="5.1.6"
rel="32.el5"/><file>/etc/php.d/mbstring.ini</file><file>/usr/lib/php/modules/mbstring.so</file></package>

15
 If you see the above line, the first entry tell's the package ID, which will uniquely identify the package.

 The second entry "name" ofcourse suggests the name of the package.

 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

 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.
16
 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.

 <package type="rpm"><name>php53-mbstring</name><arch>i386</arch><version epoch="0" ver="5.3.3"


rel="5.el5"/><checksum type="sha"
pkgid="YES">e4d153d1ac6f71fa50bb6587cf13b324ee44537c</checksum><summary>A module for PHP
applications which need multi-byte string handling</summary><description>The 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.

 type of the packet


 sha hash
 And a summery of the package 17
 What is primary.xml.gz in YUM?

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

18
 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.

19
 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.

 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
20
 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
21
that needs special attention.
 What is other.xml.gz in yum?

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

22
 Basic YUM implementation locally:

 server1#vi testing.repo

 Note : The directory /etc/yum.repos.d/ contaions two .repo files which should be removed or
moved to other directory, so that YUM server will check default .repo file

 Q. What if I don't move or remove the default .repo files from /etc/yum.repos.d/ folder?A:
Every time when you try to install packages through YUM, your yum will check all these files
for repositories for getting packages which will or will not work and most probably delay is
increased in getting those packages from online servers.

23
 Basic YUM implementation locally:

 server1#vi testing.repo

 The new file which is created contains as follows.

 [server1.example.com]
 comment ="test"
 baseurl=file:///var/ftp/pub/
 gpgcheck=0
24
 After entering these entries save and exit from the file.
 Basic YUM implementation locally:

 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).

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

 the third line ask's to ignore key checking(Don't worry, i will include them in my second post about yum.)
Basic YUM implementation locally:

Let me explain what actually these four entries mean.

[server1.example.com] ==>This informs what is the repository name.

comment ==> Its used to see the information about the repo.

baseurl ==> This is the server and path of the repo(here it’s a local repo so the base url is just a file:///
For example you are creating YUM client through FTP then base url should be like this

baseurl=ftp://station1.example.com/pub/Server

26
 Basic YUM implementation locally:

gpgcheck ==> This is to check the authentication of the repository, which is disabled in this case.
Local YUM repository is created, now you can install any package you want with yum command. In order to know
more about YUM, Please see man pages for YUM.
Note:In-order to use yum repository we have to clean the yum meta data, so before installing any package first time
use yum clean all command as shown below.

server1#yum clean all

27
 Basic YUM implementation locally:

 Conflagration Yum client in Linux

[myyumserver]
comment ="My Local Repository"
baseurl=ftp://IP Address of yum Server/pub/
gpgcheck=0
enabled=1
28
 LVM Volume Group Metadata

 The core metadata is stored in ASCII. A metadata area is a circular buffer. New metadata is
appended to the old metadata and then the pointer to the start of it is updated.
 You can specify the size of metadata area with the --m etadatasize. option of the pvcreate
command. The default size may be too small for volume groups that contain physical volumes
and logical volumes that number in the hundreds.

29
 The Physical Volume Label

 By default, the pvcreate command places the physical volume label in the 2nd 512-byte sector.
This label can optionally be placed in any of the first four sectors, since the LVM tools that
scan for a physical volume label check the first 4 sectors. The physical volume label begins
with the string LABELONE.

 The physical volume label Contains:

 Physical volume UUID


 Size of block device in bytes
30
 Metadata Contents
 The volume group metadata contains:

 Information about how and when it was created


 Information about the volume group:

 The volume group information contains:

 Name and unique id


 A version number which is incremented whenever the metadata gets updated
 Any properties: Read/Write? Resizable?
 Any administrative limit on the number of physical volumes and logical volumes it
may contain
 The extent size (in units of sectors which are defined as 512 bytes)
31
 Recovering metadata of physical volumes

 Sometimes, the volume group metadata area of a physical volume could be overwritten or deleted. An error message
indicating that the metadata area is incorrect, or that the system was unable to find a physical volume with a particular
UUID is displayed.

 Symptoms
 The following example shows the kind of output that might be displayed if the metadata area is missing or corrupted.

 # lvs -a -o +devices
Couldn't find device with uuid 'FdfDh3-zhog-iVI8-7qTD-S5BI-HSURYYM5Sk'.
Couldn't find all physical volumes for volume group VG.
Couldn't find device with uuid 'FdfDh3-zhog-iVI8-7qTD-S5BI-HSURYYM5Sk'.
Couldn't find all physical volumes for volume group VG.
32
 pvscan

 cat /proc/partitions

33
 Resolving the problem

 You can recover the data from the physical volume by writing a new metadata area on the physical volume and
specifying the same UUID as the lost metadata.
Warning: Do not attempt this procedure with a working Logical Volume Manager (LVM)
logical volume. Data would be lost if you specify the incorrect UUID.

 1. You can find the UUID of the physical volume that was overwritten in the /etc/lvm/archive directory. Check
the VolumeGroupName_xxxx.vg file for the last known valid archived LVM metadata for that volume group.
Alternately, you can deactivate the volume and set the partial
(-P) argument to obtain the UUID of the physical volume that is missing or corrupted.

# vgchange -an --partial

34
 Resolving the problem

 2. Use the --uuid and --restorefile arguments with the pvcreate command to restore the physical volume. The
pvcreate command overwrites only the LVM metadata areas and does not affect the existing data areas.

Create a PV with same uuid as the missing one.

# pvcreate --uuid "FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk" --restorefile


/etc/lvm/archive/VG_00050.vg /dev/sdh1

Physical volume "/dev/sdh1" successfully created


Where,
/dev/sdh1 is the physical volume with the UUID FdfDh3-zhog-iVI8-7qTD-S5BI-
HSURYYM5Sk
VG_00050.vg is used to take the most recent good archived metadata
35
 Resolving the problem

 3. Run the vgcfgrestore command to restore the metadata of the volume group.

vgcfgrestore VG
Restored volume group VG

 4. Display the logical volumes.

# lvs -a -o +devices

 5. Activate the volumes and display the active volumes.

# lvchange -ay /dev/VG/stripe


36
END of this Course Module.
http://cavepopo.hd.free.fr/wordpress/linux/sudo-command-sudoers-file-concepts-and-practical-examples/

https://www.unixtutorial.org/?s=sudoers

Thanks
37

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy