1. 程式人生 > >yum安裝(lnmp)

yum安裝(lnmp)

1、第一步先更新yum update

2、yum安裝nginx

安裝nginx最新源:

yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

檢測源:

 

yum repolist enabled | grep "nginx*"

安裝nginx:

yum -y install nginx

啟動nginx:

service nginx start

設定nginx伺服器開機自啟動:

systemctl enable nginx.service

檢查開機自動是否設定成功:

systemctl list-dependencies | grep nginx

 

3、yum安裝mysql5.7

安裝mysql源:

yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

yum repolist enabled | grep "mysql.*-community.*"

安裝mysql:

yum -y install mysql-community-server install mysql-community-devel

啟動mysql: service mysqld start

檢查mysql啟動是否正常: service mysqld status 或者 ps -ef | grep mysql

設定mysqld服務開機自啟動:

systemctl enable mysqld.service

檢查mysqld開機自啟動是否設定成功:

systemctl list-dependencies | grep mysqld

 

 

4、yum安裝php7.1

安裝php源: rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

檢查源是否安裝成功;

yum repolist enabled | grep "webtatic*"

顯示可安裝拓展 : 

yum list|grep php71w

 

安裝php擴充套件源:

yum -y install php71w php71w-fpm

 

yum -y install php71w-mbstring php71w-common php71w-gd php71w-mcrypt

yum -y install php71w-mysql php71w-xml php71w-cli php71w-devel

yum -y install php71w-pecl-memcached php71w-pecl-redis php71w-opcache

驗證php7.1.x和擴充套件是否安裝成功 :

驗證php是否安裝成功

php -v

驗證對應的擴充套件是否安裝成功

php -m

設定php-fpm並檢測php-fpm的執行狀態:

啟動php-fpm

service php-fpm star

檢查啟動是否成功

service php-fpm status

設定開機自啟動: systemctl enable php-fpm.service

檢查開機自啟動是否設定成功:

systemctl list-dependencies | grep php-fpm

ps -ef | grep php-fpm