美文网首页
最详细的LAMP环境搭建

最详细的LAMP环境搭建

作者: 黑夜De白羊丶 | 来源:发表于2018-10-11 03:10 被阅读0次
linux版本centos7.5

关闭防火墙

systemctl stop firewalld

systemctl disable firewalld

关闭SElinux

vim /etc/selinux/config

改为disabled

版本apache http2.4  php7.2 mysql8.0

1、安装apache

yum install httpd

查看版本

httpd -version

systemctl srtart httpd

systemctl enable httpd

2、两种方法安装php

(1)如果之前已经安装我们先卸载一下

yum -y remove php*

由于linux的yum源不存在php7.x,所以我们要更改yum源

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm   

yum 安装php72w和各种拓展,选自己需要的即可

yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml

(2)先安装epel源

yum install epel-release

下载清华大学的remi源

rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm

编辑配置文件

vim /etc/yum.repos.d/remi.repo和vim /etc/yum.repos.d/remi-php72.repo下面的

enabled=0改为1

yum安装php7.2

yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml

启动php

service php-fpm start

3.安装mysql8.0

yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm

yum install mysql-community-server

开启mysql服务

systemctl start mysqld

查看初始密码

grep 'temporary password' /var/log/mysqld.log

登录后修改密码

修改对应的密码策略即可使用简单密码

mysql> set global validate_password_policy=0;

mysql> set global validate_password_length=4;

mysql> set global validate_password_mixed_case_count=0;

修改密码

mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

或者

mysql>SET password='new_password';

重置密码在 /etc/my.cof下面添加

skip-grant-tables

添加远程访问权限

mysql> use mysql

mysql> update user set host='%' where user='root';

创建其他用户登录可以用

mysql>create user 'xxx'@'%' identified by '123'; 

刷新权限  FLUSH PRIVILEGES;

导入数据

source 路径

相关文章

网友评论

      本文标题:最详细的LAMP环境搭建

      本文链接:https://www.haomeiwen.com/subject/bbjvaftx.html