centos7下yum安装lamp,php7.2+mysql5.7

1 安装apache

①安装

[root@localhost ~]# yum install httpd

②启动

[root@localhost ~]# systemctl start httpd

2 安装php7.2

参考博客:https://blog.csdn.net/qq292913477/article/details/80696606

①卸载之前安装的php

[root@localhost ~]# yum remove php

②列出所有php相关的rpm包,然后强制移除

[root@localhost ~]# rpm -qa|grep php

[root@localhost ~]# rpm -e xxx --nodeps

③强制更改源(linux不存在php7.2的源)

[root@localhost ~]# rpm -e xxx --nodeps

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

[root@localhost ~]# 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

④安装posix扩展

[root@localhost ~]# yum install php72w-posix

3 安装mysql5.7

参考博客:http://www.cnblogs.com/ianduin/p/7679239.html

①下载源安装包

[root@localhost ~]#  wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

②安装源

[root@localhost ~]# yum localinstall mysql57-community-release-el7-8.noarch.rpm

③安装mysql5.7

[root@localhost ~]# yum install mysql-community-server

④启动mysql,设置开机启动

[root@localhost ~]#  systemctl start mysqld

[root@localhost ~]# systemctl enable mysqld

[root@localhost ~]# systemctl daemon-reload

⑤修改本地root密码

mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改

[root@localhost ~]#  grep 'temporary password' /var/log/mysqld.log

登录修改密码

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

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

或者

mysql> set password for 'root'@'localhost'=password('MyNewPass4!');

 

 

 

你可能感兴趣的:(php,mysql,服务器,centos7)