1.安裝Apache
yum install httpd #根據提示,輸入Y安裝即可成功安裝
systemctl start httpd.service #啟動apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重啟apache
systemctl enable httpd.service #設置apache開機啟動
2.安裝Mariadb
yum install mariadb mariadb-server #詢問是否要安裝,輸入Y即可自動安裝,直到安裝完成
systemctl start mariadb.service #啟動MariaDB
systemctl stop mariadb.service #停止MariaDB
systemctl restart mariadb.service #重啟MariaDB
systemctl enable mariadb.service #設置開機啟動
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf #拷貝配置文件(注意:如果/etc目錄下面默認有一個my.cnf,直接覆 蓋即可)
2.1 初始化數據庫
mysql_secure_installation
回車,根據提示輸入Y
輸入2次密碼,回車
根據提示一路輸入Y
最后出現:Thanks for using MySQL!
MySql密碼設置完成,重新啟動 MySQL:
systemctl restart mariadb.service #重啟MariaDB
3.安裝PHP
yum install php #根據提示輸入Y直到安裝完成
3.1 安裝PHP組件,使PHP支持 MariaDB
yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash #這里選擇以上安裝包進行安裝,根據提示輸入Y回車
systemctl restart mariadb.service #重啟MariaDB
systemctl restart httpd.service #重啟apache
4.安裝phpMyadmin
yum install phpmyadmin php-mcrypt
phpMyAdmin 的默認安裝目錄是 /usr/share/phpMyAdmin,同時會在 Apache 的配置文件目錄中自動創建虛擬主機 配置文件 /etc/httpd/conf.d/phpMyAdmin.conf(區分大小寫)。默認情況下,CentOS 7上的phpMyAdmin只允許從 回環地址(127.0.0.1)訪問。為了能遠程連接,你需要改動它的配置。
vi /etc/httpd/conf.d/phpMyadmin.conf
<Directory /usr/share/phpMyAdmin/> AddDefaultCharset UTF-8 <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> # Require ip 127.0.0.1 #注釋掉 # Require ip ::1 #注釋掉 Require all granted #新添加 </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> <Directory /usr/share/phpMyAdmin/setup/> <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> #Require ip 127.0.0.1 #注釋掉 #Require ip ::1 #注釋掉 Require all granted #新添加 </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> :wq
systemctl restart httpd
瀏覽器訪問地址http://ip/phpmyadmin
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。