yumで、より新しいパッケージをインストールする方法(CentOS)

CentOS5の公式レポジトリは対応が遅いため、最新のプロジェクトがインストールできなかったりします。
例えば2009年5月11日現在、symfony1.2はPHP5.2以上でないと使えませんが、CentOS5のPHPは5.1です。

Utter Ramblingsを指定してupdateする方法
updateのとき常にUtter Ramblingsを含める方法
RHEL(Red Hat Enterprise Linux)
EPEL(Extra Packages for Enterprise Linux)
CentOSのデフォルト値

[参考記事] Remi 基本リポジトリで提供されていないパッケージ
[参考記事] Repoforge(RPMForge) 基本リポジトリで提供されていないパッケージ

より新しいリポジトリを入手するには、非公式のリポジトリを使う手があります。
Utter Ramblings

作業の前にCentOSのBaseRepoをupdateします。

yum update

Utter Ramblingsを指定してupdateする方法

Utter RamblingsのURL(www.jasonlitka.com)からRPM-GPG-KEYをインストールするコマンドを実行します。

rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

Utter Ramblingsのリポジトリ情報をyumに追加するため
/etc/yum.repos.d/utterramblings.repo を作成し、下記の内容を記載します。

vi /etc/yum.repos.d/utterramblings.repo
[utterramblings]
name=Jason’s Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

これでyum updateを実行するとバージョンの古いアプリケーションが全て更新されるのですが、必要なものだけ更新するにはyum updateのあとにパッケージ名を指定します。

更新可能な全てをアップデートする場合。

yum --enablerepo=utterramblings update

更新するパッケージを指定してアップデートする場合。
例:PHP

yum --enablerepo=utterramblings update php

updateのとき常にUtter Ramblingsを含める方法

Utter RamblingsのURL(www.jasonlitka.com)からRPM-GPG-KEYをインストールするコマンドを実行します。

rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

Utter Ramblingsのリポジトリ情報をyumに追加するため
/etc/yum.repos.d/utterramblings.repo を作成し、下記の内容を記載します。

vi /etc/yum.repos.d/utterramblings.repo
[utterramblings]
name=Jason’s Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

これでyum updateを実行するとバージョンの古いアプリケーションが全て更新されるのですが、必要なものだけ更新するにはyum updateのあとにパッケージ名を指定します。

更新可能な全てをアップデートする場合。

yum update

更新するパッケージを指定してアップデートする場合。
例:PHP

yum update php

このままの設定だと、常にUtter Ramblingsが使用されることになるので、アップデートが完了したら utterramblings.repo の enabled=1 の部分を enabled=0 に変更して、 リポジトリの使用を無効にしておくとよい。

RHEL(Red Hat Enterprise Linux)

またUtter Ramblingsは非公式なリポジトリのため、より信頼性のあるリポジトリとしてRed Hat Enterprise Linux(RHEL)のdagリポリトジを使用するという方法もある。
このリポジトリが使用できるのはCentOS自体がRHELのクローンであるためですが、 完全なクローンではないため不具合を起こす可能性がないとも言い切れませんので注意してください。

CentOSと同じRHELのバージョン用のリポジトリを使います。
dagリポリトジを使えるようにするには、以下の手順で作業します。

RPM-GPG-KEYをインストールするコマンドを実行します。

rpm --import http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt

dagのリポジトリ情報をyumに追加するため
/etc/yum.repos.d/dag.repo を作成し、下記の内容を記載します。

vi /etc/yum.repos.d/dag.repo
[dag]
name=Dag RPM Repository for RHEL5/CentOS5
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
enabled=1
gpgcheck=1
gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt

EPEL(Extra Packages for Enterprise Linux)

追加パッケージとしてEPEL(Extra Packages for Enterprise Linux)を使用する方法もあります。

yumでEPELリポジトリを追加する方法

yum install epel-release

RPMでEPELリポジトリを追加する方法
CentOS 5.x 32-bit (x86/i386)

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

CentOS 5.x 64-bit (x64)

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

CentOSのデフォルト値

GPG-Keyは/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5に入っていますが、ダウンロードする場合はこちら

http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

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

関連記事

スポンサーリンク

ブラウザでJPG画像を保存しようとすると.jfifの拡張子で保存されるのを.jpgに戻す方法

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る