centos7yum安装lnmp(php7.4)

安装nginx

cd /etc/yum.repos.d/#进入源目录

vim nginx.repo #新建且编写nginx源文件 
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

#测试yum 源是否设置成功
yum list | grep nginx

yum -y install nginx

nginx配置文件目录 /etc/nginx/conf.d/

关闭防火墙

systemctl stop firewalld.service            #停止firewall
systemctl disable firewalld.service        #禁止firewall开机启动

systemctl start nginx

systemctl enable nginx


安装php7.4

安装yum-utils并启用EPEL存储库
yum install -y epel-release yum-utils 

使用yum命令下载并安装remirepo
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

要配置PHP 7.4存储库,请使用以下命令
yum-config-manager --enable remi-php74

安装php
yum install -y php php-fpm  php-common php-opcache php-mcrypt php-cli php-mysql php-dom php-simplexml php-ssh2 php-xml php-xmlreader php-curl php-date php-exif php-filter php-ftp php-gd php-hash php-iconv php-json php-libxml php-pecl-imagick php-mbstring php-mysqlnd php-openssl php-pcre php-posix php-sockets php-spl php-tokenizer php-zlib php-zip

查看可安转的php其他扩展
yum search php74 | more

systemctl start php-fpm

systemctl enable php-fpm

安装php7.2

yum install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum list installed | grep php 查询是否安装


yum -y install  php72w-fpm php72w-cli php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-pdo php72w-xml php72w-pear php72w-devel 


安装mysql5.7

设置 mysql 的 yum 源
rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

查看 yum 源
yum list | grep mysql

关闭 80 包,开启 57 包
yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community

yum -y install mysql-community-server mysql-community-client

systemctl start mysqld
systemctl enable mysqld

查看默认的密码
cat /var/log/mysqld.log | grep "A temporary password is generated for root"

修改密码
mysql -uroot -p#后面跟刚才查看的密码

set password for root@localhost = password('你的密码');
#如果提示错误,那是因为 mysql57 对密码的复杂度进行了限制,依次执行下列命令,取消复杂度限制,再修改
set global validate_password_policy=0;
set global validate_password_mixed_case_count=0;
set global validate_password_number_count=3;
set global validate_password_special_char_count=0;
set global validate_password_length=3;
set global validate_password_policy=LOW;

设置编码

vim /etc/my.cnf
#添加如下内容
character_set_server=utf8
init_connect='SET NAMES utf8'

重启mysql
systemctl restart mysqld
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值