Wednesday, November 16, 2011

RPM Package Management


TARGETS
è Installation , Upgration and remove RPM (red hat packet management)
è Installation , Upgration and remove YUM
è Management of  RPM & YUM packets

RPM PACKAGE  MANAGEMENT
The main RPM components are
            Local database, rpm and related executables, rpm frontends such as yum, package files.
Local database:-
            The local RPM database is maintained in /var/lib/rpm. The database stores information about installed packages such file attributes and package prerequisites.
RPM and related executables:-
            Software to be installed using rpm is distributed through rpm package files. In general the basic syntax for rpm packages are
                                           softwarepackage.rpm
rpm is a backend for other programs such as yum or system-config-packages.
THE PRIMARY FUNCTIONS IN RPM’s:-
            Install, upgrade, remove, query, verify.
Install:
For installing new rpm into your system use the below command:
    Syntax:             rpm -ivh package_name.rpm
          EX:             rpm –ivh zip-2.3-8.i386.rpm

Upgrade:
For updating an existing rpm into your system use the below command:
    Syntax:            rpm  -Uvh   package_name.rpm
          EX:      rpm  -Uvh   zip-2.3-8.i386.rpm
Remove:        
For removing an existing rpm into your system use the below command:
     Syntax:            rpm  -e  package_name
           EX:            rpm  -ivh  package_name
Verify:
   Used to check the package is installed or not.
      Syntax:          rpm  -q  package_name
                  EX:          rpm  –q zip-2.3-8.i386.rpm
Query:
   Used to check the all installed packages.
       Syntax:           rpm -qa 
                   EX:           rpm –qa                                             
RPM VERIFICATION
Verification of an installed packages compares like file size, permission , owner , group , MD5 checksum, and modification time against the RPM database
The basic RPM verification options are
 --To verify the installed zip rpm against the RPM database
         Syntax:         rpm  -V  packagename
               EX:         rpm  -V  zip
--To verify all installed RPMS against the RPM database
  Syntax:          rpm  -Va
--To verify the installed zip package against zip package file
  Syntax:          rpm  -Vp  package_name.rpm
        EX:          rpm  -Vp zip-2.3-8.i386.rpm


YUM (YELLOW DOG UPDATE, MODIFIED)

To solve the problem of dependency resolution and package location ,we have YUM. The yum application can call upon several repositories for dependency resolution, fetch the RPMs, and install the needed packages. The main disadvantage of rpm command is it requires the dependencies to be resolved manual it cannot call upon repositories automatically.


The Primary Functions in YUM’s:-
           Install, update, and remove.
Install:
For installing new rpm into your system use the below command:
   Syntax:         yum  install  packagename
         EX:         yum  install  media player
Update:
For updating an existing rpm into your system use the below command:
    Syntax:        yum update  packagename
          EX:        yum update  media player
Remove:
For removing an existing rpm into your system use the below command
    Syntax:        yum   remove  packagename
          EX:        yum   remove  media player

The primary function for searching   yum packages/files :
      Search, list, info, what provides.
--To search a installed package
                Syntax:          yum search  packagename
                     EX:           yum search   firefox   
--To know the all installed packages
          Syntax:                    yum  list
--To search the package database for a package & displays the info. about it
          Syntax:          yum   info firefox
YUM Installation on Server Side
Step by Step Procedure for Server Side:
1. cp all rpms to /var/ftp/pub/rpm
2. Install rpm -ivh createrepo-0.4.4-2.fc6.noarch.rpm
3. Execute repository creating command:
                         #createrepo /var/ftp/pub/rpm/
        Takes Some times for creating repository
YUM Installation on Client Side
1. vim /etc/yum.repos.d/open.repo           (Any Name with .repo for your reference only)
        name=opensourcerepo                                             # Any Friendly name can be given
        baseurl=ftp://123.236.153.248/pub/rpm                # Set the Server ipaddress with your                                                                                                                       repository path
        gpgcheck=1      # Key Verification Enabled
        enabled=1       # yum Enabled for this client
        gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Examples on YUM:
1. To know whether the package is installed properly or not
#[root@ns1 ~]# yum list openldap
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
RHN support will be disabled.
Setting up repositories
Reading repository metadata in from local files
Installed Packages
openldap.i386                            2.3.27-5               installed     
2. To remove any installed package
#[root@ns1 ~]# yum remove openssh
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Remove Process
Resolving Dependencies
            --> Populating transaction set with selected packages. Please wait.
            --> Package openssh.i386 0:4.3p2-16.el5 set to be erased
            --> Running transaction check
            Setting up repositories
            Reading repository metadata in from local files
            --> Processing Dependency: openssh = 4.3p2-16.el5 for package: openssh-server
            --> Processing Dependency: openssh = 4.3p2-16.el5 for package: openssh-askpass
            --> Processing Dependency: openssh = 4.3p2-16.el5 for package: openssh-clients
            --> Restarting Dependency Resolution with new changes.
            --> Populating transaction set with selected packages. Please wait.
            --> Package openssh-clients.i386 0:4.3p2-16.el5 set to be erased
            --> Package openssh-server.i386 0:4.3p2-16.el5 set to be erased
            --> Package openssh-askpass.i386 0:4.3p2-16.el5 set to be erased
            -->Running transaction check
            Dependencies Resolved
===============================================================
 Package                 Arch       Version          Repository        Size
===============================================================
Removing:
 openssh                 i386       4.3p2-16.el5     installed           714 k
Removing for dependencies:
 openssh-askpass     i386       4.3p2-16.el5     installed         9.8 k
 openssh-clients       i386       4.3p2-16.el5     installed         811 k
 openssh-server        i386       4.3p2-16.el5     installed         447 k

Transaction Summary
===============================================================
Install      0 Package(s)
Update       0 Package(s)
Remove       4 Package(s)
Is this ok [y/N]: y     # Click "y" to remove
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Removing  : openssh-clients              ######################### [1/4]
  Removing  : openssh                          ######################### [2/4]
  Removing  : openssh-server               ######################### [3/4]
  Removing  : openssh-askpass             ######################### [4/4]
Removed: openssh.i386 0:4.3p2-16.el5
Dependency Removed: openssh-askpass.i386 0:4.3p2-16.el5 openssh-clients.i386 0:4.3p2-16.el5 openssh-server.i386 0:4.3p2-16.el5
Complete!





No comments:

Post a Comment