Phone/WA : 085648390911 | email:support [@ ] sedudohost.com
12 / 100

Artikel ini membahas tentang cara memecahkan masalah yum pada CentOS 7. Artikel ini membahas pesan kesalahan “Could not resolve host: mirrorlist.centos.org; Unknown error”. Kesalahan ini terjadi ketika yum tidak dapat terhubung ke repositori yum CentOS. Ada beberapa cara untuk memperbaikinya.

Kasusnya dimulai ketika ada vps fresh install dengan OS centos 7. karena mau install panel hosting maka diperlukan aplikasi/paket wget untuk mengunduh installer, dengan mengetikan perintah
#yum install wget
tapi malah dapat pesan seperti dibawah ini.
[root@localhost ~]# yum install wget
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.

One of the configured repositories failed (CentOS-7 - Base),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:

1. Contact the upstream for the repository and get them to fix the problem.

2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).

3. Run the command with the repository temporarily disabled
yum --disablerepo=base ...

4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:

yum-config-manager --disable base
or
subscription-manager repos --disable=base

5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:

yum-config-manager --save --setopt=base.skip_if_unavailable=true

failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
saya coba perintah update
[root@localhost ~]# yum update
juga dapat notif sama

Solusi Could not resolve host: mirrorlist.centos.org; Unknown error

1. Salah satu caranya adalah dengan memeriksa pengaturan DNS Anda. pastikan DNS tertulis 8.8.8.8 atau 9.9.9.9, setting dns bisa dicek pada file /etc/resolv.conf. silakan gunakan editor bawaan (vi) untuk mengeditnya dengan mengetikan :

#vi /etc/resolv.conf

kalau belum menggunakan salah satu DNS tersebut silakan edit, lalu ketikkan perintah

#yum clean all

lalu

#yum update
2. Jika pengaturan DNS Anda benar tapi masih error, Anda dapat mencoba solusi kedua yaitu menggunakan mirror yang berbeda. untuk setting repo berada pada file /etc/yum.repos.d/CentOS-Base.repo, ingat sebelum anda merubah file tersebut HARUS ANDA BACKUP DULU. Ketik perintah

#cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

lalu ketik perintah 
#vi /etc/yum.repos.d/CentOS-Base.repo
lalu ganti list repo yang ada dengan list berikut:
[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

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

[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/7.9.2009/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Pada Juli 2024, mirrorlist.centos.org tidak lagi digunakan, sebagai gantinya, Anda harus menggunakan vault.centos.org.