WEBの勉強ノート
Loading

yum.conf /etc/yum.repos.d/

2009 年 5 月 16 日 土曜日

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 をアップデートすることができます。もしこのミラーリストが動作しないことがあれば、、、※この文がよくわからず、、」

参考にしたサイト

ManYumConf

yum の概要とコマンド

2009 年 5 月 16 日 土曜日

yum とは

yum の公式サイトを覗いてみました→yumによると、RPM パッケージの管理システムの一つで、アプリケーションの依存関係を自動的に検出する機能を持っているもの、とのこと。*1

使えそうな yum のコマンド

yum install, yum remove 以外で、使えそうなものをまとめてみました。man とか ?help でみればよいのでしょうが、WEB では「Basic Yum Commands and how to use them」で確認することもできるようです。

yum list installed

このコマンドは rpm の rpm ?qa と同等のコマンドで、システムにインストールされている全てのパッケージを表示します。

yum info パッケージ名

パッケージの詳細な情報を表示します。

[root@centos ~]# yum info httpd
(省略)
Name       : httpd
Arch       : i386
Version    : 2.2.3
Release    : 22.el5.centos
Size       : 3.1 M
Repo       : installed
Summary    : Apache HTTP Server
URL        : http://httpd.apache.org/
License    : Apache Software License
Description: The Apache HTTP Server is a powerful, efficient, and extensible web server.

yum search キーワード

設定されているリポジトリから、キーワードで検索をおこなう。検索対象は、リポジトリ内のRPMファイルのName、Packager、Dummary、Descriptionの各フィールド 。複数のキーワードも可。


*1 yum の公式サイトの一番最初に書いてある。

Yum is an automatic updater and package installer/remover for rpm systems. It automatically computes dependencies and figures out what things should occur to install packages. It makes it easier to maintain groups of machines without having to manually update each one using rpm. Yum has a plugin interface for adding simple features. Yum can also be used from other python programs via its module inteface.

yum

Yum は、rpm システムの自動アップデート、インストール、アンインストールを行うものです。依存関係を自動的に算出し、インストールパッケージに何が起こるかを検出します。rpm を使った手動アップデートを行うことなく、複数のマシーンの保守をより簡単にすることができます。

Yum はシンプルな機能を追加するためのプラグインインターフェイスをもっています。Yum はモジュールインターフェイスを経由して、python プログラムから使うこともできます。