云网牛站
所在位置:首页 > Linux教程 > 在CentOS 7系统中采用清华源IPv6来安装epel与ius源

在CentOS 7系统中采用清华源IPv6来安装epel与ius源

2018-10-06 09:24:19作者:傅易稿源:linux网

因为 epel 与 ius 源可以提供很多实用的软件,所以我们可以在 CentOS 7 系统中采用清华源 IPv6 来安装 epel、ius,只需要简单的配置就行了,以下是配置的方法,要在 root 权限中进行操作。

 

CentOS 7 系统使用 yum 包管理器,yum 的软件源配置文件存放于 /etc/yum.repos.d/ 目录下。

 

备份并删除所有的 CentOS-*.repo条目,创建 centos.repo 文件:

[base]

name=CentOS-$releasever - Base

baseurl=https://mirrors6.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates

[updates]

name=CentOS-$releasever - Updates

baseurl=https://mirrors6.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

baseurl=https://mirrors6.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

baseurl=https://mirrors6.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 

注意:这里使用了 RPM-GPG-KEY-CENTOS-7 来验证软件源。该文件已默认下载,否则可以从清华源根目录下获取。

 

执行 yum update 命令更新。

 

执行 yum install epel-release,这会自动设置新的软件源,也会安装 RPM-GPG-KEY-EPEL-7。

 

备份并移除所有的 epel*.repo 条目,创建 epel.repo文件:

[epel]

name=Extra Packages for Enterprise Linux 7 - $basearch

baseurl=https://mirrors6.tuna.tsinghua.edu.cn/epel/7/$basearch

#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch

failovermethod=priority

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]

name=Extra Packages for Enterprise Linux 7 - $basearch - Debug

baseurl=https://mirrors6.tuna.tsinghua.edu.cn/epel/7/$basearch/debug

#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch

failovermethod=priority

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

gpgcheck=1

[epel-source]

name=Extra Packages for Enterprise Linux 7 - $basearch - Source

baseurl=https://mirrors6.tuna.tsinghua.edu.cn/epel/7/SRPMS

#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch

failovermethod=priority

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

gpgcheck=1

 

执行 yum update 命令更新。

 

ius 源需要从 ius 网站下载 rpm 包,直接链接为 https://centos7.iuscommunity.org/ius-release.rpm。要提醒的是,这一步没办法使用 IPv6 免流量。

 

下载完成后 yum install ius-release.rpm 安装,然后类似于上面的 epel 安装过程,备份移除 ius*.repo 后,创建 ius.repo 文件:

[ius]

name=IUS Community Packages for Enterprise Linux 7 - $basearch

baseurl=https://mirrors6.tuna.tsinghua.edu.cn/ius/stable/CentOS/7/$basearch

#mirrorlist=https://mirrors.iuscommunity.org/mirrorlist?repo=ius-centos7&arch=$basearch&protocol=http

failovermethod=priority

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY

[ius-debuginfo]

name=IUS Community Packages for Enterprise Linux 7 - $basearch - Debug

baseurl=https://mirrors6.tuna.tsinghua.edu.cn/ius/stable/CentOS/7/$basearch/debuginfo

#mirrorlist=https://mirrors.iuscommunity.org/mirrorlist?repo=ius-centos7-debuginfo&arch=$basearch&protocol=http

failovermethod=priority

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY

[ius-source]

name=IUS Community Packages for Enterprise Linux 7 - $basearch - Source

baseurl=https://mirrors6.tuna.tsinghua.edu.cn/ius/stable/CentOS/7/SRPMS

#mirrorlist=https://mirrors.iuscommunity.org/mirrorlist?repo=ius-centos7-source&arch=source&protocol=http

failovermethod=priority

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY

 

执行 yum update 命令更新。

 

至此,安装 epel 与 ius 源就完成了。

 

相关主题

让阿里云ECS服务器centos 7系统支持IPv6的方法

精选文章
热门文章