Rocky Linux 9.1 安装 PHP Remi 源

作者: 温新

分类: 【Linux】

阅读: 1142

时间: 2023-03-08 16:23:33

hi,我是温新,一名 PHPer

如何快速安装最新版 PHP?源码安装?二进制安装?本篇文章将介绍使用 Remi 源快速安装自己想要的 PHP 版本。

Remi 源

<span class="md-plain md-expand" style="box-sizing: border-box; color: rgb(40, 44, 52); font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", sans-serif; orphans: 4; text-align: justify; white-space: pre-wrap; word-spacing: 0.8px; background-color: rgb(254, 254, 254);">官方网址:<span class="md-link md-pair-s md-expand" style="box-sizing: border-box; word-break: break-all; color: rgb(40, 44, 52); font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", sans-serif; orphans: 4; text-align: justify; white-space: pre-wrap; word-spacing: 0.8px; background-color: rgb(254, 254, 254);">http://rpms.remirepo.net

Remi 源维护了大量 PHP 软件包。其主要目标是提供最新版本的 PHP 安装包,并对 PHP 提供全方位支持。

简单地说,可以用它安装自己想要的 PHP 版本。

Rocky Linux 9.1 安装 Remi 源

第一步:安装 EPEL 源

Remi 源依赖于 EPEL 源,因此首先要安装 EPEL 源。

<span style="box-sizing: border-box;color: rgb(171, 178, 191);padding-right: 0.1px"><span style="box-sizing: border-box;color: rgb(98, 151, 85) !important"># Rocky Linux 9.1 安装 EPEL</span></span><br></br><span style="box-sizing: border-box;color: rgb(171, 178, 191);padding-right: 0.1px"><span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">sudo</span> <span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">dnf</span> <span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">install</span> <span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">\</span></span><br></br><span style="box-sizing: border-box;color: rgb(171, 178, 191);padding-right: 0.1px">    <span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">https</span>:<span style="box-sizing: border-box;color: rgb(98, 151, 85) !important">//dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \</span></span><br></br><span style="box-sizing: border-box;color: rgb(171, 178, 191);padding-right: 0.1px">    <span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">https</span>:<span style="box-sizing: border-box;color: rgb(98, 151, 85) !important">//dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm</span></span>

第二步:安装 Remi 源

<span style="box-sizing: border-box;color: rgb(171, 178, 191);padding-right: 0.1px"><span style="box-sizing: border-box;color: rgb(98, 151, 85) !important"># 可以换成国内镜像</span></span><br></br><span style="box-sizing: border-box;color: rgb(171, 178, 191);padding-right: 0.1px"><span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">sudo</span> <span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">dnf</span> <span style="box-sizing: border-box;color: rgb(86, 182, 194) !important">-</span><span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">y</span> <span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">install</span> <span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">http</span>:<span style="box-sizing: border-box;color: rgb(98, 151, 85) !important">//rpms.remirepo.net/enterprise/remi-release-9.rpm</span></span><br></br><span style="box-sizing: border-box;color: rgb(171, 178, 191);padding-right: 0.1px"><span style="box-sizing: border-box;color: rgb(98, 151, 85) !important"># 安装 dnf-utils 包,提供启用、禁用源等实用功能</span></span><br></br><span style="box-sizing: border-box;color: rgb(171, 178, 191);padding-right: 0.1px"><span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">sudo</span> <span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">dnf</span> <span style="box-sizing: border-box;color: rgb(86, 182, 194) !important">-</span><span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">y</span> <span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">install</span> <span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">dnf</span><span style="box-sizing: border-box;color: rgb(86, 182, 194) !important">-</span><span style="box-sizing: border-box;color: rgb(18, 170, 228) !important">utils</span></span>

Remi 源安装完成后,会在 /etc/yum.repos.d 目录中生成remi.reporemi-safe.repo 等文件。

请登录后再评论