読者です 読者をやめる 読者になる 読者になる

CentOS 5.5 にPHP 5.3.3 と MySQL 5.1.51 を入れる

                  • -

※2010/11/04追記
 ↓の方法でインストールしてMySQLが起動しなくなったので
 こちらに記述し直しました。

                  • -

 
PHP5.2.14を入れようとしてうまくいかなかった(*1)ので
どうせなら新しいものを入れておこうと思い 5.3.3 へ変更。
MySQLも 5.0.77 から 5.1.51 へアップデート。
 
まず最初に入っているバージョン確認。

$ php -v
PHP 5.1.6 (cli) (built: Mar 31 2010 02:39:17)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

$ rpm -qa | grep php | sort
php-5.1.6-27.el5
php-cli-5.1.6-27.el5
php-common-5.1.6-27.el5
php-mysql-5.1.6-27.el5
php-pdo-5.1.6-27.el5
$ mysql --version
mysql  Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using readline 5.1

$ rpm -qa | grep mysql | sort
mysql-5.0.77-4.el5_5.3
mysql-5.0.77-4.el5_5.3
mysql-bench-5.0.77-4.el5_5.3
mysql-connector-odbc-3.51.26r1127-1.el5
mysql-devel-5.0.77-4.el5_5.3
mysql-devel-5.0.77-4.el5_5.3
mysql-server-5.0.77-4.el5_5.3
mysql-test-5.0.77-4.el5_5.3
php-mysql-5.1.6-27.el5

 
epel リポジトリを登録。

$ sudo rpm -ivh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm を取得中
警告: /var/tmp/rpm-xfer.DF9Vfh: ヘッダ V3 DSA signature: NOKEY, key ID 217521f6
準備中...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

 
remi リポジトリを登録。

$ sudo rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
http://rpms.famillecollet.com/enterprise/remi-release-5.rpm を取得中
警告: /var/tmp/rpm-xfer.Yh0Ccu: ヘッダ V4 DSA signature: NOKEY, key ID 00f97f56
準備中...                ########################################### [100%]
   1:remi-release           ########################################### [100%]

 
PHP 5.3.3 の存在を確認。

$ yum info php --enablerepo=remi

 
既存 PHPMySQL をアンインストール

$ yum remove php php-* mysql

↓アンインストールされたもの

======================================================================================
 Package                   Arch        Version                   Repository      Size
======================================================================================
Removing:
 mysql                     i386        5.0.77-4.el5_5.3          installed      7.9 M
 mysql                     x86_64      5.0.77-4.el5_5.3          installed      8.1 M
 php                       x86_64      5.1.6-27.el5              installed      6.2 M
 php-cli                   x86_64      5.1.6-27.el5              installed      5.3 M
 php-common                x86_64      5.1.6-27.el5              installed      397 k
 php-mysql                 x86_64      5.1.6-27.el5              installed      196 k
 php-pdo                   x86_64      5.1.6-27.el5              installed      114 k
Removing for dependencies:
 mysql-bench               x86_64      5.0.77-4.el5_5.3          installed      2.6 M
 mysql-connector-odbc      x86_64      3.51.26r1127-1.el5        installed      448 k
 mysql-devel               i386        5.0.77-4.el5_5.3          installed      5.6 M
 mysql-devel               x86_64      5.0.77-4.el5_5.3          installed      6.3 M
 mysql-server              x86_64      5.0.77-4.el5_5.3          installed       22 M
 mysql-test                x86_64      5.0.77-4.el5_5.3          installed       27 M
 perl-DBD-MySQL            x86_64      3.0007-2.el5              installed      328 k

Transaction Summary
======================================================================================
Remove       14 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing        : mysql                                                         1/14
  Erasing        : php-common                                                    2/14
  Erasing        : mysql-server                                                  3/14
  Erasing        : php-cli                                                       4/14
  Erasing        : php                                                           5/14
  Erasing        : mysql-test                                                    6/14
  Erasing        : php-mysql                                                     7/14
  Erasing        : mysql-connector-odbc                                          8/14
  Erasing        : mysql-devel                                                   9/14
  Erasing        : php-pdo                                                      10/14
  Erasing        : mysql-devel                                                  11/14
  Erasing        : mysql                                                        12/14
  Erasing        : mysql-bench                                                  13/14
  Erasing        : perl-DBD-MySQL                                               14/14

Removed:
  mysql.i386 0:5.0.77-4.el5_5.3              mysql.x86_64 0:5.0.77-4.el5_5.3
  php.x86_64 0:5.1.6-27.el5                  php-cli.x86_64 0:5.1.6-27.el5
  php-common.x86_64 0:5.1.6-27.el5           php-mysql.x86_64 0:5.1.6-27.el5
  php-pdo.x86_64 0:5.1.6-27.el5

Dependency Removed:
  mysql-bench.x86_64 0:5.0.77-4.el5_5.3
  mysql-connector-odbc.x86_64 0:3.51.26r1127-1.el5
  mysql-devel.i386 0:5.0.77-4.el5_5.3
  mysql-devel.x86_64 0:5.0.77-4.el5_5.3
  mysql-server.x86_64 0:5.0.77-4.el5_5.3
  mysql-test.x86_64 0:5.0.77-4.el5_5.3
  perl-DBD-MySQL.x86_64 0:3.0007-2.el5

Complete!

 
アンインストールされたのと同名パッケージを、remi リポジトリからインストール

yum install php php-adodb php-cli php-common php-mysql php-pdo mysql mysql-bench mysql-connector-odbc mysql-devel mysql-server mysql-test perl-DBD-MySQL ... --enablerepo=remi

↓インストールされたもの

======================================================================================
 Package                   Arch        Version                     Repository    Size
======================================================================================
Installing:
 mysql                     i386        5.0.77-4.el5_5.3            updates      4.8 M
 mysql                     x86_64      5.1.51-1.el5.remi           remi         1.1 M
 mysql-bench               x86_64      5.1.51-1.el5.remi           remi         501 k
 mysql-connector-odbc      x86_64      3.51.26r1127-1.el5          base         158 k
 mysql-devel               i386        5.0.77-4.el5_5.3            updates      2.4 M
 mysql-devel               x86_64      5.1.51-1.el5.remi           remi         119 k
 mysql-server              x86_64      5.1.51-1.el5.remi           remi          11 M
 mysql-test                x86_64      5.1.51-1.el5.remi           remi         7.2 M
 perl-DBD-MySQL            x86_64      3.0007-2.el5                base         148 k
 php                       x86_64      5.3.3-1.el5.remi            remi         1.3 M
 php-adodb                 noarch      5.11-1.el5.remi             remi         554 k
 php-cli                   x86_64      5.3.3-1.el5.remi            remi         2.5 M
 php-common                x86_64      5.3.3-1.el5.remi            remi         961 k
 php-mysql                 x86_64      5.3.3-1.el5.remi            remi         156 k
 php-pdo                   x86_64      5.3.3-1.el5.remi            remi         171 k
Installing for dependencies:
 libedit                   x86_64      2.11-2.20080712cvs.el5      epel          80 k
 mysql-libs                x86_64      5.1.51-1.el5.remi           remi         1.7 M
 mysqlclient15             x86_64      5.0.67-1.el5.remi           remi         1.3 M
 sqlite2                   x86_64      2.8.17-2.el5.remi           remi         166 k

Transaction Summary
======================================================================================
Install      19 Package(s)
Upgrade       0 Package(s)

 
新しいバージョンを確認。

$ php -v
PHP 5.3.3 (cli) (built: Jul 22 2010 17:12:45)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

$ rpm -qa | grep php | sort
php-5.3.3-1.el5.remi
php-adodb-5.11-1.el5.remi
php-cli-5.3.3-1.el5.remi
php-common-5.3.3-1.el5.remi
php-mysql-5.3.3-1.el5.remi
php-pdo-5.3.3-1.el5.remi
$ mysql --version
mysql  Ver 14.14 Distrib 5.1.51, for redhat-linux-gnu (x86_64) using readline 5.1

$ rpm -qa | grep mysql | sort
mysql-5.0.77-4.el5_5.3
mysql-5.1.51-1.el5.remi
mysql-bench-5.1.51-1.el5.remi
mysql-connector-odbc-3.51.26r1127-1.el5
mysql-devel-5.0.77-4.el5_5.3
mysql-devel-5.1.51-1.el5.remi
mysql-libs-5.1.51-1.el5.remi
mysql-server-5.1.51-1.el5.remi
mysql-test-5.1.51-1.el5.remi
mysqlclient15-5.0.67-1.el5.remi
php-mysql-5.3.3-1.el5.remi

 
参考サイト:http://www.natzworks.com/digital/2010/444.html
…参考というか殆どそのまま真似させて貰いました(^^;)