Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Software Install with YUM
#1

1. Overview

 

YUM extends RPM functionality by downloading and installing packages directly from online repositories. As well as all the advantages of RPM, YUM provides a few more handy features:


  • version compatibility: YUM will automatically locate the latest package version on that repo suited to your kernel


  • pre-requisites satisfied: any dependencies are automatically downloaded and installed first - solving that bugbear of "RPM dependency hell"


  • supports local installation: YUM can attempt to install a locally-held RPM package, satisfying pre-requisites online if necessary.


  • package updates: YUM can be instructed to update all installed software with only a few simple commands - or even scheduled to perform this automatically at regular intervals


  • repo index caching: YUM caches an index of repo packages, which can be interrogated to determine repo contents without going online - this can be used to search for packages, or determine what packages provide a required command - or even what are the dependencies for a specific package.


  • repo reports: YUM can report what repos are in effect, which is a bit clearer than trawling through directories of config files.


  • cache management: YUM downloads RPM packages into a cache area prior to installing; a few options to YUM can flush this cache to tidy up after itself




 

2. Basic Commands

 

1. Installing a package: yum install packagename(s), for example:



Code:
# yum install cacti Loaded plugins: refresh-packagekit Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package cacti.noarch 0:0.8.7b-4.fc10 set to be updated --> Processing Dependency: rrdtool for package: cacti --> Processing Dependency: php-snmp for package: cacti --> Processing Dependency: mysql for package: cacti --> Running transaction check ---> Package rrdtool.i386 0:1.3.4-2.fc10 set to be updated --> Processing Dependency: dejavu-lgc-fonts for package: rrdtool ---> Package mysql.i386 0:5.0.67-2.fc10 set to be updated --> Processing Dependency: perl(DBI) for package: mysql ---> Package php-snmp.i386 0:5.2.6-5 set to be updated --> Running transaction check ---> Package perl-DBI.i386 0:1.607-1.fc10 set to be updated ---> Package dejavu-lgc-fonts.noarch 0:2.26-2.fc10 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: cacti noarch 0.8.7b-4.fc10 fedora 1.9 M Installing for dependencies: dejavu-lgc-fonts noarch 2.26-2.fc10 fedora 3.5 M mysql i386 5.0.67-2.fc10 fedora 3.1 M perl-DBI i386 1.607-1.fc10 fedora 776 k php-snmp i386 5.2.6-5 fedora 24 k rrdtool i386 1.3.4-2.fc10 fedora 391 k Transaction Summary ================================================================================ Install 6 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 9.7 M Is this ok [y/N]:




 

From here, just a simple answer of "Y" will begin downloading these six packages then install them automatically.

 

Tip: use the "-y" option on yum to answer "yes" to everything.

 

2. Using yum to install a locally-stored RPM file: yum localinstall rpm-package-file, for instance:



Code:
# yum localinstall wine-2.3.4.5




 

3. Updating a package: yum update packagename, eg:



Code:
# yum update sudo Loaded plugins: refresh-packagekit Setting up Update Process Resolving Dependencies --> Running transaction check ---> Package sudo.i386 0:1.6.9p17-4.fc10 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Updating: sudo i386 1.6.9p17-4.fc10 updates 225 k Transaction Summary ============================================================================= Install 0 Package(s) Update 1 Package(s) Remove 0 Package(s) Total download size: 225 k Is this ok [y/N]:




 

Tip: unlike the -U option to RPM, yum update will not update uninstalled packages. However, yum install will attempt to install a new package, or upgrade an already-installed one - use that option first!

 

4. Listing packages held on a repo: yum list searchterm will use that term as a filter, for example:



Code:
$ yum list yum Loaded plugins: priorities Excluding Packages in global exclude list Finished Installed Packages yum.noarch 3.2.19-3.fc8 installed Available Packages yum.noarch 3.2.20-5.fc8 updates-newkey




Although yum version 3.2.19-3 is currently installed, a newer version (3.2.20-5) is available for updating.

 

5. Searching repos for packages: yum search package-to-search will look for packages matching that search term, eg:



Code:
# yum search sql Loaded plugins: priorities Excluding Packages in global exclude list Finished =================== Matched: sql =========================== dovecot.i386 : Dovecot Secure imap server dovecot-mysql.i386 : MySQL backend for dovecot dovecot-pgsql.i386 : Postgres SQL backend for dovecot dovecot-sqlite.i386 : SQLite backend for dovecot hsqldb.i386 : Hsqldb Database Engine hsqldb-demo.i386 : Demo for hsqldb hsqldb-javadoc.i386 : Javadoc for hsqldb hsqldb-manual.i386 : Manual for hsqldb koffice-kexi-driver-mysql.i386 : Mysql-driver for kexi koffice-kexi-driver-pgsql.i386 : Postresql driver for kexi libgda-mysql.i386 : MySQL provider for libgda libgda-postgres.i386 : PostgreSQL provider for libgda libgda-sqlite.i386 : SQLite provider for libgda




 

6. Showing a package's dependencies: yum deplist packagename will determine what pre-requisites are required to install that package, i.e. if I want to yum-install a package, what others will yum download and install first?



Code:
# yum deplist cacti Loaded plugins: refresh-packagekit Finding dependencies: package: cacti.noarch 0.8.7b-4.fc10 dependency: net-snmp provider: net-snmp.i386 1:5.4.2-3.fc10 provider: net-snmp.i386 1:5.4.2.1-2.fc10 dependency: php-snmp provider: php-snmp.i386 5.2.6-5 dependency: /sbin/service provider: initscripts.i386 8.86-1 dependency: mysql provider: mysql.i386 5.0.67-2.fc10




In this case, installing cacti requires net-snmp, php-snmp and mysql (amongst other packages), as well as the "service" executable, which is provided by installing the initscripts package.

 

7. Finding which package provides a particular command or file: yum provides filename - this is similar to the "search" option mentioned earlier, except it looks for the actual files within the package rather than search against package names themselves, for instance:



Code:
# yum provides "*lokkit" Loaded plugins: refresh-packagekit setuptool-1.19.4-2.fc9.i386 : A text mode system configuration tool Repo : fedora Matched from: Filename : /etc/setuptool.d/99lokkit system-config-firewall-tui-1.2.13-2.fc10.noarch : A text interface for basic : firewall setup Repo : fedora Matched from: Filename : /usr/sbin/lokkit Other : lokkit = 1.7.0




In this case, two packages contain files matching the "lokkit" name - I can pick which package I require, depending upon which file/command I need.

 

8. Uninstalling package: yum erase packagename will attempt to erase a package, showing which other files (dependencies on this package) need to also be removed to prevent orphaned packages.



Code:
# yum erase httpd Loaded plugins: fastestmirror, priorities Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package httpd.i386 0:2.2.3-31.el5.centos set to be erased --> Processing Dependency: httpd-mmn = 20051115 for package: mod_ssl --> Processing Dependency: httpd-mmn = 20051115 for package: mod_perl --> Processing Dependency: httpd-mmn = 20051115 for package: mod_python --> Processing Dependency: httpd-mmn = 20051115 for package: php --> Processing Dependency: webserver for package: webalizer --> Processing Dependency: httpd = 2.2.3-31.el5.centos for package: mod_ssl --> Processing Dependency: httpd for package: system-config-httpd --> Processing Dependency: httpd = 2.2.3-31.el5.centos for package: httpd-manual --> Processing Dependency: httpd >= 2.0.40 for package: mod_python --> Processing Dependency: httpd for package: squirrelmail --> Processing Dependency: httpd for package: squirrelmail --> Running transaction check ---> Package httpd-manual.i386 0:2.2.3-31.el5.centos set to be erased ---> Package mod_perl.i386 0:2.0.4-6.el5 set to be erased ---> Package mod_python.i386 0:3.2.8-3.1 set to be erased ...




In this case, Apache modules that depend on HTTPD installed will also be removed when attempting to remove Apache web server.

 

For more information, use man yum.

 

3. YUM File Locations

1. Config Files:

 

There are several config files for YUM, the main one being /etc/yum.conf which used to contain not only directives affecting YUM's behaviour, but addresses directing YUM to FTP servers.

 

The latter are now located in a /etc/yum/repos.d/ directory, one .repo file per FTP site. On a default install there will probably be the official RedHat repos provided - you may need to manually add additional repos in order to access a wider range of software.

 

To get a quick report on what repos are configured, use yum repolist all:

 



Code:
# yum repolist all Loaded plugins: refresh-packagekit repo id repo name status adobe-linux-i386 Adobe Systems Incorporated enabled: 17 fedora Fedora 10 - i386 enabled: 11,416 fedora-debuginfo Fedora 10 - i386 - Debug disabled fedora-source Fedora 10 - Source disabled fusion Compiz Fusion repository enabled: 48 fusion-source Compiz Fusion repository - source disabled fusion-testing Compiz Fusion repository -testing disabled rawhide Fedora - Rawhide - Developmental packa disabled rawhide-debuginfo Fedora - Rawhide - Debug disabled rawhide-source Fedora - Rawhide - Source disabled updates Fedora 10 - i386 - Updates enabled: 3,104 updates-debuginfo Fedora 10 - i386 - Updates - Debug disabled updates-source Fedora 10 - Updates Source disabled updates-testing Fedora 10 - i386 - Test Updates disabled repolist: 14,585




 

Use yum repolist enabled (or just yum repolist) to show only those in effect (enabled).

 

2. Cache Directories:

 

YUM usually downloads RPM files somewhere under the /var/cache/yum/ directory containing cache subdirectories per repo, holding RPM files and repo metadata. Usually you won't need to worry about this area - but if something goes wrong mid-yum it can be worthwhile dropping into those directories and manually (using rpm) installing some of the packages that have been downloaded, rather than re-download the entire lot again.

 

To clean out any cached files, use yum clean packages

 

3. Other Considerations


  • outdated header files: since YUM caches repo headers locally, these files could contain incorrect information. Use yum clean headers to flush this information out first.


  • flushing caches: if yum STILL seems to be ignoring config files and insists on using older information, use yum clean all to purge yum of cached packages, headers etc - then try again.


  • automatic package updates: the yum-updatesd service (yum-updates-daemon) can keep packages automatically updated - checking, downloading and installing without any manual intervention, rather like Windows Updates. However, some problems may be encountered on production servers with unchecked newer software being upgraded without any testing or evaluation, breaking an already-running system (dovecot - I'm looking at YOU!). For that reason, many admins prefer to set their updates to "notify" rather than automatically upgrade: check the /etc/yum/yum-updatesd.conf file for details on modifying yum-updatesd behaviour




Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)