Summary
How to solve the 404 error using yum command in different versions of openEuler. This article is aimed at the problem of version 21.03 of openEuler. By analogy, I personally think that the solution to this problem should be the same for different versions of openEuler. If you encounter such a problem in the future, you can first check whether the address of the official website is consistent with the address in the openEuler.repo file. Replace them with the same address as the official website to solve the problem.
Problem Description
When I received the new system, when I needed to install some software in the new system, I used the yum command to report the following error:
openEuler-source 721 B/s | 146 B 00:00 Errors during downloading metadata for repository 'openEuler-source': - Status code: 404 for https://repo.openeuler.org/openEuler-21.03/source/repodata/repomd.xml Error: Failed to download metadata for repo 'openEuler-source': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
The solution I found online is basically as follows:
#Turn off the firewall and selinux and restart
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
systemctl disable --now firewalld
# distribution source
vim /etc/yum.repos.d/openEuler.repo
...
#Update yum source
yum makecache
I tried the above method, but it couldn't solve the problem. Later, I suddenly saw the solution of other versions of Euler and was inspired.
Solution
1. First go to Euler’s official address: https://archives.openeuler.openatom.cn/
Find our corresponding Euler version. There will be a prompt in the error message. In the above error message, my Euler version is 21.03.
2. Configure the Euler source according to the official address
vim /etc/yum.repos.d/openEuler.repo
When modifying, back up an openEuler.repo file first to avoid problems.
3. Open the openEuler.repo file configuration
From the above, we can see that all the paths inside are inconsistent with the corresponding version of openEuler provided by our official website.
The address provided in this file is: https://repo.openeuler.org/openEuler-21.03
Euler official website address: https://archives.openeuler.openatom.cn/openEuler-21.03/
4. Replace all paths in the openEuler.repo file to be consistent with the current official website
Finally I replaced the result as follows:
[openEuler-source]
name=openEuler-source
baseurl=https://archives.openeuler.openatom.cn/openEuler-21.03/source/
enabled=1
gpgcheck=1
gpgkey=https://archives.openeuler.openatom.cn/openEuler-21.03/source//RPM-GPG-KEY-openEuler
[openEuler-os]
name=openEuler-os
baseurl=https://archives.openeuler.openatom.cn/openEuler-21.03/OS/x86_64/
enabled=1
gpgcheck=1
gpgkey=https://archives.openeuler.openatom.cn/openEuler-21.03/OS/x86_64/RPM-GPG-KEY-openEuler
[openEuler-everything]
name=openEuler-everything
baseurl=https://archives.openeuler.openatom.cn/openEuler-21.03/everything/x86_64/
enabled=1
gpgcheck=1
gpgkey=https://archives.openeuler.openatom.cn/openEuler-21.03/everything/x86_64/RPM-GPG-KEY-openEuler
[openEuler-EPOL]
name=openEuler-epol
baseurl=https://archives.openeuler.openatom.cn/openEuler-21.03/EPOL/x86_64/
enabled=1
gpgcheck=0
[openEuler-update]
name=openEuler-update
baseurl=https://archives.openeuler.openatom.cn/openEuler-21.03/update/x86_64/
enabled=1
gpgcheck=0
5. Update yum source
yum makecache
6. Test
yum update
Success is considered as no problem. This is a screenshot of the naming I used after updating it twice.