Centos7安装LNMP环境
Centos7安装LNMP环境
我对于Centos7是基于阿里云云服务器进行一个部署的,然后我的系统是7.3的版本,就linux系统来说安装一个LNMP的环境,毕竟很多人可能有很多的坑。
修改yum源
[root@localhost ~]# 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
[root@localhost ~]# rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
安装好yum源之后再安装Nginx、Mysql、PHP
[root@localhost ~]# yum -y install nginx
[root@localhost ~]# yum -y install mysql-community-server
[root@localhost ~]# yum -y install php72w-devel php72w.x86_64 php72w-cli.x86_64 php72w-common.x86_64 php72w-gd.x86_64 php72w-ldap.x86_64 php72w-mbstring.x86_64 php72w-mcrypt.x86_64 php72w-pdo.x86_64 php72w-mysqlnd php72w-fpm php72w-opcache php72w-pecl-redis php72w-pecl-mongo
配置Mysql
Mysql在安装好之后输入“mysql -uroot -p”的命令行是需要密码的,刚开始的安装的系统是不知道密码的,所以我们可以对数据库的密码先进行一个修改。在 “/var/log/mysqld.log” 文件中给 root 生成了一个默认密码,通过下面的方式找到root 默认密码,然后登录 MySQL 进行修改(小白提示:root@localhost: ;_;BWtX:x6rn root@localhost冒号后面的就是数据库的初始密码):