腾讯自家的源少一些东西,换!
yum的配置文件
yum 的配置文件在 /etc/yum.repos.d 目录下,
其中有多个配置文件,每一个配置文件中都可以配置一个或多个repository,
但是最终会被合并为一个交给系统,所以多个文件只是为了方便管理。
先清理下 /etc/yum.repos.d 目录 把里面的内容删光。
- 先进入文件夹看看里面的东西多不
- cd /etc/yum.repos.d
- 在删除yum.repos.d里的所有东西
- rm -rf *
复制代码
新建.repo
- vim /etc/yum.repos.d/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
- # geographically close to the client. You should use this for CentOS updates
- # unless you are manually picking other mirrors.
- #
- # If the mirrorlist= does not work for you, as a fall back you can try the
- # remarked out baseurl= line instead.
- #
- #
- [base]
- name=CentOS-$releasever - Base
- baseurl=https://mirrors.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://mirrors.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://mirrors.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://mirrors.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
复制代码
3、epel源 安装和配置
(1)、可忽略 查看可用的epel源
- yum list | grep epel-release
复制代码
显示内容为 :epel-release.noarch 7-11 extras
(2)、安装 epel
- yum install -y epel-release
复制代码
(3)、配置阿里镜像提供的epel源
- wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
复制代码
(4)、清除缓存
- yum clean all # 清除系统所有的yum缓存
- yum makecache # 生成yum缓存
复制代码
3.1、查看yum源
查看所有的yum源:
查看可用的yum源:
|