1、Install Apache
php
yum install httpd -y啓動Apache
systemctl start httpd設置開機啓動
systemctl enable httpdfirewall設置容許遠程登陸:
firewall-cmd --permanent --add-service=http systemctl restart firewalld測試Apache
2、Install MariaDB
html
yum install mariadb-server mariadb -y啓動MariaDB
systemctl start mariadb設置開機啓動
systemctl enable mariadb設置root密碼
mysql_secure_installation
3、Install PHP
mysql
yum install php php-mysql php-gd php-pear -y測試PHP:
vi /var/www/html/testphp.php編輯內容以下
<?php phpinfo(); ?>重啓 httpd 服務:
systemctl restart httpd瀏覽器訪問 http://server-ip-address/testphp.php. 將會顯示php的版本信息.
yum install php* -y
4、Install phpMyAdmin (可選)
web
yum install epel-release安裝 phpMyAdmin:
yum install phpmyadmin -y配置phpMyAdmin
vi /etc/httpd/conf.d/phpMyAdmin.conf查找/<Directory> ,註釋掉或刪除以下內容
<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 </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 </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/> Options none AllowOverride Limit Require all granted </Directory>編輯「config.inc.php」 改變phpMyAdmin的authentication,修改「cookie」 爲 「http」
vi /etc/phpMyAdmin/config.inc.phpChange ‘cookie’ to ‘http’.
systemctl restart httpd訪問 phpmyadmin 的控制檯 http://server-ip-address/phpmyadmin/