搭建LAMP环境

systemctl stop firewalld | systemctl disable firewalld ## 关闭防火墙

setenforce 0 ###关闭selinux

1、yum -y install httpd systemctl restart httpd | systemctl enable httpd 浏览器访问ip 出现Apache测试页面,完成

2、yum -y install php ####安装PHP,

如需要其他模块可以yum list php* 列出相关包,yum安装即可

vim /var/www/html/index.php

插入 #######创建PHP测试文件

浏览器打开ip/index.php 出现测试界面即成功

3、rpm -qa | grep mariadb #####查找本机是否已安装mariadb 若安装需要卸载

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm ####下载yum源

rpm -ivh mysql57-community-release-el7-9.noarch.rpm ##### 安装MySQL yum源

yum -y install mysql-server #####安装MySQL服务端

systemctl restart mysqld systemctl enable mysqld

vim /etc/my.cnf 在末尾加入skip-grant-tables保存

systemctl restart mysqld

mysql

ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';

quit

vim /etc/my.cnf 删掉skip-grant-tables

systemctl restart mysqld

posted @ 2021-12-16 17:48  ITxiaomage  阅读(33)  评论(0编辑  收藏  举报