yum -y install httpd mariadb-server mariadb php php-mysql php-gd php-mbstring
iptables -F #关闭防火墙 systemctl start httpd #开机apache systemctl enable httpd #启动apache
vim /etc/httpd/conf/httpd.conf
更改ServerName:80为localhost:80 去掉#注释
跳转行在非插入状态下输入键盘摁下跳转行数收双击gg即可完成跳转
在index.html 后输入index.php
重启apache
systemctl restart httpd
启动mysql设置密码
systemctl start mariadb
mysql -u root 发现没有密码
默认没有密码 有隐患
mysql_secure_installation
如不走安全配置设置密码
mysqladmin -u root -password ‘123456’
新建php文件测试是否正常联系
cd var/www/html/ vim index.php
systemctl status firewalld.service(查看防火墙状态)
然后你会发现ok了
权限优化
ps -aux | grep httpd id apache chown -R apache:apache /var/www/html/
yum源安装时候,出现下面错误“错误:Failed to download metadata for repo ‘AppStream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist”
1、进入yum的repos目录
cd /etc/yum.repos.d/
2、修改所有的CentOS文件内容
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*3、更新yum源为阿里镜像 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo yum clean all yum makecache4、yum安装测试是否可以yum安装 yum install wget –y
安装LAMP所需要的依赖包
yum install -y epel-release yum-utils unzip curl wget bash-completion policycoreutils-python mlocate bzip2
安装php7.2的组件
yum install -y php72w php72w-cli php72w-common php72w-curl php72w-gd php72w-mbstring php72w-mysqlnd php72w-process php72w-xml php72w-zip php72w-opcache php72w-pecl-apcu php72w-intl php72w-pecl-redis