centos 7.4 yum 配置 LNMP 环境

1、安装LNMP之前要安装EPEL,以便安装源以外的软件,如Nginx,phpMyAdmin等。

yum install epel-release

提示:EPEL,即Extra Packages for Enterprise Linux,企业版linux附加包。这个软件仓库里有很多非常常用的软件,而且是专门针对RHEL设计的,对RHEL标准yum源是一个很好的补充,完全免费使用,由Fedora项目维护,所以如果你使用的是RHEL,或者CentOS,Scientific等RHEL系的linux,可以非常放心的使用EPEL的yum源。 

yum update

2、安装Nginx

 yum install nginx 
 #启动nginx 
 systemctl start nginx 
 #设置开机启动
 systemctl enable nginx 

3.安装php7

rpm 安装 Php7 相应的 yum源

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

卸载原有的php

yum remove php* php-common

安装php7及扩展 

yum install php70w php70w-devel php70w-fpm php70w-mysql php70w-mbstring php70w-mcrypt php70w-gd php70w-imap php70w-ldap php70w-odbc php70w-pear php70w-xml php70w-xmlrpc php70w-pdo

查看php安装了那些拓展模块

php -m

安装其他你需要的拓展模块

yum -y install php70w-xxx

开启php-fpm

#开启php-fpm  

systemctl start php-fpm

#开机自动启动
systemctl enable php-fpm

 4.安装mysql

yum install mariadb mariadb-server #询问是否要安装,输入Y即可自动安装,直到安装完成 
systemctl start mariadb.service #启动MariaDB 
systemctl stop mariadb.service #停止MariaDB 
systemctl restart mariadb.service #重启MariaDB 
systemctl enable mariadb.service #设置开机启动

 修改数据库密码

 在我得博客mysql得分类里面

https://blog.csdn.net/weixin_41858542/article/details/80941598

修改权限可远程访问

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

如果是阿里云的话记得在控制台添加安全组开放3306端口

服务器防火墙也要开放3306端口哦

centos7之前是iptable

/sbin/iptables -I INPUT -p tcp -dport 3306 -j ACCEPT
 
/etc/rc.d/init.d/iptables save

之后是firewalld

firewall-cmd --zone=public --add-port=3306/tcp --permanent

猜你喜欢

转载自blog.csdn.net/weixin_41858542/article/details/81178589
今日推荐