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/