CentOS 5.3 に PHP 5.3 をインストールする

CentOSPHP 5.3.0 をインストールしようとして嵌ったのでメモ。

まず、標準のリポジトリには PHP 5.3.0 が存在しないようなので、remiというリポジトリを追加。

# wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
# wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
# rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

epelの方は、i386x86_64か好きな方を使用。
ついでに、priorityかenableの設定も変更しておく。*1

PHPのアップグレードだけで良かったので、

# yum --enablerepo=remi,epel update php*

とやったら、conflictエラーが大量に発生。

Transaction Check Error:
  file /etc/my.cnf from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/charsets/Index.xml from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/charsets/README from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/charsets/ascii.xml from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/charsets/cp1250.xml from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/czech/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/danish/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/dutch/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/english/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/estonian/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/french/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/german/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/greek/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/hungarian/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/italian/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/japanese/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/korean/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/norwegian-ny/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/norwegian/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/polish/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/portuguese/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/romanian/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/russian/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/serbian/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/slovak/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/spanish/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/swedish/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386
  file /usr/share/mysql/ukrainian/errmsg.sys from install of mysql-libs-5.1.38-1.el5.remi.i386 conflicts with file from package mysql-5.0.45-7.el5.i386

Error Summary
-------------

調査の結果、CentOS5でPHP5.2.10をインストール | Priereluna に、mysqlのアップグレードを先にすると良い(yum --enablerepo=remi,epel update mysql*)という記述があったのでその通り実行してみた。
結果、同時にPHPのアップグレードも済んで、1回で完了。

また、今回は使わなかったけど、yum-utilsというものを使って

  1. yumdownloaderでRPMパッケージを取得
  2. rpmでforceアップデート (rpm -Uvh --force hoge.rpm)

のような対応方法もあるみたい。
要調査。

参考文献

  1. http://d.hatena.ne.jp/roadmanprog/20090821/1250872649
    • remi, epelのインストール方法からPHP 5.3のアップデートまでを紹介
  2. Installing PHP 5.2.x or 5.3.x on RedHat ES5, CentOS 5, etc | Bluhalo IT
    • 参考文献1の元記事
  3. CentOS5でPHP5.2.10をインストール | Priereluna
    • 本文中で言及のとおり。
  4. CakePHPでの開発の準備 - yokkunsの日記
    • yum-utilsのyumdownloaderを使用した強制インストールの例
  5. yumで強制インストール
    • yum-utilsのyumdownloaderを使用した強制インストールの例

*1:2009-09-30追記:その後priorityだけ付けてやったら上手くいかなかったので、やるならenableの方が良いかも。