下面由centos教學專欄跟大家介紹centos7怎麼使用yum安裝lnmp環境,希望對需要的朋友有幫助!
更新yum來源
yum update
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*"
##yum repolist enabled | grep "nginx*"
安裝nginx
yum -y install nginx#啟動nginx
|
service nginx start
|設定nginx伺服器開機自啟動
systemctl enable nginx.service檢查開機自動是否設定成功
#使用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 ysqld.service檢查mysqld開機自啟動是否設定成功
systemctl list-dependencies | grep mysqldmysql5.7以後的爭強了安全機制, 所以使用yum安裝,啟動會系統會自動產生一個隨機的密碼,修改mysql密碼;查看mysql的隨機密碼
grep 'temporary password' /var/log/mysqld .log
使用查詢得到的隨機密碼在終端機登入mysql -u root -p 更改密碼(mysql文件規定,密碼必須包括大小寫字母數字加特殊符號>8位)
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Yourpassword';退出mysql客戶端,用剛才修改的密碼登入確保密碼修改成功
mysql -u root -p
安裝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*"安裝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 php71#w-devel#yum -y install hp71w-pecl-memcached php71w-pecl-redis php71w-opcache
驗證php7.1.x和擴充功能是否安裝成功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
yum install epel-release
yum install rpms.remirepo.net/enterprise/remi-r...
yum install yum-utils
yum search php73
yum search php74
yum install php74-php-gd php74-php-pdo php74-php-mbstring php74-php-cli php74-php-fpm php74-php- mysqlnd
service php74-php-fpm start
#以上是centos7怎麼使用yum安裝lnmp環境的詳細內容。更多資訊請關注PHP中文網其他相關文章!