1. 程式人生 > >centos7 yum 安裝lnmp

centos7 yum 安裝lnmp

pos move rpm bsp oca sys ack x86_64 temporary

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

#移除舊版php
[root@web02 ~]# yum remove php-mysql-5.4 php php-fpm php-common 

#安裝擴展源
[root@web02 ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@web02 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

#安裝php7版本
[root@web02 
~]# 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倉庫
技術分享圖片
技術分享圖片

[root@web02 ~]# cat
/etc/yum.repos.d/nginx.repo [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/7/$basearch/ gpgcheck=0 enabled=1 # 安裝Nginx [root@web02 ~]# yum install nginx -y [root@web02 ~]# sed -i /^user/c user www; /etc/nginx/nginx.conf [root@web02 ~]# systemctl enable nginx [root@web02 ~]# systemctl start nginx

mysql

//下載官方擴展源, 擴展源集成mysql5.6、5.7、8.0,僅5.7倉庫是開啟
[root@nginx ~]# rpm -ivh http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql57-community-release-el7-10.noarch.rpm
[root@nginx ~]# yum install mysql-community-server -y
[root@nginx ~]# systemctl start mysqld
[root@nginx ~]# systemctl enable mysqld

//如果mysql登陸需要密碼,請查看該文件
[root@nginx ~]# grep ‘temporary password‘ /var/log/mysqld.log

#高級方式
[root@web02 ~]# mysql -uroot -p$(awk ‘/temporary password/{print $NF}‘ /var/log/mysqld.log)

#登陸mysql重新配置密碼
[root@nginx ~]# mysql -uroot -p‘password‘
# 修改登錄密碼
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘Bgx123.com‘;

centos7 yum 安裝lnmp