2019年11月8日 星期五

centos8 with phpmyadmin


1.按照前面安裝centos8,還缺少php-json這個套件,所以把他裝回來
yum install -y php-json

2.下載檔案,解壓,移動
wget https://files.phpmyadmin.net/phpMyAdmin/4.9.1/phpMyAdmin-4.9.1-all-languages.tar.gz

tar -zxvf phpMyAdmin-4.9.1-all-languages.tar.gz

mv phpMyAdmin-4.9.1-all-languages /usr/share/phpMyAdmin

cp -pr /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php

3.修改config.inc.php,加上密碼

vi /usr/share/phpMyAdmin/config.inc.php

$cfg['blowfish_secret'] = '這邊加上隨便的密碼'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

4.建立資料庫
mysql < /usr/share/phpMyAdmin/sql/create_tables.sql -u root -p

5.建立連線規則及設定檔案
vi /etc/httpd/conf.d/phpMyAdmin.conf


檔案內容如下:

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin


   AddDefaultCharset UTF-8

   
     # Apache 2.4
      
      Require all granted
   
 
   
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
 



   
     # Apache 2.4
     
       Require all granted
   
 
   
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
 


6.建立暫存檔案及修改權限給apache

mkdir /usr/share/phpMyAdmin/tmp

chmod 777 /usr/share/phpMyAdmin/tmp

chown -R apache:apache /usr/share/phpMyAdmin

systemctl restart httpd


7.設定SELinux

yum install -y policycoreutils-python-utils

semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/phpMyAdmin/'

semanage fcontext -a -t httpd_sys_rw_content_t "/usr/share/phpMyAdmin/tmp(/.*)?"

restorecon -Rv '/usr/share/phpMyAdmin/'


8.設定防火牆

firewall-cmd --permanent --add-service=http

firewall-cmd --reload

9.測試連線
http://伺服器IP/phpMyAdmin

沒有留言:

張貼留言