Szukaj na tym blogu

środa, 8 czerwca 2011

   In this post I will try to outline you the concepts of package management in RedHat Enterprise Linux 5 (RHEL5) and also guide you how to keep your RHEL5 up to date.

   One of the main sys admin tasks is to install, update, uninstall software from operating system.
In order to update your RHEL5 system you need to choose one of the following methods :
- Red Hat Network Server from http://rhn.redhat.com (RHN),
- Red Hat Network Proxy Server (RHN Proxy),
- Red Hat Network Satellite Sever (RHN satellite)

Each of mentioned above methods work great and it is up to you to choose exact one.

RHN
Stands for Red Hat Network Server. You must have valid licence agreement with red hat in order to get updates and manage your systems through that page. What it basically does is it allows sys admin to administer updating, removing, installing packages in numerous systems from on place on the internet.
If you want to test it, you can register on the http://rhn.redhat.com, download RHEL5 30 days trial version and install it freely on you hardware or some virtualization platform (e.g. VBOX,VMWARE, etc.).
Then you can register your machine in the following way :
1. chkconfig --list rhnsd
2. vi /etc/sysconfig/rhn/rhnsd
3. rhn_register

chkconfig --list rhnsd
In order to comunicate with RHN you need rhnsd daemon active on you system.
By using this command you check the status of this daemon. When you perfomed standard RHEL5 installation it is already configured and started by default.
If for some reason it is't, you have to enable it, assuming your runlevel is 3 it looks like this :
chkconfig --level 3 rhnsd on

vi /etc/sysconfig/rhn/rhnsd
By default rhnsd daemon checks for updates in 240 ms intervals, if you want to change this value of variable from INTERVAL=240 to whatever you like :
vi /etc/sysconfig/rhn/rhnsd

rhn_register
It is is a client program that registers your system with Red Hat Network
(or a Red Hat Network Satellite). After registering, your system can recieve soft-
ware updates, install new software, and remotely manage your system.


RHN allows you to register and push updates onto your systems as they appear in RHN. I allows you to do even more cause, from one place you can administer installation, uninstallation of packages for you systems.
It has also disadvantages like this that RHN have all hardware and software info about you RHEL5 installation and that machine must have access to internet in order to be visible in RHN.
If you system doen't have internet access or you don't want RHN to register all your installation info you should take into account use of RHN Proxy Server or RHN Satellite Server products.


RHN Proxy
Red Hat Network Proxy Server allows you to download packages to your local server and then instruct RHEL machines to use this servers repository of packages instead of repository from internet.
The simplest implementation of RHN Proxy is illustrated on hte picture below.

More basic info can be read here.
Technical details about implementing this solution can be read here.


RHN Satellite
Red Hat Network Satellite Server has the same functionalities as RHN Server but instead of being hosted by Red Hat on the internet it it hosted by you on your infratstructure typically in DMZ.
The same as RHN Proxy it requires special peace of software to run.
Basic info can be read here.
Technical info can be read here and here.

Now it is time to describe update clients in RHEL5. There are two :
- RPM
- YUM

RPM
Red Hat Package Manager is the main utility in RHEL to manage software. It allows :
- installation
- removal
- update
- check installation
- provide info about software
- find for software packages
Very useful information can be found here, I know that it comes from fedora but it is the same in RHEL.

I learned chapters 1-7, other ones are for advanced RPM usage and are irrelevant unless you are developer and want to prepare RPM packages.

IMPORTANT !!!
Newer upgrade new kernel always do the -i install method. In case of problems with new kernel if you perform upgrade you don't have the old kernel to recover from.


Below are the most basic rpm commands used in day-to-day system administration :
List all installed packages :
rpm -qa
List location and name of configuration file related particular package :
rpm -qc minicom-2.1-3
List locations of documentation file related particular package :
rpm -qd minicom-2.1-3
Listing files in a package from RPM database
rpm -ql minicom-2.1-3
Display information about package from RPM database :
rpm -qi minicom-2.1-3

IMPORTANT !!!
You can query for package meta information with "-q" switch in two locations :
- RPM database stored locally on your system (rpm -q)
- RPM package file (rpm -qp)
The RPM database is stored in /var/lib/rpm. The files in that directory are Berkeley DB files.
RPM package file conatains special file with info about itself and can be queried before installing.

Display information about package from RPM file :
rpm -qpi minicom-2.1-3.i386.rpm
Display package name which contains a specified file name :
rpm -qf /bin/sh
Install a package :
rpm -i minicom-2.1-3.i386.rpm
Update a package :
rpm -U minicom-2.1-3.i386.rpm
Remove a package :
rpm -e minicom-2.1-3
Verify installed package for errors :
rpm -V minicom-2.1-3
Verify entire system :
rpm -Va

TOP TIP !
How to find all packages on your system with .rpm extension ?
find / -name \*.rpm 2>/dev/null


YUM
Yellow Dog Update Modifier does the same as RPM but have on advantage, it allows to install in one step dependencies. This operation is performed as a transaction so all or nothing is performed when there are some relations between packages.
It is the recommended tool for sys admins in order to deal with package management.
Usefull info can be found here.
If you wanted to use RPM to install packages you would face "dependency hell".

Some typical usage scenarios of YUM :
Check whether are some updates for your system :
yum check-update
Apply/Install updates :
yum update
Install package from RPM file :
yum install minicom-2.1-3.i386.rpm
Install a package from configured repositories :
yum install minicom.i386
Remove a installed package
yum remove minicom.i386
List all installed packages :
yum list installed
List all packages : installed, available from repo :
yum list all
Searches for which packages provide the requested dependency of file. This also takes wildcards for files :
yum provides MTA
Lists any installed package which no longer appears in any of your enabled repositories. Useful for finding packages which linger between upgrades or things installed not from a repo :
yum list extras
Lists any obsoleting relationships between any available package and any installed package :
yum list obsoletes
Lists any package in an enabled repository which is an update for any installed package
yum list updates
Lists any package added to any enabled repository in the last seven(7) days
yum list recent
Display info about installed package
yum info minicom.i386


PACKAGE DEPENDENCIES
There are four dependencies in RHEL that system tracks :
- requires ---> which tracks the capabilities a package requires
- provides ---> which tracks the capabilities a package provides for other packages
- obsoletes ---> which describes the capabilities that if installed, conflict with capabilities in a package
- conflicts ---> which describes the capabilities that this package will make obsolete

You can check package dependencies by using, the rpm command :
Checking for requires capabilities :
rpm -qp --requires sendmail-8.12.5-7.i386.rpm
Checking for provides capabilities :
rpm -q --provides tcsh
Checking for conflicts capabilities :
rpm -q --conflicts httpd
Checking for obsoletes capabilities :
rpm -q --obsoletes httpd

Brak komentarzy:

Prześlij komentarz

Uwaga: tylko uczestnik tego bloga może przesyłać komentarze.