【CentOS7】phpMyAdminのインストールメモ
主に自分用のメモです。
解説はとくにありません。
目次
1 Apacheのインストール
$ yum -y install httpd $ systemctl start httpd $ systemctl enable httpd
2 MariaDBのインストール
$ yum -y install mariadb-server $ systemctl start mariadb $ systemctl enable mariadb $ mysql_secure_installation Enter current password for root (enter for none): → エンター Set root password? [Y/n] → Y New password: → root用のパスワード入力 Remove anonymous users? [Y/n] → Y Disallow root login remotely? [Y/n] → Y Remove test database and access to it? [Y/n] → Y Reload privilege tables now? [Y/n] → Y
3 PHP7.1のインストール
$ rpm --import https://rpms.remirepo.net/RPM-GPG-KEY-remi $ yum -y install yum-utils https://rpms.remirepo.net/enterprise/remi-release-7.rpm $ yum-config-manager --enable remi-php71 $ yum -y install php php-mbstring php-intl
4 DBMSドライバのインストール
$ yum -y install php-mysqlnd
5 phpMyAdminのインストール
$ vim /etc/yum.repos.d/remi.repo -- [remi] name=Remi's RPM repository for Enterprise Linux 7 - $basearch #baseurl=http://rpms.remirepo.net/enterprise/7/remi/$basearch/ mirrorlist=http://rpms.remirepo.net/enterprise/7/remi/mirror enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi includepkgs=phpMyAdmin php-phpmyadmin-sql-parser php-phpmyadmin-motranslator php-phpseclib php-google-recaptcha php-twig-extensions php-symfony-polyfill ↑追加 $ yum-config-manager --enable remi $ yum -y install phpMyAdmin
6 phpMyAdminの設定
$ vim /etc/httpd/conf.d/phpMyAdmin.conf -- #phpMyAdminのアドレスを変更する場合 Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin ↓ Alias /任意の文字列 /usr/share/phpMyAdmin Alias /任意の文字列 /usr/share/phpMyAdmin Require local ↓ Require all granted
7 Apacheのセキュリティ設定
$ vim /etc/httpd/conf.d/security.conf -- ServerTokens Prod Header unset "X-Powered-By" RequestHeader unset Proxy Header append X-Frame-Options SAMEORIGIN Header set X-XSS-Protection "1; mode=block" Header set X-Content-Type-Options nosniff TraceEnable Off LimitRequestBody 10485760 LimitRequestFields 20 RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500 <Directory /var/www/html> AllowOverride All Options -Indexes <IfVersion > 2.4> Require method GET POST </IfVersion> <IfVersion < 2.3> ServerSignature Off FileETag MTime Size <Limit GET POST> Order allow,deny Allow from all </Limit> <LimitExcept GET POST> Order deny,allow Deny from all </LimitExcept> </IfVersion> </Directory> <Directory "/var/www/cgi-bin"> <IfVersion > 2.4> Require all denied </IfVersion> <IfVersion < 2.3> ServerSignature Off FileETag MTime Size Order allow,deny Deny from all </IfVersion> </Directory>