如何配置EPEL仓库和Remi仓库
时间: 2024-08-17 15:03:24 浏览: 106
一个依赖 Remi 和 EPEL 的 LNMP 堆栈,非一键包
EPEL (Extra Packages for Enterprise Linux) 和 Remi仓库都是提供额外软件包给企业级Linux发行版的第三方存储库。以下是安装配置它们的基本步骤:
**配置EPEL仓库:**
1. **对于RHEL/CentOS 7**: 首先,你需要添加EPEL GPG公钥:
```
curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$(__grep ^release .*/etc/os-release | cut -d= -f2)
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
```
2. 添加EPEL仓库至 `/etc/yum.repos.d/epel.repo` 或创建一个新的文件,内容如下:
```bash
[epel]
name=EPEL $releasever - $basearch
mirrorlist=https://mirrors.fedoraproject.org/mirrors-list/?repo=epel-$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=https://mirrors.fedoraproject.org/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
```
3. 更新yum缓存并开始安装:
```
yum makecache fast
yum install <package_name>
```
**配置Remi仓库:**
1. 对于CentOS 6/7/8和Fedora,首先访问Remi官网下载对应版本的GPG密钥:
- CentOS 6: http://rpms.remirepo.net/enterprise/remi-release-6.rpm.gpg
- CentOS 7: http://rpms.remirepo.net/enterprise/remi-release-7.rpm.gpg
- CentOS 8: http://rpms.remirepo.net/enterprise/remi-release-8.rpm.gpg
- Fedora: http://rpms.remirepo.net/fedora/remi-release.rpm.gpg
将文件保存到本地,并导入:
```
rpm --import <filename>
```
2. 在 `/etc/yum.repos.d/remi.repo` 文件中加入Remi仓库信息:
```
[remi]
name=Remi's RPM repository for Enterprise Linux $releasever - $basearch
baseurl=http://rpms.remirepo.net/enterprise/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=<gpg_key_url>
```
3. 更新和安装软件包:
```
yum makecache fast
yum install <package_name>
```
记得替换 `<package_name>` 为你想安装的具体软件包名。
阅读全文