yum の設定ファイル yum.conf
yum の設定ファイルは etc 直下にある。ManYumConf で詳細を確認することができる。デフォルトの yum.conf は以下のとおり。
[root@centos ~]# cat /etc/yum.conf [main] cachedir=/var/cache/yum keepcache=0 debuglevel=2 logfile=/var/log/yum.log distroverpkg=redhat-release tolerant=1 exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 # Note: yum-RHN-plugin doesn't honor this. metadata_expire=1h installonly_limit = 5 # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d
「PUT YOUR REPOS HERE OR IN separate files named file.repo in /etc/yum.repos.d」 とあるように、yum.conf 内か、/etc/yum.repos.d ディレクトリに .repo ファイルを置くことで、yum が参照するリポジトリを追加することができる。
yum の設定ファイル /etc/yum.repos.d 以下の .repos
CentOS 5.3 に最初から入っている CentOS-Base.repos ファイルの例。大体の構造をつかめればと。詳細は、yum の wiki で確認することができる。
[root@centos ~]# cat /etc/yum.repos.d/CentOS-Base.repo # CentOS-Base.repo # # This file uses a new mirrorlist system developed by Lance Davis for CentOS. # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-$releasever - Addons mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons #baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
ManYumConf から意味を確認。最初のコメント部分の意味は一番下で*1
name
A human readable string describing the repository.
人間がリポジトリを判別するための名前を指定。
mirrorlist
Specifies a URL to a file containing a list of baseurls. This can be used instead of or with the baseurl option. Substitution variables, described below, can be used with this option.
baseurls リストを含むファイルへのパスを指定します。mirrorlist は baseurls のオプションとして、代わりに指定したり、一緒に使用します。
baseurl
Must be a URL to the directory where the yum repository’s ‘repodata’ directory lives. Can be an http:// ftp:// or file:// URL. You can specify multiple URLs in one baseurl statement. The best way to do this is like this: [repositoryid] name=Some name for this repository baseurl=url://server1/path/to/repository/
-
url://server2/path/to/repository/ url://server3/path/to/repository/
If you list more than one baseurl= statement in a repository you will find yum will ignore the earlier ones and probably act bizarrely. Don’t do this, you’ve been warned.
yum リポジトリの repodata ディレクトリを指定します。http://, ftp://, file:// で指定します。1つの baseurl で複数の URL を指定することもできます。また、複数 baseurl を記述すると動作がおかしくなることがあります。
gpgcheck
GPG署名のチェックを行うかどうかの指定をします。0 か 1 で指定します。
enabled
Either ’1′ or ’0′. This tells yum whether or not use this repository.
このリポジトリを使うかどうかを指定します。0 か 1 で指定します。
gpgkey
repository. This option is used if yum needs a public key to verify a package and the required key hasn’t been 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 the assumeyes option is set.
このオプションは、yum がパッケージの検証を行うのに公開キーを必要とる場合に、要求したキーが RPM データベースにインポートされていない場合に使用されます。このオプションを設定すると、yum は自動的に指定した URL から該当のキーをインポートします。キーがインストールされる前に、yes を入力するまでメッセージが表示されます。
exclude
デフォルトの CentOS-Base.repos には入っていないけど、よく使うオプション。
List of packages to exclude from updates or installs. This should be a space separated list. Shell globs using wildcards (eg. * and ?) are allowed.
アップデートやインストールから除外するパッケージを指定します。これは、スペースで区切って複数指定することができます。ワイルドカードの指定が可能です。
*1 CentOS-Base.repo の最初のコメント部分の訳
This file uses a new mirrorlist system developed by Lance Davis for CentOS. The mirror system uses the connecting IP address of the client and the update status of each mirror to pick mirrors that are updated to and
geographically close to the client. You should use this for CentOS updates unless you are manually picking other mirrors.
If the mirrorlist= does not work for you, as a fall back you can try the remarked out baseurl= line instead.
「このファイルは、Lance Davis が CentOS のために開発した新しいミラーリストシステムです。このミラーシステムは、更新されており、かつ地理的に近いミラーを探すために、クライアントの IP アドレスとミラーのアップデートステータスを使います。 手動で他のミラーを探すことなく、 CentOS をアップデートすることができます。もしこのミラーリストが動作しないことがあれば、、、※この文がよくわからず、、」
参考にしたサイト

COMMENT