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:4.2.7.1-1.el7 will be installed --> Processing Dependency: php-php-gettext for package: phpMyAdmin-4.2.7.1-1.el7.noarch --> Running transaction check ---> Package php-php-gettext.noarch 0:1.0.11-10.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================== Package Arch Version Repository Size ==================================================================================================== Installing: phpMyAdmin noarch 4.2.7.1-1.el7 epel 20 M Installing for dependencies: php-php-gettext noarch 1.0.11-10.el7 epel 57 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-10.el7.noarch.rpm | 57 kB 00:00 (2/2): phpMyAdmin-4.2.7.1-1.el7.noarch.rpm | 20 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-10.el7.noarch 1/2 Installing : phpMyAdmin-4.2.7.1-1.el7.noarch 2/2 Verifying : php-php-gettext-1.0.11-10.el7.noarch 1/2 Verifying : phpMyAdmin-4.2.7.1-1.el7.noarch 2/2 Installed: phpMyAdmin.noarch 0:4.2.7.1-1.el7 Dependency Installed: php-php-gettext.noarch 0:1.0.11-10.el7 Complete!
■ 設定
Apacheのバージョンによって編集する場所が違う。
# httpd -v でApacheのバージョン確認できる。 [root@server1 ~]# httpd -v Server version: Apache/2.4.6 (CentOS) Server built: Jun 17 2014 19:11:24 [root@server1 ~]# vi /etc/httpd/conf.d/phpMyAdmin.conf <Directory /usr/share/phpMyAdmin/> <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require ip 127.0.0.1 Require ip ::1 Require ip 192.168.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>
Apache設定反映
[root@server1 ~]# service httpd restart Redirecting to /bin/systemctl restart httpd.service
■ phpMyAdmin確認
http://サーバー名/phpmyadmin/へアクセスして、phpMyAdminのログイン画面が表示されることと、MySQLに登録されているアカウントでログインできることを確認