1,配置CentOs8的yum源
vim /etc/yum.repos.d/CentOS-AppStream.repo
[AppStream]
name=CentOS-$releasever - AppStream
baseurl=http://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
vim /etc/yum.repos.d/CentOS-Base.repo
[BaseOS]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
vim /etc/yum.repos.d/CentOS-Epel.repo
[epel]
name=CentOS-$releasever - Epel
baseurl=http://mirrors.aliyun.com/epel/8/Everything/$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
2,yum源配置成功后
yum clean all #命令清除yum缓存元数据
3,yum makecache #重新建立yum缓存
4,安装epel存储库
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
5,确认epel库是否安装成功
rpm -qa | grep epel
6,安装remi存储库
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
7,确认remi存储库是否安装成功
8,成功添加EPEL和Remi存储库后,执行以下命令以获取可用PHP模块流的列表
dnf module list php
9,dnf module reset php #重置php模块
10,根据第八步中的php流模块,启用对应php版本的流模块,这里我们安装的是php7.4的版本,所以启用remi-7.4版本的流
dnf module enable php:remi-7.4
11,安装PHP,此命令还安装许多其他软件包
dnf install php php-cli php-common