1、下载apache 服务
yum -y install httpd
开启apache
systemctl start httpd
设置开启自启动
systemctl enbale httpd
2、安装mysql
yum install mariadb mariadb-server mariadb-libs mariadb-devel
开启mysql
systemctl start mariadb
设置开启自启动
systemctl enbale mariadb
初始化数据库设置
mysql_secure_installation
设置外网可以访问
mysql>grant all privileges on *.* to root@'%' identified by 'root';
mysql> flush privileges;
3、安装php5.6 (若想安装php7调到步骤4)
先安装EPEL源用于yum源安装
yum install epel-release
获取二进制安装包rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安装php5.6
yum -y install php56w php56w-mysql
4、重启apache/mysql服务
先安装EPEL源用于yum源安装
yum install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
成功获取PHP7的yum源,然后再执行:
yum install php70w php70w-mysql
5、重启apache/mysql服务
LAMP搭建完成
Centos 7 搭建LAMP(apache2.4+php5.6/php7+mysql)
最新推荐文章于 2021-03-19 08:26:02 发布