CentOS5.6にyumでphp5.3などをインストール

CentOS5.6にyumでphp5.3などをインストール

Symfony2の稼動条件が、PHP5.3以上だったので、以下の方法でインストールを行った。
依存関係で少しハマったので、メモ。

【リポジトリの追加】

今回は、epelとremiを利用するので、まだの環境の方は以下のコマンドで

epel

$ cd /usr/local/src
$ sudo rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

remi

$ cd /usr/local/src
$ $ sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

【リポジトリの確認】

上のコマンドを実行すると、/etc/yum.repos.d配下に、以下のようなファイルが作成されます

epel

[epel]
name=Extra Packages for Enterprise Linux 5 – $basearch
\#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 – $basearch – Debug
\#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 5 – $basearch – Source
\#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

remi

[remi]
name=Les RPM de remi pour Enterprise Linux 5 – $basearch
baseurl=http://rpms.famillecollet.com/el5.$basearch/
http://iut-info.univ-reims.fr/remirpms/el5.$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
failovermethod=priority

[remi-test]
name=Les RPM de remi en test pour Enterprise Linux $releasever – $basearch
baseurl=http://rpms.famillecollet.com/test-el5.$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

【インストール済みパッケージの確認】

パッケージおよび、バージョンを確認します

$ rpm -qa | grep php
php-devel-5.2.16-jason.1
php-apc-3.1.6-1.jason.1
php-pgsql-5.2.16-jason.1
php-mcrypt-5.2.16-jason.1
php-pdo-5.2.16-jason.1
php-5.2.16-jason.1
php-gd-5.2.16-jason.1
php4-pcntl-4.4.9-2.rhel5
php4-pcntl-gtk-1.0.2-5.rhel5
php-common-5.2.16-jason.1
php-cli-5.2.16-jason.1
php-ldap-5.2.16-jason.1
php-mbstring-5.2.16-jason.1
php-xml-5.2.16-jason.1
php-pear-1.9.1-1.jason.1
php-mysql-5.2.16-jason.1
php-odbc-5.2.16-jason.1
php-bcmath-5.2.16-jason.1

$ rpm -qa | grep mysql
libdbi-dbd-mysql-0.8.1a-1.2.2
mod_auth_mysql-3.0.0-3.2.el5_3
mysqlclient15-5.0.91-1.jason.1
mysql-server-5.1.52-jason.1
mysql-5.1.52-jason.1
php-mysql-5.2.16-jason.1
mysql-connector-odbc-3.51.26r1127-1.el5
mysql-devel-5.1.52-jason.1

【mysqlとphpのインストール】

以下のコマンドで、一気にアップデートします

$ sudo yum install mysql –enablerepo=remi
Loaded plugins: allowdowngrade, fastestmirror
Repository dag is listed more than once in the configuration
Repository atrpms is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: data.nicehosting.co.kr
* epel: ftp.kddilabs.jp
* extras: data.nicehosting.co.kr
* remi: rpms.famillecollet.com
* updates: www.ftp.ne.jp
Setting up Update Process
Resolving Dependencies
–> Running transaction check
—> Package mysql.i386 0:5.5.19-1.el5.remi set to be updated
–> Processing Dependency: mysql-libs = 5.5.19-1.el5.remi for package: mysql
—> Package mysql-devel.i386 0:5.5.19-1.el5.remi set to be updated
—> Package mysql-server.i386 0:5.5.19-1.el5.remi set to be updated
—> Package php.i386 0:5.3.8-5.el5.remi.1 set to be updated
–> Processing Dependency: libedit.so.0 for package: php
—> Package php-bcmath.i386 0:5.3.8-5.el5.remi.1 set to be updated
—> Package php-cli.i386 0:5.3.8-5.el5.remi.1 set to be updated
—> Package php-common.i386 0:5.3.8-5.el5.remi.1 set to be updated
—> Package php-devel.i386 0:5.3.8-5.el5.remi.1 set to be updated
—> Package php-gd.i386 0:5.3.8-5.el5.remi.1 set to be updated
–> Processing Dependency: libt1.so.5 for package: php-gd
—> Package php-ldap.i386 0:5.3.8-5.el5.remi.1 set to be updated
—> Package php-mbstring.i386 0:5.3.8-5.el5.remi.1 set to be updated
—> Package php-mcrypt.i386 0:5.3.8-5.el5.remi.1 set to be updated
—> Package php-mysql.i386 0:5.3.8-5.el5.remi.1 set to be updated
—> Package php-odbc.i386 0:5.3.8-5.el5.remi.1 set to be updated
—> Package php-pdo.i386 0:5.3.8-5.el5.remi.1 set to be updated
—> Package php-pear.noarch 1:1.9.4-3.el5.remi set to be updated
—> Package php-pgsql.i386 0:5.3.8-5.el5.remi.1 set to be updated
—> Package php-xml.i386 0:5.3.8-5.el5.remi.1 set to be updated
–> Running transaction check
—> Package libedit.i386 0:2.11-2.20080712cvs.el5 set to be updated
—> Package mysql-libs.i386 0:5.5.19-1.el5.remi set to be updated
—> Package t1lib.i386 0:5.1.1-7.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================

Package Arch Version Repository Size

Updating:
mysql i386 5.5.19-1.el5.remi remi 7.5 M
mysql-devel i386 5.5.19-1.el5.remi remi 173 k
mysql-server i386 5.5.19-1.el5.remi remi 13 M
php i386 5.3.8-5.el5.remi.1 remi 2.7 M
php-bcmath i386 5.3.8-5.el5.remi.1 remi 40 k
php-cli i386 5.3.8-5.el5.remi.1 remi 2.6 M
php-common i386 5.3.8-5.el5.remi.1 remi 988 k
php-devel i386 5.3.8-5.el5.remi.1 remi 1.3 M
php-gd i386 5.3.8-5.el5.remi.1 remi 206 k
php-ldap i386 5.3.8-5.el5.remi.1 remi 54 k
php-mbstring i386 5.3.8-5.el5.remi.1 remi 2.3 M
php-mcrypt i386 5.3.8-5.el5.remi.1 remi 46 k
php-mysql i386 5.3.8-5.el5.remi.1 remi 89 k
php-odbc i386 5.3.8-5.el5.remi.1 remi 84 k
php-pdo i386 5.3.8-5.el5.remi.1 remi 115 k
php-pear noarch 1:1.9.4-3.el5.remi remi 436 k
php-pgsql i386 5.3.8-5.el5.remi.1 remi 129 k
php-xml i386 5.3.8-5.el5.remi.1 remi 208 k
Installing for dependencies:
libedit i386 2.11-2.20080712cvs.el5 epel 79 k
mysql-libs i386 5.5.19-1.el5.remi remi 1.1 M
t1lib i386 5.1.1-7.el5 epel 194 k

Transaction Summary

Install 3 Package(s)
Upgrade 18 Package(s)

Total download size: 33 M

【バージョン情報の確認】

それぞれのバージョンを確認します

php -v
Xdebug requires Zend Engine API version 220060519.
The Zend Engine API version 220090626 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later version of Xdebug.

PHP 5.3.8 (cli) (built: Sep 30 2011 20:23:54)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

$ mysql –version
mysql Ver 14.14 Distrib 5.5.19, for Linux (i686) using readline 5.1

これで、symfony2の環境が整いました