SlideShare uma empresa Scribd logo
1 de 5
Baixar para ler offline
YUM (Yellowdog Updater Modified)
Yellowdog Update, Modified (YUM)is a package manager that was developed by Duke University
to improve the installation of RPMs. yumsearches numerous repositories for packages and their
dependencies so they may be installed together in an effort to alleviate dependency issues. Red Hat
Enterprise Linux 5.2 uses yumto fetch packages and install RPMs.
up2date is now deprecated in favor of yum(Yellowdog Updater Modified). The entire stack of tools
which installs and updates software in Red Hat Enterprise Linux 5.2 is now based on yum. This
includes everything, from the initial installation via Anaconda to host software management tools like
pirut.
yumalso allows system administrators to configure a local (i.e. available over a local network)
repository to supplement packages provided by Red Hat. This is useful for user groups that use
applications and packages that are not officiallysupported by Red Hat.
Aside from being able to supplement available packages for local users, using a local yum repository
also saves bandwidth for the entire network. Further, clients that use local yumrepositories do not
need to be registered individually to install or update the latest packages from Red Hat Network.
12.1. Setting Up a Yum Repository
To set up a repository for Red Hat Enterprise Linux packages, follow these steps:
1. Install the createrepo package:
~]# yum install createrepo
2. Copy all the packages you want to provide in the repository into one directory (/mnt/
local_repo for example).
3. Run createrepo on that directory (for example, createrepo /mnt/local_repo). This will
create the necessary metadata for your Yum repository.
12.2. yum Commands
yumcommands are typically run as yum <command> <package name/s> . By default, yum will
automatically attempt to check all configured repositories to resolve all package dependencies during
an installation/upgrade.
The following is a list of the most commonly-used yum commands. For a complete list of available yum
commands, refer to man yum.
yum install <package name/s>
Used to install the latest version of a package or group of packages. If no package matches the
specified package name(s), they are assumed to be a shell glob, and any matches are then
installed.
yum update <package name/s>
Used to update the specified packages to the latest available version. If no package name/s are
specified, then yum will attempt to update all installed packages.
[main] Options
152
If the --obsoletes option is used (i.e. yum --obsoletes <package name/s> , yum will
process obsolete packages. As such, packages that are obsoleted accross updates will be
removed and replaced accordingly.
yum check-update
This command allows you to determine whether any updates are available for your installed
packages. yum returns a list of all package updates from all repositories if any are available.
yum remove <package name/s>
Used to remove specified packages, along with any other packages dependent on the packages
being removed.
yum provides <file name>
Used to determine which packages provide a specific file or feature.
yum search <keyword>
This command is used to find any packages containing the specified keyword in the description,
summary, packager and package name fields of RPMs in all repositories.
yum localinstall <absolute path to package name/s>
Used when using yumto install a package located locally in the machine.
12.3. yum Options
yumoptions are typically stated before specific yum commands; i.e. yum <options> <command>
<package name/s> . Most of these options can be set as default using the configuration file.
The following is a list of the most commonly-used yumoptions. For a complete list of available yum
options, refer to man yum.
-y
Answer "yes" to every question in the transaction.
-t
Sets yumto be "tolerant" of errors with regard to packages specified in the transaction. For
example, if you run yum update package1 package2 and package2 is already installed, yum
will continue to install package1.
--exclude=<package name>
Excludes a specific package by name or glob in a specific transaction.
12.4. Configuring yum
By default, yumis configured through /etc/yum.conf. The following is an example of a typical /
etc/yum.conf file:
[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
[main] Options
153
obsoletes=1
gpgcheck=1
plugins=1
metadata_expire=1800
[myrepo]
name=RHEL 5 $releasever - $basearch
baseurl=http://local/path/to/yum/repository/
enabled=1
A typical /etc/yum.conf file is made up of two types of sections: a [main] section, and a
repository section. There can only be one [main] section, but you can specify multiple repositories in
a single /etc/yum.conf.
12.4.1. [main] Options
The [main] section is mandatory, and there must only be one. For a complete list of options you can
use in the [main] section, refer to man yum.conf.
The following is a list of the most commonly-used options in the [main] section.
cachedir
This option specifies the directory where yumshould store its cache and database files. By default,
the cache directory of yumis /var/cache/yum.
keepcache=<1 or 0>
Setting keepcache=1 instructs yumto keep the cache of headers and packages after a
successful installation. keepcache=1 is the default.
reposdir=<absolute path to directory of .repo files>
This option allows you to specify a directory where .repo files are located. .repo files contain
repository information (similar to the [repository] section of /etc/yum.conf).
yumcollects all repository information from .repo files and the [repository] section of the
/etc/yum.conf file to create a master list of repositories to use for each transaction. Refer to
Sección 12.4.2, “ [repository] Options” for more information about options you can use for
both the [repository] section and .repo files.
If reposdir is not set, yumuses the default directory /etc/yum.repos.d.
gpgcheck=<1 or 0>
This disables/enables GPG signature checking on packages on all repositories, including local
package installation. The default is gpgcheck=0, which disables GPG checking.
If this option is set in the [main] section of the /etc/yum.conf file, it sets the GPG checking
rule for all repositories. However, you can also set this on individual repositories instead; i.e., you
can enable GPG checking on one repository while disabling it on another.
assumeyes=<1 or 0>
This determines whether or not yumshould prompt for confirmation of critical actions. The default
if assumeyes=0, which means yum will prompt you for confirmation.
If assumeyes=1 is set, yumbehaves in the same way that the command line option -y does.
tolerant=<1 or 0>
When enabled (tolerant=1), yum will be tolerant of errors on the command line with regard to
packages. This is similar to the yumcommand line option -t.
[main] Options
154
The default value for this is tolerant=0 (not tolerant).
exclude=<package name/s>
This option allows you to exclude packages by keyword during installation/updates. If you are
specifying multiple packages, this is a space-delimited list. Shell globs using wildcards (for
example, * and ?) are allowed.
retries=<number of retries>
This sets the number of times yumshould attempt to retrieve a file before returning an error.
Setting this to 0 makes yum retry forever. The default value is 6.
12.4.2. [repository] Options
The [repository] section of the /etc/yum.conf file contains information about a repository
yumcan use to find packages during package installation, updating and dependency resolution. A
repository entry takes the following form:
[repository ID]
name=repository name
baseurl=url, file or ftp://path to repository
You can also specify repository information in a separate .repo files (for example, rhel5.repo). The
format of repository information placed in .repo files is identical with the [repository] of /etc/
yum.conf.
.repo files are typically placed in /etc/yum.repos.d, unless you specify a different repository path
in the [main] section of /etc/yum.conf with reposdir=. .repo files and the /etc/yum.conf
file can contain multiple repository entries.
Each repository entry consists of the following mandatory parts:
[repository ID]
The repository ID is a unique, one-word string that serves as a repository identifier.
name=repository name
This is a human-readable string describing the repository.
baseurl=http, file or ftp://path
This is a URL to the directory where the repodatadirectory of a repository is located. If the
repository is local to the machine, use baseurl=file://path to local repository . If
the repository is located online using HTTP, use baseurl=http://link . If the repository is
online and uses FTP, use baseurl=ftp://link .
If a specific online repository requires basic HTTP authentication, you can specify your username
and password in the baseurl line by prepending it as username:password@link. For
example, if a repository on http://www.example.com/repo/ requires a username of "user" and
a password os "password", then the baseurl link can be specified as baseurl=http://
user:password@www.example.com/repo/.
The following is a list of options most commonly used in repository entries. For a complete list of
repository entries, refer to man yum.conf.
155
Useful yumVariables
gpgcheck=<1 or 0>
This disables/enables GPG signature checking a specific repository. The default is
gpgcheck=0, which disables GPG checking.
gpgkey=URL
This option allows you to point to a URL of the ASCII-armoured GPG key file for a
repository. This option is normally used if yumneeds a public key to verify a package and
the required key was not imported into the RPM database.
If this option is set, yum will automatically import the key from the specified URL. You
will be prompted before the key is installed unless you set assumeyes=1 (in the
[main] section of / etc/yum.conf) or -y (in a yumtransaction).
exclude=<package name/s>
This option is similar to the exclude option in the [main] section of /etc/yum.conf.
However, it only applies to the repository in which it is specified.
includepkgs=<package name/s>
This option is the opposite of exclude. When this option is set on a repository, yum will
only be able to see the specified packages in that repository. By default, all packages in
a repository are visible to yum.
12.5. Useful yum Variables
The following is a list of variables you can use for both yumcommands and yum configuration
files (i.e.
/etc/yum.conf and .repo files).
$releasever
This is replaced with the package's version, as listed in distroverpkg. This
defaults to the version of the redhat-release package.
$arch
This is replaced with your system's architecture, as listed by os.uname() in Python.
$basearch
This is replaced with your base architecture. For example, if $arch=i686 then
$basearch=i386.
$YUM0-9
This is replaced with the value of the shell environment variable of the same name. If
the shell environment variable does not exist, then the configuration file variable will
not be replaced.

Mais conteúdo relacionado

Mais procurados

Basic - Oracle Edition Based Redefinition Presentation
Basic - Oracle Edition Based Redefinition PresentationBasic - Oracle Edition Based Redefinition Presentation
Basic - Oracle Edition Based Redefinition PresentationN/A
 
Building File Systems with FUSE
Building File Systems with FUSEBuilding File Systems with FUSE
Building File Systems with FUSEelliando dias
 
L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5William Lee
 
Rman workshop short
Rman workshop shortRman workshop short
Rman workshop shortNabi Abdul
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Martijn Verburg
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testingGaruda Trainings
 
Linux command line cheatsheet
Linux command line cheatsheetLinux command line cheatsheet
Linux command line cheatsheetWe Ihaveapc
 
Linux Basic Administration Commands Guide
Linux Basic Administration Commands GuideLinux Basic Administration Commands Guide
Linux Basic Administration Commands GuideVCP Muthukrishna
 
Most frequently used unix commands for database administrator
Most frequently used unix commands for database administratorMost frequently used unix commands for database administrator
Most frequently used unix commands for database administratorDinesh jaisankar
 
Scripts related to temp tablespace
Scripts related to temp tablespaceScripts related to temp tablespace
Scripts related to temp tablespaceSoumya Das
 
MySql Restore Script
MySql Restore ScriptMySql Restore Script
MySql Restore ScriptHızlan ERPAK
 
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is bootedVmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is bootedAdrian Huang
 
Decompressed vmlinux: linux kernel initialization from page table configurati...
Decompressed vmlinux: linux kernel initialization from page table configurati...Decompressed vmlinux: linux kernel initialization from page table configurati...
Decompressed vmlinux: linux kernel initialization from page table configurati...Adrian Huang
 
Asm disk group migration from
Asm disk group migration from Asm disk group migration from
Asm disk group migration from Anar Godjaev
 
Content server installation guide
Content server installation guideContent server installation guide
Content server installation guideNaveed Bashir
 

Mais procurados (18)

Basic - Oracle Edition Based Redefinition Presentation
Basic - Oracle Edition Based Redefinition PresentationBasic - Oracle Edition Based Redefinition Presentation
Basic - Oracle Edition Based Redefinition Presentation
 
Building File Systems with FUSE
Building File Systems with FUSEBuilding File Systems with FUSE
Building File Systems with FUSE
 
L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5
 
Mancoosi
MancoosiMancoosi
Mancoosi
 
Rman workshop short
Rman workshop shortRman workshop short
Rman workshop short
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testing
 
Linux command line cheatsheet
Linux command line cheatsheetLinux command line cheatsheet
Linux command line cheatsheet
 
9i lin relnotes
9i lin relnotes9i lin relnotes
9i lin relnotes
 
Ass OS
Ass OSAss OS
Ass OS
 
Linux Basic Administration Commands Guide
Linux Basic Administration Commands GuideLinux Basic Administration Commands Guide
Linux Basic Administration Commands Guide
 
Most frequently used unix commands for database administrator
Most frequently used unix commands for database administratorMost frequently used unix commands for database administrator
Most frequently used unix commands for database administrator
 
Scripts related to temp tablespace
Scripts related to temp tablespaceScripts related to temp tablespace
Scripts related to temp tablespace
 
MySql Restore Script
MySql Restore ScriptMySql Restore Script
MySql Restore Script
 
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is bootedVmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
 
Decompressed vmlinux: linux kernel initialization from page table configurati...
Decompressed vmlinux: linux kernel initialization from page table configurati...Decompressed vmlinux: linux kernel initialization from page table configurati...
Decompressed vmlinux: linux kernel initialization from page table configurati...
 
Asm disk group migration from
Asm disk group migration from Asm disk group migration from
Asm disk group migration from
 
Content server installation guide
Content server installation guideContent server installation guide
Content server installation guide
 

Destaque (8)

28 configuración de la fecha y hora
28  configuración de la fecha y hora28  configuración de la fecha y hora
28 configuración de la fecha y hora
 
13 red hat network
13  red hat network13  red hat network
13 red hat network
 
35 archivos de registro
35  archivos de registro35  archivos de registro
35 archivos de registro
 
21 protocolo de configuración dinámica de hosts dhcp
21  protocolo de configuración dinámica de hosts dhcp21  protocolo de configuración dinámica de hosts dhcp
21 protocolo de configuración dinámica de hosts dhcp
 
26 configuración del sistema
26  configuración del sistema26  configuración del sistema
26 configuración del sistema
 
10 administración de paquetes rpm
10  administración de paquetes rpm10  administración de paquetes rpm
10 administración de paquetes rpm
 
25 protocolo ligero de acceso a directorios ldap
25  protocolo ligero de acceso a directorios ldap25  protocolo ligero de acceso a directorios ldap
25 protocolo ligero de acceso a directorios ldap
 
8 access control lists
8  access control lists8  access control lists
8 access control lists
 

Semelhante a 12 yum

Yum package manager
Yum package managerYum package manager
Yum package managerLinuxConcept
 
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package managementAcácio Oliveira
 
Software management in linux
Software management in linuxSoftware management in linux
Software management in linuxnejadmand
 
Hadoop installation and Running KMeans Clustering with MapReduce Program on H...
Hadoop installation and Running KMeans Clustering with MapReduce Program on H...Hadoop installation and Running KMeans Clustering with MapReduce Program on H...
Hadoop installation and Running KMeans Clustering with MapReduce Program on H...Titus Damaiyanti
 
Linux packege manager
Linux packege managerLinux packege manager
Linux packege managerInfoExcavator
 
package mangement
package mangementpackage mangement
package mangementARYA TM
 
Hadoop single node installation on ubuntu 14
Hadoop single node installation on ubuntu 14Hadoop single node installation on ubuntu 14
Hadoop single node installation on ubuntu 14jijukjoseph
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinuxtutorialsruby
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinuxtutorialsruby
 

Semelhante a 12 yum (20)

Yum package manager
Yum package managerYum package manager
Yum package manager
 
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
 
Software management in linux
Software management in linuxSoftware management in linux
Software management in linux
 
Hadoop installation and Running KMeans Clustering with MapReduce Program on H...
Hadoop installation and Running KMeans Clustering with MapReduce Program on H...Hadoop installation and Running KMeans Clustering with MapReduce Program on H...
Hadoop installation and Running KMeans Clustering with MapReduce Program on H...
 
How To List YUM Packages
How To List YUM PackagesHow To List YUM Packages
How To List YUM Packages
 
Linux packege manager
Linux packege managerLinux packege manager
Linux packege manager
 
Linux packege manager
Linux packege managerLinux packege manager
Linux packege manager
 
RPM (LINUX)
RPM (LINUX)RPM (LINUX)
RPM (LINUX)
 
Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
 
package mangement
package mangementpackage mangement
package mangement
 
Backup and recovery
Backup and recoveryBackup and recovery
Backup and recovery
 
Linux file
Linux fileLinux file
Linux file
 
CSV to XML Converter
CSV to XML ConverterCSV to XML Converter
CSV to XML Converter
 
Centos config
Centos configCentos config
Centos config
 
Hadoop single node installation on ubuntu 14
Hadoop single node installation on ubuntu 14Hadoop single node installation on ubuntu 14
Hadoop single node installation on ubuntu 14
 
Apache solr configuration with drupal 7
Apache solr configuration with drupal 7Apache solr configuration with drupal 7
Apache solr configuration with drupal 7
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinux
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinux
 
Hadoop completereference
Hadoop completereferenceHadoop completereference
Hadoop completereference
 
Unix Administration 2
Unix Administration 2Unix Administration 2
Unix Administration 2
 

Mais de josemanuelacostarendon

31 configuración del sistema x window
31  configuración del sistema x window31  configuración del sistema x window
31 configuración del sistema x windowjosemanuelacostarendon
 
14 configuración relacionada a la red
14  configuración relacionada a la red14  configuración relacionada a la red
14 configuración relacionada a la redjosemanuelacostarendon
 
6 gestión del almacenamiento en disco
6  gestión del almacenamiento en disco6  gestión del almacenamiento en disco
6 gestión del almacenamiento en discojosemanuelacostarendon
 
4 array redundante de discos independientes
4  array redundante de discos independientes4  array redundante de discos independientes
4 array redundante de discos independientesjosemanuelacostarendon
 

Mais de josemanuelacostarendon (20)

33 configuración de la impresora
33  configuración de la impresora33  configuración de la impresora
33 configuración de la impresora
 
32 usuarios y grupos
32  usuarios y grupos32  usuarios y grupos
32 usuarios y grupos
 
31 configuración del sistema x window
31  configuración del sistema x window31  configuración del sistema x window
31 configuración del sistema x window
 
30 el sistema x window
30  el sistema x window30  el sistema x window
30 el sistema x window
 
29 configuración del teclado
29  configuración del teclado29  configuración del teclado
29 configuración del teclado
 
24 correo electrónico
24  correo electrónico24  correo electrónico
24 correo electrónico
 
22 apache http server
22  apache http server22  apache http server
22 apache http server
 
17 berkeley internet name domain
17  berkeley internet name  domain17  berkeley internet name  domain
17 berkeley internet name domain
 
16 control de acceso a servicios
16  control de acceso a servicios16  control de acceso a servicios
16 control de acceso a servicios
 
15 configuración de la red
15  configuración de la red15  configuración de la red
15 configuración de la red
 
14 configuración relacionada a la red
14  configuración relacionada a la red14  configuración relacionada a la red
14 configuración relacionada a la red
 
11 package management tool
11  package management tool11  package management tool
11 package management tool
 
9 lvm
9  lvm9  lvm
9 lvm
 
7 implementación de cuotas de disco
7  implementación de cuotas de disco7  implementación de cuotas de disco
7 implementación de cuotas de disco
 
6 gestión del almacenamiento en disco
6  gestión del almacenamiento en disco6  gestión del almacenamiento en disco
6 gestión del almacenamiento en disco
 
5 espacio swap
5  espacio swap5  espacio swap
5 espacio swap
 
4 array redundante de discos independientes
4  array redundante de discos independientes4  array redundante de discos independientes
4 array redundante de discos independientes
 
2 sistema de archivos ext3
2  sistema de archivos ext32  sistema de archivos ext3
2 sistema de archivos ext3
 
1 estructura del sistema de archivos
1  estructura del sistema de archivos1  estructura del sistema de archivos
1 estructura del sistema de archivos
 
37 reunir información del sistema
37  reunir información del sistema37  reunir información del sistema
37 reunir información del sistema
 

12 yum

  • 1. YUM (Yellowdog Updater Modified) Yellowdog Update, Modified (YUM)is a package manager that was developed by Duke University to improve the installation of RPMs. yumsearches numerous repositories for packages and their dependencies so they may be installed together in an effort to alleviate dependency issues. Red Hat Enterprise Linux 5.2 uses yumto fetch packages and install RPMs. up2date is now deprecated in favor of yum(Yellowdog Updater Modified). The entire stack of tools which installs and updates software in Red Hat Enterprise Linux 5.2 is now based on yum. This includes everything, from the initial installation via Anaconda to host software management tools like pirut. yumalso allows system administrators to configure a local (i.e. available over a local network) repository to supplement packages provided by Red Hat. This is useful for user groups that use applications and packages that are not officiallysupported by Red Hat. Aside from being able to supplement available packages for local users, using a local yum repository also saves bandwidth for the entire network. Further, clients that use local yumrepositories do not need to be registered individually to install or update the latest packages from Red Hat Network. 12.1. Setting Up a Yum Repository To set up a repository for Red Hat Enterprise Linux packages, follow these steps: 1. Install the createrepo package: ~]# yum install createrepo 2. Copy all the packages you want to provide in the repository into one directory (/mnt/ local_repo for example). 3. Run createrepo on that directory (for example, createrepo /mnt/local_repo). This will create the necessary metadata for your Yum repository. 12.2. yum Commands yumcommands are typically run as yum <command> <package name/s> . By default, yum will automatically attempt to check all configured repositories to resolve all package dependencies during an installation/upgrade. The following is a list of the most commonly-used yum commands. For a complete list of available yum commands, refer to man yum. yum install <package name/s> Used to install the latest version of a package or group of packages. If no package matches the specified package name(s), they are assumed to be a shell glob, and any matches are then installed. yum update <package name/s> Used to update the specified packages to the latest available version. If no package name/s are specified, then yum will attempt to update all installed packages.
  • 2. [main] Options 152 If the --obsoletes option is used (i.e. yum --obsoletes <package name/s> , yum will process obsolete packages. As such, packages that are obsoleted accross updates will be removed and replaced accordingly. yum check-update This command allows you to determine whether any updates are available for your installed packages. yum returns a list of all package updates from all repositories if any are available. yum remove <package name/s> Used to remove specified packages, along with any other packages dependent on the packages being removed. yum provides <file name> Used to determine which packages provide a specific file or feature. yum search <keyword> This command is used to find any packages containing the specified keyword in the description, summary, packager and package name fields of RPMs in all repositories. yum localinstall <absolute path to package name/s> Used when using yumto install a package located locally in the machine. 12.3. yum Options yumoptions are typically stated before specific yum commands; i.e. yum <options> <command> <package name/s> . Most of these options can be set as default using the configuration file. The following is a list of the most commonly-used yumoptions. For a complete list of available yum options, refer to man yum. -y Answer "yes" to every question in the transaction. -t Sets yumto be "tolerant" of errors with regard to packages specified in the transaction. For example, if you run yum update package1 package2 and package2 is already installed, yum will continue to install package1. --exclude=<package name> Excludes a specific package by name or glob in a specific transaction. 12.4. Configuring yum By default, yumis configured through /etc/yum.conf. The following is an example of a typical / etc/yum.conf file: [main] cachedir=/var/cache/yum keepcache=0 debuglevel=2 logfile=/var/log/yum.log distroverpkg=redhat-release tolerant=1 exactarch=1
  • 3. [main] Options 153 obsoletes=1 gpgcheck=1 plugins=1 metadata_expire=1800 [myrepo] name=RHEL 5 $releasever - $basearch baseurl=http://local/path/to/yum/repository/ enabled=1 A typical /etc/yum.conf file is made up of two types of sections: a [main] section, and a repository section. There can only be one [main] section, but you can specify multiple repositories in a single /etc/yum.conf. 12.4.1. [main] Options The [main] section is mandatory, and there must only be one. For a complete list of options you can use in the [main] section, refer to man yum.conf. The following is a list of the most commonly-used options in the [main] section. cachedir This option specifies the directory where yumshould store its cache and database files. By default, the cache directory of yumis /var/cache/yum. keepcache=<1 or 0> Setting keepcache=1 instructs yumto keep the cache of headers and packages after a successful installation. keepcache=1 is the default. reposdir=<absolute path to directory of .repo files> This option allows you to specify a directory where .repo files are located. .repo files contain repository information (similar to the [repository] section of /etc/yum.conf). yumcollects all repository information from .repo files and the [repository] section of the /etc/yum.conf file to create a master list of repositories to use for each transaction. Refer to Sección 12.4.2, “ [repository] Options” for more information about options you can use for both the [repository] section and .repo files. If reposdir is not set, yumuses the default directory /etc/yum.repos.d. gpgcheck=<1 or 0> This disables/enables GPG signature checking on packages on all repositories, including local package installation. The default is gpgcheck=0, which disables GPG checking. If this option is set in the [main] section of the /etc/yum.conf file, it sets the GPG checking rule for all repositories. However, you can also set this on individual repositories instead; i.e., you can enable GPG checking on one repository while disabling it on another. assumeyes=<1 or 0> This determines whether or not yumshould prompt for confirmation of critical actions. The default if assumeyes=0, which means yum will prompt you for confirmation. If assumeyes=1 is set, yumbehaves in the same way that the command line option -y does. tolerant=<1 or 0> When enabled (tolerant=1), yum will be tolerant of errors on the command line with regard to packages. This is similar to the yumcommand line option -t.
  • 4. [main] Options 154 The default value for this is tolerant=0 (not tolerant). exclude=<package name/s> This option allows you to exclude packages by keyword during installation/updates. If you are specifying multiple packages, this is a space-delimited list. Shell globs using wildcards (for example, * and ?) are allowed. retries=<number of retries> This sets the number of times yumshould attempt to retrieve a file before returning an error. Setting this to 0 makes yum retry forever. The default value is 6. 12.4.2. [repository] Options The [repository] section of the /etc/yum.conf file contains information about a repository yumcan use to find packages during package installation, updating and dependency resolution. A repository entry takes the following form: [repository ID] name=repository name baseurl=url, file or ftp://path to repository You can also specify repository information in a separate .repo files (for example, rhel5.repo). The format of repository information placed in .repo files is identical with the [repository] of /etc/ yum.conf. .repo files are typically placed in /etc/yum.repos.d, unless you specify a different repository path in the [main] section of /etc/yum.conf with reposdir=. .repo files and the /etc/yum.conf file can contain multiple repository entries. Each repository entry consists of the following mandatory parts: [repository ID] The repository ID is a unique, one-word string that serves as a repository identifier. name=repository name This is a human-readable string describing the repository. baseurl=http, file or ftp://path This is a URL to the directory where the repodatadirectory of a repository is located. If the repository is local to the machine, use baseurl=file://path to local repository . If the repository is located online using HTTP, use baseurl=http://link . If the repository is online and uses FTP, use baseurl=ftp://link . If a specific online repository requires basic HTTP authentication, you can specify your username and password in the baseurl line by prepending it as username:password@link. For example, if a repository on http://www.example.com/repo/ requires a username of "user" and a password os "password", then the baseurl link can be specified as baseurl=http:// user:password@www.example.com/repo/. The following is a list of options most commonly used in repository entries. For a complete list of repository entries, refer to man yum.conf.
  • 5. 155 Useful yumVariables gpgcheck=<1 or 0> This disables/enables GPG signature checking a specific repository. The default is gpgcheck=0, which disables GPG checking. gpgkey=URL This option allows you to point to a URL of the ASCII-armoured GPG key file for a repository. This option is normally used if yumneeds a public key to verify a package and the required key was not imported into the RPM database. If this option is set, yum will automatically import the key from the specified URL. You will be prompted before the key is installed unless you set assumeyes=1 (in the [main] section of / etc/yum.conf) or -y (in a yumtransaction). exclude=<package name/s> This option is similar to the exclude option in the [main] section of /etc/yum.conf. However, it only applies to the repository in which it is specified. includepkgs=<package name/s> This option is the opposite of exclude. When this option is set on a repository, yum will only be able to see the specified packages in that repository. By default, all packages in a repository are visible to yum. 12.5. Useful yum Variables The following is a list of variables you can use for both yumcommands and yum configuration files (i.e. /etc/yum.conf and .repo files). $releasever This is replaced with the package's version, as listed in distroverpkg. This defaults to the version of the redhat-release package. $arch This is replaced with your system's architecture, as listed by os.uname() in Python. $basearch This is replaced with your base architecture. For example, if $arch=i686 then $basearch=i386. $YUM0-9 This is replaced with the value of the shell environment variable of the same name. If the shell environment variable does not exist, then the configuration file variable will not be replaced.