centos7 yum 安装lnmp

Posted john5yang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7 yum 安装lnmp相关的知识,希望对你有一定的参考价值。

安装7.2把7.1改成7.2就行
使用第三方扩展epel源安装php7.2

#移除旧版php
[[email protected] ~]# yum remove php-mysql-5.4 php php-fpm php-common 

#安装扩展源
[[email protected] ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[[email protected] ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

#安装php7版本
[[email protected] ~]# yum -y install
php71w php71w-cli php71w-common php71w-devel php71w-embedded  
php71w-gd php71w-mcrypt php71w-mbstring 
php71w-pdo
php71w-xml
php71w-fpm
php71w-mysqlnd
php71w-opcache
php71w-pecl-memcached
php71w-pecl-redis
php71w-pecl-mongodb

nginx

去官方站点获取yum仓库
技术分享图片
技术分享图片

[[email protected] ~]# cat /etc/yum.repos.d/nginx.repo 
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

# 安装Nginx
[[email protected] ~]# yum install nginx -y
[[email protected] ~]# sed -i /^user/c user www; /etc/nginx/nginx.conf
[[email protected] ~]# systemctl enable nginx
[[email protected] ~]# systemctl start nginx

 

mysql

//下载官方扩展源, 扩展源集成mysql5.6、5.7、8.0,仅5.7仓库是开启
[[email protected] ~]# rpm -ivh http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql57-community-release-el7-10.noarch.rpm
[[email protected] ~]# yum install mysql-community-server -y
[[email protected] ~]# systemctl start mysqld
[[email protected] ~]# systemctl enable mysqld

//如果mysql登陆需要密码,请查看该文件
[[email protected] ~]# grep ‘temporary password‘ /var/log/mysqld.log

#高级方式
[[email protected] ~]# mysql -uroot -p$(awk ‘/temporary password/{print $NF}‘ /var/log/mysqld.log)

#登陆mysql重新配置密码
[[email protected] ~]# mysql -uroot -p‘password‘
# 修改登录密码
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘Bgx123.com‘;

 

以上是关于centos7 yum 安装lnmp的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7yum安装LNMP

centos7 yum 安装lnmp

Centos7 yum安装 Lnmp以及Lamp

centos7 下使用yum搭建lnmp环境

centos7.5 下LNMP搭建

LNMP, CentOS7.0+Nginx+Mysql5.7+PHP7环境安装