Patching / Updating Linux Environment by Network repository or Local repository.

1)      By Network repository :

 Register my system with RHN

# rhn_register

Display list of updated software (security fix)

# yum list updates

Patch up system by applying all updates

# yum update

List all installed packages

# rpm -qa

# yum list installed

Find out if httpd package installed or not, enter:

# rpm -qa | grep httpd*

# yum list installed httpd

Check for and update specified packages

# yum update {package-name-1}

To check for and update httpd package, enter:

# yum update httpd

Search for packages by name

Search httpd and all matching perl packages, enter:

# yum list {package-name}

# yum list {regex}

# yum list httpd

# yum list perl*

Sample output: as an example

Loading “installonlyn” plugin

Loading “security” plugin

Setting up repositories

Reading repository metadata in from local files

Installed Packages

perl.i386                                4:5.8.8-10.el5_0.2     installed

perl-Archive-Tar.noarch                  1.30-1.fc6             installed

perl-BSD-Resource.i386                   1.28-1.fc6.1           installed

perl-Compress-Zlib.i386                  1.42-1.fc6             installed

perl-DBD-MySQL.i386                      3.0007-1.fc6           installed

perl-DBI.i386                            1.52-1.fc6             installed

perl-Digest-HMAC.noarch                  1.01-15                installed

perl-Digest-SHA1.i386                    2.11-1.2.1             installed

perl-HTML-Parser.i386                    3.55-1.fc6             installed

…..

…….

..

perl-libxml-perl.noarch                  0.08-1.2.1             base

perl-suidperl.i386                       4:5.8.8-10.el5_0.2     updates

Install the specified packages [RPM(s) ]

Install package called httpd:

# yum install {package-name-1} {package-name-2}

# yum install httpd

Remove / Uninstall the specified packages [RPM(s) ]

Remove package called httpd, enter:

# yum remove {package-name-1} {package-name-2}

# yum remove httpd

Display the list of available packages

# yum list all

Display list of group software

Type the following command:

# yum grouplist

Output: as an example

Installed Groups:

Engineering and Scientific

MySQL Database

Editors

System Tools

Text-based Internet

Legacy Network Server

DNS Name Server

Dialup Networking Support

FTP Server

Network Servers

Legacy Software Development

Legacy Software Support

Development Libraries

Graphics

Web Server

Ruby

Printing Support

Mail Server

Server Configuration Tools

PostgreSQL Database

Available Groups:

Office/Productivity

Administration Tools

Beagle

Development Tools

GNOME Software Development

X Software Development

Virtualization

GNOME Desktop Environment

Authoring and Publishing

Mono

Games and Entertainment

XFCE-4.4

Tomboy

Java

Java Development

Emacs

X Window System

Windows File Server

KDE Software Development

KDE (K Desktop Environment)

Horde

Sound and Video

FreeNX and NX

News Server

Yum Utilities

Graphical Internet

Done

 

Install all the default packages by group

Install all ‘Development Tools’ group packages, enter:

# yum groupinstall “Development Tools”

Update all the default packages by group

Update all ‘Development Tools’ group packages, enter:

# yum groupupdate “Development Tools”

Remove all packages in a group

Remove all ‘Development Tools’ group packages, enter:

# yum groupremove “Development Tools”

Install particular architecture package

If you are using 64 bit RHEL version it is possible to install 32 packages:

# yum install {package-name}.{architecture}

# yum install mysql.i386

Display packages not installed via official RHN subscribed repos

 Show all packages not available via subscribed channels or repositories i.e show packages installed via other repos:

# yum list extras

Sample output:

Loading “installonlyn” plugin

Loading “security” plugin

Setting up repositories

Reading repository metadata in from local files

Extra Packages

DenyHosts.noarch                         2.6-python2.4          installed

VMwareTools.i386                         6532-44356             installed

john.i386                                1.7.0.2-3.el5.rf       installed

kernel.i686                              2.6.18-8.1.15.el5      installed

kernel-devel.i686                        2.6.18-8.1.15.el5      installed

lighttpd.i386                            1.4.18-1.el5.rf        installed

lighttpd-fastcgi.i386                    1.4.18-1.el5.rf        installed

psad.i386                                2.1-1                  installed

rssh.i386                                2.3.2-1.2.el5.rf       installed

Display what package provides the file

You can easily find out what RPM package provides the file. For example find out what provides the /etc/passwd file:

# yum whatprovides /etc/passwd

Sample output:

Loading “installonlyn” plugin

Loading “security” plugin

Setting up repositories

Reading repository metadata in from local files

setup.noarch                             2.5.58-1.el5           base

Matched from:

/etc/passwd

setup.noarch                             2.5.58-1.el5           installed

Matched from:

/etc/passwd

You can use same command to list packages that satisfy dependencies:

# yum whatprovides {dependency-1} {dependency-2}

Refer yum command man page for more information:

# man yum

 

2)      By Local (patch server) repository:

 

Pre requirement for server: Apache web server, rsync and createrepo packages must be installed in the server before starting the whole process.

Server-Side Settings:

Login to the console as root and type the following commands

$ mkdir -p /var/www/html/rhel5/OS

$ mkdir -p /var/www/html/rhel5/updates

Then copy the whole contents of DVD in OS directory, the createrepo.rpm must be installed in the system.

$ createrepo /var/www/html/rhel5/OS

$ cp -r /var/www/html/rhel5/OS/* /var/www/html/rhel5/updates

Now the rsync should be run in a daily cron as

$ rsync -avrt rsync://rhel5.arcticnetwork.ca/rhel5/updates/  \ –exclude=debug/ /var/www/html/rhel5/updates

This will create a complete update repository at /var/www/html/rhel5/updates. The repodata directory will be created with all of the headers. Next I would advise to setup a cron job to run the rsync (above). In this manner your repository keeps updated and only new updates and headers will be downloaded to your repository.

$ /sbin/service httpd start // to start the apache web-server

to check whether the repository is working or not…..first make sure that iptables(firewall) has a rule allowing port 80 (default apache web-server port) to be accessible, if yes, open the web-browser and type

http://server ip-address/rhel5/

 

Client-Side Settings:

On client side, rename the files present in /etc/yum.repos.d which are Base.repo and Media.repo

to *.old and create a new file named localrhel-Base.repo and copy the following in that

# vi /etc/yum.repos.d/localehel-Base.repo

[base]

name=rhel-$releasever – Base

baseurl=http://ReposerverIP/rhel5/$releasever/OS/$basearch/

gpgcheck=0

 

[update]

name=rhel-$releasever – Updates

baseurl=http://ReposerverIP/rhel5/$releasever/updates/$basearch/

gpgcheck=0

enabled=0

Author: VaibhaV Nanoti

Hi, I am VaibhaV Nanoti & Certified with Linux, MCITP & Cisco. I has experience in handling implementation projects related to Linux, windows & Network topology .I have also published several papers globally on Linux, Windows and Network(LAN,MAN,WAN) technology.

One thought on “Patching / Updating Linux Environment by Network repository or Local repository.”

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.