DISCLAIMER : Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility.If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.


 Yum or Yellow dog Update, Modified is a package manager that was developed by Duke University to improve the installation of RPMs.

Yum searches numerous repositories for packages and their dependencies so they may be installed together in an effort to alleviate dependency issues. Red Hat Enterprise Linux 5 uses Yum to fetch packages and install RPMs.

Yum uses a configuration file at /etc/yum.conf. Also refer yum(8) man page for more information.

There are multiple ways by which you can install a repository on the system and install/update packages :
  1. Add an existing repository.
  2. Setup a new repository having packages populated from ISO's downloaded from RHN.
  3. Register the system on RHN and subscribe to the channels depending on the subscription you have.
To automatically install software from the DVD I would like to use YUM, but I have to set it up first. There is a main configuration file - yum.conf which resides in /etc. This is the default content of it:

# cat /etc/yum.conf

Next we need the Media ID from the DVD. It can be obtained from a file call media.repo from the DVD. First mount the DVD:

# mkdir -p /mnt/dvd
# mount /dev/sr0 /mnt/dvd

Or mount the ISO file:

# mkdir -p /mnt/dvd
# mount /root/rhel6.iso /mnt/dvd -o loop

Get Media ID from DVD:

# cat /mnt/dvd/media.repo
name=Red Hat Enterprise Linux 6.0

Now configure /etc/yum.repos.d/file.repo and add the DVD (or the ISO file) as a repository and add /mnt/dvd as baseurl:

# cat /etc/yum.repos.d/file.repo

Check if it accept the repository:

# yum repolist
Loaded plugins: rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
dvd                          | 3.7 kB     00:00 ...
dvd/primary_db               | 2.9 MB     00:00 ...

Install a package from the repository (e.g. tree):

# yum install tree
Loaded plugins: rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tree.x86_64 0:1.5.3-2.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved
Package   Arch       Version         Repository     Size
tree      x86_64     1.5.3-2.el6     dvd            36 k

Transaction Summary
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 36 k
Installed size: 65 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing     : tree-1.5.3-2.el6.x86_64

  tree.x86_64 0:1.5.3-2.el6

Complete! Just keep in mind that you always have to mount the DVD or the ISO file before you can install any software via YUM.

Yum must be running as root. Here are some useful commands:

1) Install a package:
yum install package
yum install httpd
2) Remove a package:
yum remove package
yum remove httpd
3) Update a package:
yum update package
yum update httpd
4) Search for a package:
yum search package
yum search httpd
5) Find information about a package:
yum info package
yum info httpd
6) List packages containing a certain term:
yum list term
yum list httpd
7) Find what package provides a particular file:
yum whatprovides 'path/filename'
yum whatprovides 'etc/httpd.conf'
yum whatprovides '*/libXp.so.6'
8) Update all installed packages with kernel package :
yum update
yum update
9) To update a specific package:
yum update <package-name>
yum update openssh-server 

Do you like this story?

No comments:

Post a Comment