centos8安裝php7.4


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

12,查看php是否安裝成功


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM