centOS修改 yum 源

1、切换centOS源:
// 进入镜像源目录
cd /etc/yum.repos.d

// 备份 CentOS-Base.repo
mv CentOS-Base.repo CentOS-Base.repo.bk

// 获取阿里CentOS-Base.repo
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo  

// 备份epel.repo
mv epel.repo epel.repo.bk 

// 获取阿里epel.repo
wget -O epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

 

  2、配置 mariadb 源(阿里云):

// 打开文件
vi /etc/yum.repos.d/MariaDB.repo

// 输入以下内容并保存
[mariadb]
name = MariaDB
baseurl = https://mirrors.aliyun.com/mariadb/yum/10.4/centos7-amd64/
gpgkey=https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

//或者使用中国科学技术大学的源
[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

 

 

3、重新生成缓存并查看

5.清理缓存
    yum clean all
6.重新生成缓存
    yum makecache
7. 再次查看yum源信息
   yum repolist

 



其他源:
# 安装epel repo源:
epel(RHEL 7) 红帽7
   wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
epel(RHEL 6) 红帽6
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
epel(RHEL 5) 红帽5
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo

 



posted @ 2020-04-16 22:58  小寒1206  阅读(228)  评论(0)    收藏  举报