目录

RHEL 7 配置CentOS源

目录

###安装EPEL 下载EPEL RPM安装包,目前最新的版本是epel-release-7-5.noarch.rpm,如果链接无效,可以在http://dl.fedoraproject.org/pub/epel/7/x86_64/e/找到对应的rpm包即可

下载

1
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

安装

1
yum install epel-release-7-5.noarch.rpm

查看是否安装成功

1
yum repolist

###redhat配置centos源

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

将一下内容复制到文件中

 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
44
45
46
47
48
49
50
51
52
53
[base]

name=CentOS-5-Base

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os

#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

baseurl=http://ftp.sjtu.edu.cn/centos/7/os/$basearch/

gpgcheck=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

#released updates

[updates]

name=CentOS-$releasever – Updates

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

baseurl=http://ftp.sjtu.edu.cn/centos/7/updates/$basearch/

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[extras]

name=CentOS-$releasever – Extras

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

baseurl=http://ftp.sjtu.edu.cn/centos/7/extras/$basearch/

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[centosplus]

name=CentOS-$releasever – Plus

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

baseurl=http://ftp.sjtu.edu.cn/centos/7/centosplus/$basearch/

gpgcheck=0

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

执行以下命令

1
2
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
rpm -qa gpg-pubkey