Home  >  Article  >  Operation and Maintenance  >  How to use yum to install lnmp environment in centos7

How to use yum to install lnmp environment in centos7

藏色散人
藏色散人forward
2021-05-11 11:26:212626browse

The following tutorial column of centos will introduce to you how to use yum to install the lnmp environment in centos7. I hope it will be helpful to friends in need!

How to use yum to install lnmp environment in centos7

Update yum source
yum update

yum install nginx
Install nginx latest source
yum localinstall http://nginx. org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"
Install nginx
yum -y install nginx
Start nginx
| service nginx start |
Set nginx server to start automatically after booting
systemctl enable nginx.service
Check whether the automatic setting at boot is successful
systemctl list-dependencies | grep nginx

Use yum to install mysql5. 7
Install mysql source
yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"
Install mysql
yum -y install mysql-community-server install mysql-community-devel
Start mysql
service mysqld start
Check whether mysql starts normally
service mysqld status or ps -ef | grep mysql
Set the mysqld service Auto-start at boot
systemctl enable ysqld.service
Check whether mysqld auto-start is set successfully
systemctl list-dependencies | grep mysqld
mysql5.7 In the future, the security mechanism will be strengthened, so use yum to install it. The system will automatically generate a random password at startup and change the mysql password; check the random password of mysql
grep 'temporary password' /var/log/mysqld .log
Use the random password obtained from the query to log in at the terminal
mysql -u root -p Change password (mysql document stipulates that the password must include uppercase and lowercase letters and numbers plus special symbols > 8 digits)
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Yourpassword';
Exit the mysql client and log in with the password you just changed to ensure the password change is successful
exit;mysql -u root -p

Install php7.1
Install php source
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
Check whether the source is installed successfully
yum repolist enabled | grep "webtatic*"
Install php extension source
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 hp71w-pecl-memcached php71w-pecl-redis php71w-opcache

Verify whether php7.1.x and extensions are installed successfully
php -v
Verify whether the corresponding extension is installed successfully
php -m

Set php-fpm and detect the running status of php-fpm
Start php-fpm: service php-fpm star
Check whether the startup is successful: service php-fpm status
Set the auto-start at boot: systemctl enable php-fpm.service
Check whether the auto-start is set successfully
systemctl list-dependencies | grep php -fpm
ps -ef | grep php-fpm

##YUM Install PHP7.4

1.Install source

yum install epel-release

yum install rpms.remirepo.net/enterprise/remi-r...

2.Installation YUM management tool

yum install yum-utils

View PHP (you can ignore this step)

yum search php73

yum search php74

Install PHP

yum install php74-php-gd php74-php-pdo php74-php-mbstring php74-php-cli php74-php-fpm php74-php- mysqlnd

Start FPM

service php74-php-fpm start

The above is the detailed content of How to use yum to install lnmp environment in centos7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete