conta's diary

思ったこと、やったことを書いてます。 twitter: @conta_

centosにPHPとMySQLインストール

メモメモ。

消す!

rm -rf /var/lib/mysql/
rm -rf /usr/share/mysql/
rm -rf /var/lib64/mysql/

インストール

yum --enablerepo=remi install php php-cli php-common php-devel php-gd php-mbstring php-mysql php-pdo php-mcrypt php-pear mysql-server php-mysql
=====================================================================================================
 Package                    Arch               Version                        Repository        Size
=====================================================================================================
Installing:
 mysql-server               x86_64             5.5.20-1.el5.remi              remi              13 M
 php                        x86_64             5.3.9-1.el5.remi               remi             2.8 M
 php-cli                    x86_64             5.3.9-1.el5.remi               remi             2.6 M
 php-common                 x86_64             5.3.9-1.el5.remi               remi             997 k
 php-devel                  x86_64             5.3.9-1.el5.remi               remi             1.3 M
 php-gd                     x86_64             5.3.9-1.el5.remi               remi             209 k
 php-mbstring               x86_64             5.3.9-1.el5.remi               remi             2.3 M
 php-mcrypt                 x86_64             5.3.9-1.el5.remi               remi              48 k
 php-mysql                  x86_64             5.3.9-1.el5.remi               remi              96 k
 php-pdo                    x86_64             5.3.9-1.el5.remi               remi             119 k
 php-pear                   noarch             1:1.9.4-3.el5.remi             remi             436 k
Installing for dependencies:
 mysql                      x86_64             5.5.20-1.el5.remi              remi             7.4 M
 mysql-libs                 x86_64             5.5.20-1.el5.remi              remi             1.1 M
 mysqlclient15              x86_64             5.0.67-1.el5.remi              remi             1.3 M
 perl-DBD-MySQL             x86_64             3.0007-2.el5                   base             148 k

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

Total download size: 33 M
Is this ok [y/N]: y
Downloading Packages:
(1/15): php-mcrypt-5.3.9-1.el5.remi.x86_64.rpm                                |  48 kB     00:00     
(2/15): php-mysql-5.3.9-1.el5.remi.x86_64.rpm                                 |  96 kB     00:00     
(3/15): php-pdo-5.3.9-1.el5.remi.x86_64.rpm                                   | 119 kB     00:00     
(4/15): perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm                                | 148 kB     00:00     
(5/15): php-gd-5.3.9-1.el5.remi.x86_64.rpm                                    | 209 kB     00:00     
(6/15): php-pear-1.9.4-3.el5.remi.noarch.rpm                                  | 436 kB     00:01     
(7/15): php-common-5.3.9-1.el5.remi.x86_64.rpm                                | 997 kB     00:02     
(8/15): mysql-libs-5.5.20-1.el5.remi.x86_64.rpm                               | 1.1 MB     00:02     
(9/15): php-devel-5.3.9-1.el5.remi.x86_64.rpm                                 | 1.3 MB     00:02     
(10/15): mysqlclient15-5.0.67-1.el5.remi.x86_64.rpm                           | 1.3 MB     00:03     
(11/15): php-mbstring-5.3.9-1.el5.remi.x86_64.rpm                             | 2.3 MB     00:05     
(12/15): php-cli-5.3.9-1.el5.remi.x86_64.rpm                                  | 2.6 MB     00:06     
(13/15): php-5.3.9-1.el5.remi.x86_64.rpm                                      | 2.8 MB     00:06     
(14/15): mysql-5.5.20-1.el5.remi.x86_64.rpm                                   | 7.4 MB     00:12     
(15/15): mysql-server-5.5.20-1.el5.remi.x86_64.rpm                            |  13 MB     00:17     
-----------------------------------------------------------------------------------------------------
Total                                                                515 kB/s |  33 MB     01:06     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction

WARNING : These php-* RPM are not official Fedora/Redhat build and
overrides the official ones. Don't file bugs on Fedora Project nor Redhat.

Use dedicated forums http://forums.famillecollet.com/

  Installing     : php-common                                                                   1/15 

WARNING : This MySQL RPM is not an official Fedora/Redhat build and it
overrides the official one. Don't file bugs on Fedora Project nor Redhat.
Use dedicated forums http://forums.famillecollet.com/

  Installing     : mysql-libs                                                                   2/15 
  Installing     : php-cli                                                                      3/15 
  Installing     : php                                                                          4/15 
  Installing     : mysql                                                                        5/15 
  Installing     : php-pdo                                                                      6/15 
  Installing     : mysqlclient15                                                                7/15 
  Installing     : perl-DBD-MySQL                                                               8/15 
  Installing     : php-mysql                                                                    9/15 
  Installing     : mysql-server                                                                10/15 
  Installing     : php-gd                                                                      11/15 
  Installing     : php-devel                                                                   12/15 
  Installing     : php-pear                                                                    13/15 
  Installing     : php-mcrypt                                                                  14/15 
  Installing     : php-mbstring                                                                15/15 

Installed:
  mysql-server.x86_64 0:5.5.20-1.el5.remi            php.x86_64 0:5.3.9-1.el5.remi                  
  php-cli.x86_64 0:5.3.9-1.el5.remi                  php-common.x86_64 0:5.3.9-1.el5.remi           
  php-devel.x86_64 0:5.3.9-1.el5.remi                php-gd.x86_64 0:5.3.9-1.el5.remi               
  php-mbstring.x86_64 0:5.3.9-1.el5.remi             php-mcrypt.x86_64 0:5.3.9-1.el5.remi           
  php-mysql.x86_64 0:5.3.9-1.el5.remi                php-pdo.x86_64 0:5.3.9-1.el5.remi              
  php-pear.noarch 1:1.9.4-3.el5.remi                

Dependency Installed:
  mysql.x86_64 0:5.5.20-1.el5.remi                   mysql-libs.x86_64 0:5.5.20-1.el5.remi          
  mysqlclient15.x86_64 0:5.0.67-1.el5.remi           perl-DBD-MySQL.x86_64 0:3.0007-2.el5           

Complete!
[root@localhost admin]# /etc/init.d/mysqld start
Starting mysqld:                                           [  OK  ]

ここで、

yum --enablerepo=remi install .... mysql mysql-server ...

ってしてしまうと

Installing:
 mysql                      i386               5.0.77-4.el5_6.6               base             4.8 M
 mysql                      x86_64             5.5.20-1.el5.remi              remi             7.4 M

変なのが入る!!!!コレのせいで、何時間無駄にしたことか。
全く動かないと思ったら。気づかなかったよ。

yum --enablerepo=remi install .... mysql-server ...

という風に、mysqlをDependencyでもってくると

Installing for dependencies:
 mysql                      x86_64             5.5.20-1.el5.remi  

みたいな感じでうまくいった。

あとはお好みでPhpmyadminをインストール

yum install --enablerepo=remi phpmyadmin
cp /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php
emacs /etc/httpd/conf.d/phpMyAdmin.conf

あぁー、いつもうまく行ってたのに、かなり時間かかってしまった(-_-;)