#!/bin/sh echo "#######################################################################" echo "# #" echo "# 正在配置openEuler21.03源 请稍后—— #" echo "# #" echo "#######################################################################" cat >> /etc/yum.repos.d/openEuler.repo<<EOF [OS] name=OS baseurl=http://repo.openeuler.org/openEuler-21.03/OS/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-21.03/OS/$basearch/RPM-GPG-KEY-openEuler [everything] name=everything baseurl=http://repo.openeuler.org/openEuler-21.03/everything/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-21.03/everything/$basearch/RPM-GPG-KEY-openEuler [EPOL] name=EPOL baseurl=http://repo.openeuler.org/openEuler-21.03/EPOL/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-21.03/OS/$basearch/RPM-GPG-KEY-openEuler [debuginfo] name=debuginfo baseurl=http://repo.openeuler.org/openEuler-21.03/debuginfo/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-21.03/debuginfo/$basearch/RPM-GPG-KEY-openEuler [source] name=source baseurl=http://repo.openeuler.org/openEuler-21.03/source/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-21.03/source/RPM-GPG-KEY-openEuler [update] name=update baseurl=http://repo.openeuler.org/openEuler-21.03/update/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-21.03/OS/$basearch/RPM-GPG-KEY-openEuler EOF #更新源 yum makecache cho "#######################################################################" echo "# #" echo "# 正在关闭SElinux策略,防火墙 请稍等~ #" echo "# #" echo "#######################################################################" #永久关闭SElinux sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config systemctl disable --now firewalld echo "#######################################################################" echo "# 正在安装apache----- #" echo "# 请稍后----- #" echo "# #" echo "#######################################################################" yum install httpd -y systemctl restart httpd systemctl enable httpd echo " httpd配置文件 : /etc/httpd/conf/httpd.conf /var/www/html" echo "#######################################################################" echo "# 正在安装php8.0----- #" echo "# 请稍后----- #" echo "# #" echo "#######################################################################" yum list php yum -y install php #查看版本 php -v #查看启动模块 php --modules #查看安装路径 whereis php #启动,自启,查看运行状态 service php-fpm start service php-fpm enable echo "####### 正在配置Apache解析PHP请稍后 ###########################321" #配置路径/etc/httpd/conf.d/php-fpm.conf cat >> /etc/httpd/conf.d/php-fpm.conf<<EOF <FilesMatch \.php$> SetHandler "proxy:fcgi://127.0.0.1:9000" </FilesMatch> EOF #Apache网页目录下编写简单的php网页,验证访问Apache的php网页 echo "配置路径/var/www/html/index.php" cat >> /var/www/html/index.php<<EOF <?php phpinfo(); ?> EOF service php-fpm restart systemctl restart httpd echo "浏览器访问IP/index.php"