0%

Add CentOS yum repo in Redhat system

In Redhat system, you should buy it to use. However, CentOS is
free and almost same with related Redhat system. So after we
add the CentOS yum repo, then we can directly use Redhat system.
(If you already have a CentOS, please use it directly)

We can add the repo configuration file in /etc/yum.repos.d/ like:

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
# 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=http://mirror.centos.org/altarch/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirror.centos.org/altarch/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirror.centos.org/altarch/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64

but it also goes wrong.

here we should replace the variable “$releasever” and “$basearch” to the
specific one which we want to use. you can search in http://mirror.centos.org/altarch/
to see which repo you will use.

In my case, I will use:

1
2
3
[base]
name=CentOS-base
baseurl=http://mirror.centos.org/altarch/7.4.1708/os/aarch64/

and I also remove gpgcheck related lines.

It works fine with me :)