搜索
简帛阁>技术文章>CentOS yum配置国内源

CentOS yum配置国内源

参考网页
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

参考网页https://blogcsdnnet/xiaojin21cen/article/details/84726193(1)、首先备份CentOSBaserepomv/etc/yumreposd/
1,进入yum配置目录cd/etc/yumreposd2,备份系统自带的yummvCentOSBaserepoCentOSBaserepobk下载163网易的yum:wgethttp://mi
CentOS8更改了软件包的安装程序,取消了yum配置方法,改而使用了dnf作为安装程序。虽然改变了软件包的安装方式,但是dnf还是能兼容使用yum的配置文件的和命令的使用方法的。这里也就不过多讲
我们通常使用yuminstall命令来在线安装linux系统的软件,这种方式可以自动处理依赖性关系,并且一次安装所有依赖的软体包,但是经常会遇到从国外镜像下载速度慢,无法下载的情况。那么此时我们就需要
在安装完CentOS后为了加快安装、更新rpm包的速度。需要将yum改为国内国内比较快的源有中科大、163、sohu。下面修改为163为例子:首先进入配置目录:执行cd/etc/yumr
Centos8Yum换阿里云//下载阿里云源文件wgetO/etc/yumreposd/CentOSBaserepohttps://mirrorsaliyuncom/repo/Centos8rep
国内yum网易(163)yum国内最好的yum之一,无论是速度还是软件版本,都非常的不错。将yum设置为163yum,可以提升软件包安装和更新的速度,同时避免一些常见软件版本无法找到。安装
http://blogcsdnnet/pkueecser/article/details/8836973重要:存放路径cd/etc/yumreposd首先备份CentOSBaserepomv/etc/
CentOS8修改yum国内由于国内网络原因,如果你的服务器在国内的话,在CentOS上安装一些软件速度可能会很慢,因此建议将yum改为国内,比如阿里云,方式如下:环境:CentOS81备份
这里以使用163为例确保已安装下载组件wgetyumyinstallwget先备份/etc/yumreposd/CentOSBaserepo(改名)mv/etc/yumreposd/CentOSB