LAMP环境搭建 linux centos7

LAMP Linux Apache MySQL PHP的简写

使用yum安装 可以先更新一下yum

[root@VM_0_13_centos ~]# yum -y update

1防火墙配置 

https://blog.csdn.net/lxmblog/article/details/80354483

1安装apache

[root@VM_0_13_centos ~]# yum install httpd httpd-devel

安装完成后启动

[root@VM_0_13_centos ~]# systemctl start httpd
[root@VM_0_13_centos ~]# systemctl stop httpd
[root@VM_0_13_centos ~]# systemctl restart httpd
[root@VM_0_13_centos ~]# systemctl reload httpd    //重新加载(使用新的配置文件):

[root@VM_0_13_centos ~]# systemctl status httpd    //显示运行状态

开启自动启动

[root@VM_0_13_centos ~]# systemctl enable httpd  

关闭自动启动

[root@VM_0_13_centos ~]# systemctl disable httpd

自动启动状态

[root@VM_0_13_centos ~]# systemctl is-enabled httpd

2安装mysql

centos7之后 弃用mysql 改用 maria DB

[root@VM_0_13_centos ~]# yum install mysql mysql-server mysql-devel

[root@VM_0_13_centos ~]# yum install -y mariadb-server

安装完成后启动

[root@VM_0_13_centos ~]# systemctl start mariadb

[root@VM_0_13_centos ~]# systemctl enable mariadb

启动后直输入mysql 进入mysql

[root@VM_0_13_centos ~]# mysql

修改密码

MariaDB [(none)]> use mysql



MariaDB [mysql]> update user set password=password('li200806')where user='root';

MariaDB [mysql]> flush privileges;

设置远程登录


[root@VM_0_13_centos ~]# mysql -u root -p

MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;


3 安装php

[root@VM_0_13_centos ~]# yum install php phph-mysql php-common

测试

在/var/www/h/新建个test.php文件,




猜你喜欢

转载自blog.csdn.net/u010295749/article/details/80338881