前言
在使用Openeuler的yum源的时候速度很慢,而且因为安全设备的原因有时会将Openeuler系统自带的yum源拦截,所有我们需要更换为第三方源。
一、查看系统版本及架构
#cat /etc/*-release --查看系统版本
#lscpu --查看CPU架构
我用的是X86_64架构的22.03-LTS-SP4版本,根据自己的架构及版本型号来选择源,有些源因为版本没有的。
二、官网查找合适的源
大家根据自己版本选择
Openeuler官网网址链接: link
有些版本列出的源不知道是哪的,选择全部镜像仓,选择合适的源。我用的aliyun的。
找到自己需要的版本
三、更换yum源
1.备份原有yum源
Openeuler的yum源文件在/etc/yum.repos.d/openEuler.repo下
mv /etc/yum.repos.d/openEuler.repo /etc/yum.repos.d/openEuler.repo.bak
rm -rf /etc/yum.repos.d/openEuler.repo
2.新建源文件
vi /etc/yum.repos.d/openEuler.repo
在文件内写入代码(我用的aliyun)
#generic-repos is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.
[OS]
name=OS
baseurl=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/OS/$basearch/RPM-GPG-KEY-openEuler
[everything]
name=everything
baseurl=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/everything/$basearch/RPM-GPG-KEY-openEuler
[EPOL]
name=EPOL
baseurl=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/EPOL/main/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/OS/$basearch/RPM-GPG-KEY-openEuler
[debuginfo]
name=debuginfo
baseurl=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[source]
name=source
baseurl=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/source/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/source/RPM-GPG-KEY-openEuler
[update]
name=update
baseurl=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/update/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/openeuler/openEuler-22.03-LTS-SP4/OS/$basearch/RPM-GPG-KEY-openEuler
3.更新yum源缓存
sudo yum clear all --清除缓存
sudo yum makecache --更新源
四、其他yum源更换
如需更换其他源仅需更换网址即可,
更换源可用vi编辑器的批量替换,但替换内容中不可出现“/”符号,如:
:%s/old/new/g
更换后: