Welcome to my site. Please CLICK HERE to give your opinions regarding this new look of "PCTipsbyAnu". Thanks for visiting.

Saturday, September 11, 2010

Browse » Home » , , , , » How to configure YUM so that it can work as APT-GET or CNF?

How to configure YUM so that it can work as APT-GET or CNF?




YUM (Yellowdog Updater, Modified) is a client command lineapplication for updating an RPM based system from an internetrepository (YUM "yum-arch" server) accessible by URL (http://xxx, ftp://yyy or even file://zzz local or NFS).The YUM repository has a directory of the headers with RPM info and directory path information.YUM will resolve RPM package dependencies and manage the importation and installation of dependencies.
YUM is also capable of upgrading across releases.




YUM config file: /etc/yum.conf (Fedora Core 3)
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1
exclude=firefox mozplugger gftp

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
You may list packages you wish NOT to update (Space delimited list. '*' wildcards allowed.): exclude=package-name
(i.e. On x86_64 I do not update firefox or mozplugger with the 64 bitversion, I use the 32 bit version so that 32 bit plugins will work.)
Set "gpgcheck=0" to avoid the signature check.
For the option "gpgcheck=1" to work,use the "rpm --import GPG-KEY commands as detailed
 
above in section one of the RPM tutorial.
[root@server2 ~]# rpm --import /usr/share/rhn/RPM-GPG-KEY
[root@server2 ~]# rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora
File: /etc/yum.repos.d/fedora.repo (Fedora Core 3)
[base]
name=Fedora Core $releasever - $basearch - Base
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/
mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-$releasever
enabled=1
gpgcheck=1
Mirror site/sites which contain Fedora base configuration RPM's.
Other protocols such as ftp can be used as well as http.
File: /etc/yum.repos.d/fedora-updates.repo (Fedora Core 3)
[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/
mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc$releasever
enabled=1
gpgcheck=1
Mirror site which contain Fedora updated RPM's.
List of mirrors: http://fedora.redhat.com/download/mirrors.html
Terms:
  • releasever: Release Version - current version of Fedora.
  • basearch: Base Architecture - system hardware architecture i.e. i386
Add other repositories: (not included in default install)
  • Fedora Extras:
    Create file: /etc/yum.repos.d/extras.repo
    [extras]
    name=Fedora Extras $releasever - $basearch
    baseurl=http://mirrors.kernel.org/fedora/extras/$releasever/$basearch/
    http://www.mirrorservice.org/sites/download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/
    http://fr2.rpmfind.net/linux/fedora/extras/$releasever/$basearch/
    gpgcheck=1
    Adding FreshRPM GPG signature key:
    [root@server2 ~]# rpm --import http://download.fedora.redhat.com/pub/fedora/linux/extras/RPM-GPG-KEY-Fedora-Extras

  • Add FreshRPM repository site to your list for downloads of non-standard Fedora software.
    (Software not released by Red Hat like DVD players, audio encoders/rippers, etc)
    Create file: /etc/yum.repos.d/freshrpms.repo
    [freshrpms]
    name=Fedora Linux $releasever - $basearch - freshrpms
    baseurl=http://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/freshrpms
    enabled=0
    gpgcheck=1
    To directly enable a particular repository which is currently disabled (enabled=0): yum -y --enablerepo=freshrpms install kino Adding FreshRPM GPG signature key:

    [root@server2 ~]# rpm --importhttp://freshrpms.net/packages/builds/yum/RPM-GPG-KEY.freshrpms
    More examples of FreshRPMs yum.conf
  • Add: dag.wieers.com
    Create file: /etc/yum.repos.d/dag.repo
    [dag]
    name=Dag APT Repository
    baseurl=http://dag.freshrpms.net/fedora/$releasever/en/$basearch/dag/
    http://dag.atrpms.net/fedora/$releasever/en/$basearch/dag/
    http://ftp.heanet.ie/pub/freshrpms/pub/dag/fedora/$releasever/en/$basearch/dag/
    enabled=0
    gpgcheck=1
    Directly enable repository: yum -y --enablerepo=dag install fortune-oneliners 
  • Adding dag GPG signature key:
    [root@server2 ~]# rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt

  • Add: Macromedia.mplug.org
    Create file: /etc/yum.repos.d/flash.repo
    [flash]
    name=Macromedia Flash plugin
    baseurl=http://macromedia.mplug.org/apt/fedora/$releasever
    http://sluglug.ucsc.edu/macromedia/apt/fedora/$releasever
    http://ruslug.rutgers.edu/macromedia/apt/fedora/$releasever
    http://macromedia.rediris.es/apt/fedora/$releasever
    enabled=0
    #gpgcheck=1
    To directly enable a particular repository which is currently disabled (enabled=0): yum -y --enablerepo=flash install flash-plugin
  • Fedora examples (more repositories: Jpackage, ...)


Registering Red Hat Enterprise Linux to enable YUM repository use:
Commands:
  • rhn_register: GUI to enter user account and "Installation Number". Must purchase a license to get this.
  • rhnreg_ks: Register a login/user account
Data is stored in /etc/sysconfig/rhn/

Using YUM and YUM examples:
  • Update:
    • List packages which will be updated: yum check-update
      (Does not perform an update)
    • Update all packages on your system: yum update
    • Update a package: yum update package-name
    • Update all with same prefix: yum update package-name-prefix\*
      This command will update your system. It will interactively ask permission.i.e. "Is this ok [y/N]:"
    • To avoid the prompt/questions use the command: yum -y update Sample session:
      # yum -y update
      Setting up Update Process
      Setting up Repos
      base 100% |=========================| 1.1 kB 00:00
      updates-released 100% |=========================| 951 B 00:00
      Reading repository metadata in from local files
      base : ################################################## 2852/2852
      primary.xml.gz 100% |=========================| 367 kB 00:02
      MD Read : ################################################## 927/927
      updates-re: ################################################## 927/927
      Excluding Packages in global exclude list
      Finished
      Resolving Dependencies
      --> Populating transaction set with selected packages. Please wait.
      ---> Downloading header for mod_dav_svn to pack into transaction set.
      mod_dav_svn-1.1.4-1.1.x86 100% |=========================| 8.9 kB 00:00
      ---> Package mod_dav_svn.x86_64 0:1.1.4-1.1 set to be updated
      ---> Downloading header for initscripts to pack into transaction set.
      initscripts-7.93.7-1.x86_ 100% |=========================| 87 kB 00:00
      ---> Package initscripts.x86_64 0:7.93.7-1 set to be updated
      ---> Downloading header for gtk2 to pack into transaction set.
      ...
      ...

      --> Running transaction check

      Dependencies Resolved
      Transaction Listing:
      Install: aqhbci.x86_64 0:1.0.2beta-0.fc3 - updates-released
      Install: aqhbci-devel.x86_64 0:1.0.2beta-0.fc3 - updates-released
      Install: kernel.x86_64 0:2.6.11-1.14_FC3 - updates-released
      ...
      ...

      Performing the following to resolve dependencies:
      Install: aqbanking-devel.x86_64 0:1.0.4beta-0.fc3 - updates-released
      Install: gwenhywfar-devel.x86_64 0:1.7.2-0.fc3 - updates-released
      Total download size: 431 M
      Downloading Packages:
      (1/168): mod_dav_svn-1.1. 100% |=========================| 54 kB 00:00
      (2/168): initscripts-7.93 100% |=========================| 1.1 MB 00:03
      ...
      ...

      Running Transaction Test
      Finished Transaction Test
      Transaction Test Succeeded
      Running Transaction
      Updating: libgcc 100 % done 1/333
      Updating: libgcc 100 % done 2/333
      ...
      ...
      Completing update for mod_dav_svn - 169/333
      Completing update for initscripts - 170/333
      Completing update for gtk2 - 171/333
      ...
      ...
      Installed: aqhbci.x86_64 0:1.0.2beta-0.fc3 aqhbci-devel.x86_64 0:1.0.2beta-0.fc3 kernel.x86_64 0:2.6.11...
      Dependency Installed: aqbanking-devel.x86_64 0:1.0.4beta-0.fc3 gwenhywfar-devel.x86_64 0:1.7.2-0.fc3
      Updated: ImageMagick.i386 0:6.2.0.7-2.fc3 ImageMagick.x86_64 0:6.2.0.7-2.fc3 ImageMagick-c++.i386 ...
      ...
      ...
      Obsoleted: openhbci.x86_64 0:0.9.17-1 openhbci.i386 0:0.9.17-1 openhbci-devel.x86_64 0:0.9.17-1
      Complete!
      #
      [Potential Pitfall]: Many times I have found that I can get the following errors:

      Setting up Update Process
      Setting up repositories
      Reading repository metadata in from local files
      Could not find update match for package-name
      ...
      ...
      --> Finished Dependency Resolution
      Error: Missing Dependency: package-name
      I find that the error is traced to having two version of a packageinstalled at once. The following command will reveal if this is true: rpm -q package-name.If there are two versions of the same package installed, I find thatremoving the newer version and re-running YUM to install an upgradegets past these errors.
  • To install a single package: yum -y install package-name
    This will also resolve package dependencies.
  • Remove a package: yum remove package-name
  • Info:
    • List available packages, version and state (base, installed, updates-released): yum list
    • List the packages installed which are not available in repository listed in config file: yum list extras
    • List packages which are obsoleted by packages in yum repository: yum list obsoletes
  • Clean local cache of headers and RPM's: yum clean all
    (See: /var/cache/yum/)
Yum Commands:
YUM Command Description
yum -y install package-name
Install package.
yum -y install package-name.arch
Install package of specified architecture. This is common when installing Firefox "i386" on a "x86_64" platform.
i.e.: yum -y install firefox.i386
yum -y update package-name
yum -y update
yum -y --exclude=package-name update
Update package.
Update all packages on system for which updates are available.
Update all packages which have available updates excluding the specified package.
yum remove package-name
yum remove package-name-1 package-name
yum remove package-name-2
Remove package.
Remove packages.
yum clean headers
yum clean cache
yum clean all
Remove RPM header files.
Remove files from YUM cache: /var/cache/yum/
Clean up all YUM files left over from previous installations.
yum list package-name
yum list regex
Listinformation about available packages from configured YUM repository.Will also list those which contain the specified regular expressionsearch pattern.
yum list installed [regex-optional]
List installed packages. Same as rpm -qa
yum list available [regex-optional]
List all available packages.
yum check-update
Show which packages are available to be updated.
yum search partial-package-name
List all packages which match the string specied in the package name or description.
yum grouplist
yum groupinstall group-name
yum groupremove group-name
yum groupupdate group-name
List available package groups.
Install default packages in specified group.
Remove packages in group.
Update packages in group.
rhn_register
Register to a Red Hat Network hosted server. Typically useful for licensed Red Hat Enterprise Linux.
See yum man page for a full listing of commands and command arguments.
Notes:
  • yum man page
  • yum.conf man page
  • You can set up your own YUM server for your own cluster or intranet. Set up a web server with the same paths as used in the configuration files and point your configuration files to your server. See YoLinux web server tutorial for configuration information.
  • Fedora configures YUM as a daily cron job: /etc/cron.daily/yum.cron
    #!/bin/sh

    if [ -f /var/lock/subsys/yum ]; then
    /usr/bin/yum -R 10 -e 0 -d 0 -y update yum
    /usr/bin/yum -R 120 -e 0 -d 0 -y update
    fi
Links:


YumEx: (Yum Extender) GUI interface to YUM commands and configuration
YumEx will allow you to manage the RPM packages on your system. It allowsthe administrator to install/update packages from internet repositoriesas well as un-install RPMs from the system.

 







THANKS  :)



You can leave a response, or trackback from your own site.

About 'Anu': My name is 'Anu' also Known as 'ANU 007 TIGER' .I'm administrator of 'PC Tips by Anu' blog .This blog was opened for sharing contents about hacking n cracking.
Thanks YAHOO OR GMAIL

0 comments:

Post a Comment

 
Back to Top