码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS yum配置国内源

时间:2021-01-19 12:28:46      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:article   pmi   call   and   sed   clean   查看   not work   href   

参考网页
https://blog.csdn.net/xiaojin21cen/article/details/84726193

(1)、首先备份 CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

1

(2)、之后启用 TUNA 软件仓库, 将清华大学镜像仓库信息写入 /etc/yum.repos.d/CentOS-Base.repo

vim /etc/yum.repos.d/CentOS-Base.repo

1

将 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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

(3)、清除缓存

yum clean all # 清除系统所有的yum缓存
yum makecache # 生成yum缓存

1
2

3、epel源 安装和配置

(1)、查看可用的epel源

[java@localhost yum.repos.d]$ yum list | grep epel-release
epel-release.noarch 7-11 extras
[java@localhost yum.repos.d]$

1
2
3

(2)、安装 epel

[java@localhost yum.repos.d]$ yum install -y epel-release
......省略.....

1
2

(3)、配置阿里镜像提供的epel源

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

1

(4)、清除缓存

yum clean all # 清除系统所有的yum缓存
yum makecache # 生成yum缓存

1
2

3.1、查看yum源

查看所有的yum源:

yum repolist all

1

查看可用的yum源:

yum repolist enabled

CentOS yum配置国内源

标签:article   pmi   call   and   sed   clean   查看   not work   href   

原文地址:https://www.cnblogs.com/iforrest/p/14296513.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!