centos8 配置阿里源

CentOS 8更改了安装程序,改而使用了dnf 作为安装程序。虽然新增了软件包的安装方式,但是 yum命令还是可以正常使用。
centos8 配置阿里源

    1、备份CentOS-Base.repo文件
    cd /etc/yum.repos.d
    cp CentOS-Base.repo CentOS-Base.repo.bak
    2、配置文件vim tOS- CentOS-Base.repo

    # CentOS-Base.repo
    The mirror system uses the connecting IP address of the client and the
    #update status of each mirror to pick mirrors that are updated to and
    #eographically close to the client.  You should use this for CentOS updates
    #nless you are manually picking other mirrors.

    [base]
    name=CentOS-$releasever - Base - mirrors.aliyun.com
    failovermethod=priority
    baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
    http://mirrors.aliyuncs.com/centos/$releasever/BaseOS/$basearch/os/
    http://mirrors.cloud.aliyuncs.com/centos/$releasever/BaseOS/$basearch/os/
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

    #additional packages that may be useful 
    [extras]
    name=CentOS-$releasever - Extras - mirrors.aliyun.com
    failovermethod=priority
    baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
    http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/os/
    http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/os/
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

#additional packages that extend functionality of existing packages
[centosplus]
    name=CentOS-$releasever - Plus - mirrors.aliyun.com
    failovermethod=priority
    baseurl=https://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/os/
    http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/os/
    http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/os/
    gpgcheck=1
    enabled=0
    gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

    [PowerTools]
    name=CentOS-$releasever - PowerTools - mirrors.aliyun.com
    failovermethod=priority
    baseurl=https://mirrors.aliyun.com/centos/$releasever/PowerTools/$basearch/os/
    http://mirrors.aliyuncs.com/centos/$releasever/PowerTools/$basearch/os/
    http://mirrors.cloud.aliyuncs.com/centos/$releasever/PowerTools/$basearch/os/
    gpgcheck=1
    enabled=0
    gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

    [AppStream]
    name=CentOS-$releasever - AppStream - mirrors.aliyun.com
    failovermethod=priority
    baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
    http://mirrors.aliyuncs.com/centos/$releasever/AppStream/$basearch/os/
    http://mirrors.cloud.aliyuncs.com/centos/$releasever/AppStream/$basearch/os/
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

    [centosplus]
    name=CentOS-$releasever - Plus - mirrors.aliyun.com
    failovermethod=priority
    baseurl=https://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/os/
    http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/os/
    http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/os/
    gpgcheck=1
    enabled=0
    gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

最后执行命令:

    dnf clean all # 清除所有的缓存文件
    dnf makecache # 制作元数据缓存
文章来自:https://blog.51cto.com/11353391/2486246
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3