Module – 10 Linux Package Administration- YUM

What is YUM?

  • YUM (Yellowdog Updater Modified) is an open source command-line as well as graphical based package management tool for RPM (RedHat Package Manager) based Linux systems.
  • It allows users and system administrator to easily install, update, remove or search software packages on a systems.
  • YUM uses numerous third party repositories to install packages automatically by resolving their dependencies issues.

To setup local YUM repository using RHEL ISO image (Installation CD):

Step:1 Attach rhel6.4 ISO image to your virtual machine (server)

Step:2 Mount the RHEL6.4 ISO (CD) under /mnt

mount /dev/cdrom /mnt
 mount:according to mtab,/dev/sr0 is already mounted on /mnt

Step:3 Verify the CD drive mounted

# df -h
  /dev/sr0              3.5G  3.5G     0 100% /mnt

Step:4 
Update the following lines to create local YUM repository:

vi /etc/yum.repos.d/client.repo
[client]
name=client-repo
baseurl=file:///mnt
enabled=1
gpgcheck=0

:wq!

Step:5 Verify YUM repository

# yum repolist
Loaded plugins: product-id, security, subscription-manager
repo id                            repo name                              status
client                             client-repo                            3,648  repolist: 3,648

 

To install packages using YUM:

To install a package called Firefox 14, just run the below command it will automatically find and install all required dependencies for Firefox.

  • yum install fireforx

If you want to install packages automatically without asking any confirmation, use option -y as shown in below example.

  • yum -y install firefox

To remove packages using YUM:

To remove a package completely with their all dependencies, just run the following command as shown below

  • yum remove firefox
  • yum –y remove firefox

To update a Package using YUM:

Let’s say you have outdated version of MySQL package and you want to update it to the latest stable version. Just run the following command it will automatically resolves all dependencies issues and install them.

  • yum update mysql

To list a Package using YUM:

Use the list function to search for the specific package with name. For example to search for a package called openssh, use the command

  • yum list openssh

To search for a Package using YUM:

If you don’t remember the exact name of the package, then use search function to search all the available packages to match the name of the package you specified. For example, to search all the packages that matches the word .

  • yum search vsftpd

To get Information of a Package using YUM:

Say you would like to know information of a package before installing it. To get information of a package just issue the below command.

  • yum info firefox

List all Available Packages using YUM

  • yum list | less

To list all install packages using YUM

  • yum list installed | less

Yum Provides Function:

Yum provides function is used to find which package a specific file belongs to.
For example, if you would like to know the name of the package that has the
“/etc/httpd/conf/httpd.conf”

# yum provides /etc/httpd/conf/httpd.conf
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

httpd-2.2.15-26.el6.x86_64 : Apache HTTP Server
Repo       : client
Matched from:
Filename   : /etc/httpd/conf/httpd.conf
httpd-2.2.15-26.el6.x86_64 : Apache HTTP Server
Repo       : installed
Matched from:
Other       : Provides-match: /etc/httpd/conf/httpd.conf

To check for Available Updates using Yum:

  • yum check-update

To update System using Yum:

  • yum update

To list all available Group Packages:

In Linux, number of packages are bundled to particular group. Instead of installing individual packages with yum, you can install particular group that will install all the related packages that belongs to the group.

For example to list all the available groups, just issue following command

  • yum grouplist
Installed Groups:
Administration Tools
DNS Name Server
FTP Server
Graphics
Java Development
Legacy Network Server
Available Groups
Authoring and Publishing
Base
Beagle
Cluster Storage
Clustering
Development Libraries

To Install/Update/remove a Group Packages:

To install a particular package group, we use option as groupinstall.

Fore example, to install “MySQL Database“, just execute the below command.

# yum groupinstall ‘MySQL Database‘

# yum groupupdate ‘DNS Name Server‘

#yum groupremove ‘DNS Name Server’

YUM Repositories:

List Enabled Yum Repositories

yum repolist

List all enabled/disabled Yum Repositories

yum repolist all

Install a Package from Specific Repository

yum –enablerepo=epel install phpmyadmin

To clean yum cache / View the history:
By default yum keeps all the repository enabled package data in /var/cache/yum/ with each sub-directory, to clean all cached files from enabled repository, you need to run the following command regularly to clean up all the cache and make sure that there is nothing unnecessary space is using.

yum clean all

yum history

 

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>