centos8 配置阿里源

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

一、备份CentOS-Base.repo文件
    cd /etc/yum.repos.d
    cp CentOS-Base.repo CentOS-Base.repo.bak
    二、配置文件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

最后执行命令:centos

dnf clean all # 清除全部的缓存文件
    dnf makecache # 制做元数据缓存