phpMyAdminをyumでインストール

今までは、wgetでソースからインストールしてたが、バージョンアップのたびにソースからインストールするのは面倒なので、yumでインストールすることにした。phpMyAdminは標準のリポジトリには入っていないのでEPELリポジトリを追加しておく。
■ phpMyAdminインストール

[root@server1 ~]# yum install phpmyadmin
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
epel/metalink                                                                | 5.0 kB     00:00
* base: www.ftp.ne.jp
* centosplus: www.ftp.ne.jp
* epel: ftp.jaist.ac.jp
* extras: www.ftp.ne.jp
* rpmforge: ftp.riken.jp
* updates: www.ftp.ne.jp
117 packages excluded due to repository priority protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package phpMyAdmin.noarch 0:3.5.2.2-1.el6 will be installed
--> Processing Dependency: php-php-gettext for package: phpMyAdmin-3.5.2.2-1.el6.noarch
--> Running transaction check
---> Package php-php-gettext.noarch 0:1.0.11-3.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================
Package                     Arch               Version                      Repository        Size
====================================================================================================
Installing:
phpMyAdmin                  noarch             3.5.2.2-1.el6                epel             4.3 M
Installing for dependencies:
php-php-gettext             noarch             1.0.11-3.el6                 epel              21 k
Transaction Summary
====================================================================================================
Install       2 Package(s)
Total download size: 4.3 M
Installed size: 17 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): php-php-gettext-1.0.11-3.el6.noarch.rpm                               |  21 kB     00:00
(2/2): phpMyAdmin-3.5.2.2-1.el6.noarch.rpm                                   | 4.3 MB     00:00
----------------------------------------------------------------------------------------------------
Total                                                               5.1 MB/s | 4.3 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php-php-gettext-1.0.11-3.el6.noarch                                              1/2
Installing : phpMyAdmin-3.5.2.2-1.el6.noarch                                                  2/2
Verifying  : php-php-gettext-1.0.11-3.el6.noarch                                              1/2
Verifying  : phpMyAdmin-3.5.2.2-1.el6.noarch                                                  2/2
Installed:
phpMyAdmin.noarch 0:3.5.2.2-1.el6
Dependency Installed:
php-php-gettext.noarch 0:1.0.11-3.el6
Complete!

■ 設定
Apacheのバージョンによって編集する場所が違う。
# httpd -v でApacheのバージョン確認できる。

[root@server1 ~]# vi /etc/httpd/conf.d/phpMyAdmin.conf
# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
Allow from 192.168.1.  ← 追加:内部ネットワークからのアクセスを許可
Allow from ***.***.***.***  ← 追加:特定の外部IPからのアクセスを許可する場合
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
Apache設定反映
[root@server1 ~]# service httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]

■ phpMyAdmin確認
http://サーバー名/phpmyadmin/へアクセスして、phpMyAdminのログイン画面が表示されること
MySQLに登録されているアカウントでログインできること