不得不说OpenCloudOS真的不够成熟稳定,建议大家服务器不要使用!
首先本文能帮你解决的问题是:OpenCloudOS无法使用yum、OpenCloudOS正确的yum源配置方式、OpenCloudOS如何安装epel源
YUM国内镜像源配置
如果比较懒,可以选择直接复制我的镜像源文件内容过去。但是记得把原本的镜像源文件备份一下再建新的,命令如下
cd /etc/yum.repos.d/
ls -al
mv 原本文件名 原本文件名.bak #目录下有几个文件这条命令就执行几次
vim OpenCloudOS.repo
按i进入编辑,然后粘贴下面所有内容
# OpenCloudOS.repo
#
# Author: OpenCloudOS <infrastructure@opencloudos.tech>
#
[BaseOS]
name=OpenCloudOS $releasever - Base
baseurl=https://mirrors.pku.edu.cn/opencloudos/$releasever/BaseOS/$basearch/os/
baseurl=https://mirrors.tencent.com/opencloudos/$releasever/BaseOS/$basearch/os/
#baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS
[AppStream]
name=OpenCloudOS $releasever - AppStream
baseurl=https://mirrors.pku.edu.cn/opencloudos/$releasever/AppStream/$basearch/os/
baseurl=https://mirrors.tencent.com/opencloudos/$releasever/AppStream/$basearch/os/
#baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS
[Extras]
name=OpenCloudOS $releasever - Extras
baseurl=https://mirrors.pku.edu.cn/opencloudos/$releasever/extras/$basearch/os/
baseurl=https://mirrors.tencent.com/opencloudos/$releasever/extras/$basearch/os/
#baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS
[HighAvailability]
name=OpenCloudOS $releasever - HighAvailability
baseurl=https://mirrors.pku.edu.cn/opencloudos/$releasever/HighAvailability/$basearch/os/
baseurl=https://mirrors.tencent.com/opencloudos/$releasever/HighAvailability/$basearch/os/
#baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/HighAvailability/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS
[PowerTools]
name=OpenCloudOS $releasever - PowerTools
baseurl=https://mirrors.pku.edu.cn/opencloudos/$releasever/PowerTools/$basearch/os/
baseurl=https://mirrors.tencent.com/opencloudos/$releasever/PowerTools/$basearch/os/
#baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS
[ResilientStorage]
name=OpenCloudOS $releasever - ResilientStorage
baseurl=https://mirrors.pku.edu.cn/opencloudos/$releasever/ResilientStorage/$basearch/os/
baseurl=https://mirrors.tencent.com/opencloudos/$releasever/ResilientStorage/$basearch/os/
#baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/ResilientStorage/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS
[Plus]
name=OpenCloudOS $releasever - Plus
baseurl=https://mirrors.pku.edu.cn/opencloudos/$releasever/Plus/$basearch/os/
baseurl=https://mirrors.tencent.com/opencloudos/$releasever/Plus/$basearch/os/
#baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Plus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS
详细过程和可能出现的问题讲解
由于旧服务器到期,租了新的腾讯云服务器,这次尝鲜装了OpenCloudOS9系统,然后今天在用yum安装软件时候根据网上教程配置了镜像源,但是在执行yum命令安装我想要的软件时报错
Errors during downloading metadata for repository 'Extras':
- Status code: 404 for https://mirrors.tencent.com/opencloudos/9/Extras/x86_64/os/repodata/repomd.xml (IP: 169.254.0.3)
Error: Failed to download metadata for repo 'Extras': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
这个报错是告诉我们这个Extras模块配置路径找不到,我复制到浏览器看了下确实不存在,我于是循着路径规则查看了上级目录,一直到https://mirrors.tencent.com/opencloudos/9这一级都是正常的(国内镜像源也都是同步的国外开源网站镜像,国外镜像网站打开看过也都是一样的),其中内容如下图:
我们都知道Linux对于大小写是敏感的,很显然这里extras是小写。于是我回到yum源配置把它改正,但是再次执行yum安装仍然报错
Errors during downloading metadata for repository 'HighAvailability':
- Status code: 404 for https://mirrors.tencent.com/opencloudos/9/HighAvailability/x86_64/os/repodata/repomd.xml (IP: 169.254.0.3)
Error: Failed to download metadata for repo 'HighAvailability': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
这里报错告诉我们HighAvailability模块路径找不到,我们可以看到腾讯镜像源地址中是只有BaseOS、AppStream、extras、isos的,根本不存在HighAvailability目录,那么我们在镜像源里取消HighAvailability不就好了么,于是打开OpenCloudOS.repo文件找到HighAvailability将它的enabled改为0关闭它。我本以为这下没问题了,结果我还是太天真,如果大家对源配置内容有印象大概会发现,它还有很多镜像库中不存在的路径指向,于是继续报错
前面报错过一个HighAvailability
========================这是不同报错的分割线=======================
Errors during downloading metadata for repository 'PowerTools':
- Status code: 404 for https://mirrors.tencent.com/opencloudos/9/PowerTools/x86_64/os/repodata/repomd.xml (IP: 169.254.0.3)
Error: Failed to download metadata for repo 'PowerTools': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
========================这是不同报错的分割线=======================
Errors during downloading metadata for repository 'ResilientStorage':
- Status code: 404 for https://mirrors.tencent.com/opencloudos/9/ResilientStorage/x86_64/os/repodata/repomd.xml (IP: 169.254.0.3)
Error: Failed to download metadata for repo 'ResilientStorage': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
========================这是不同报错的分割线=======================
Errors during downloading metadata for repository 'Plus':
- Status code: 404 for https://mirrors.tencent.com/opencloudos/9/Plus/x86_64/os/repodata/repomd.xml (IP: 169.254.0.3)
Error: Failed to download metadata for repo 'Plus': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
我们将这些模块的enabled都改为0,全部不用它,于是终于我们的yum可用了!
但是!但是!但是!
epel源安装
还有一个问题。。。我要安装的软件在OpenCloudOS官方源中不存在(这种情况很常见),所以我需要伟大的epel源,但是发根本装不了,因为不存在。。。
[root@lighthouse yum.repos.d]# yum install epel-release
Last metadata expiration check: 0:09:06 ago on Thu 06 Jun 2024 12:09:21 PM CST.
No match for argument: epel-release
Error: Unable to find a match: epel-release
于是网上找到了这样一条命令,成功安装!
curl -o /etc/yum.repos.d/epel-OpenEuler.repo https://down.whsir.com/downloads/epel-OpenEuler.repo
是的,这似乎是一位大佬做的OpenEuler的epel源,OpenCloudOS也可以用!感谢!
下载了这个epel镜像源之后我所想安装的软件终于千呼万唤始出来!!!
以上是本次所遇到的问题分享!