什么是yum源

yum源可以理解为redhat系统的软件商店,可以从yum中下载安装软件

什么时候需要配置yum源

  • redhat系统默认带了yum源,但包含的软件并不是很全,为了安装某些软件,我们必须得先添加相应的yum源
  • redhat自带的yum源,有时会出现无法连接,或者速度奇慢,需要修改为国内网易源、阿里源等更加稳定快速的源

wegt进行下载

查看默认yum源

我的yum源已经配置好了,你们如果没有过进行配置的话该目录下应该都是 Centos的源

[root@localhost ~]# ls /etc/yum.repos.d/
CentOS7-Base-163.repo  docker-ce.repo  epel.repo  kubernetes.repo

删除默认的所有源

[root@localhost ~]# rm -rf /etc/yum.repos.d/*

安装网易的yum源

wget -P /etc/yum.repos.d/ http://mirrors.163.com/.help/CentOS7-Base-163.repo

网易yum源

配置epel源

wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

阿里云epel源

配置yum仓库

创建一个存放清华yum源的仓库

[root@localhost ~]#  vim /etc/yum.repos.d/qinghua.repo

写入配置文件

    [qinghua]
    name = Centos 7 qinghua repo
    baseurl = https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/
    gpgcheck = 1
    gpgkey = https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7
阿里云yum源
网易yum源

可以去网易和阿里云的镜像源官网去查看yum源的仓库配置文件