openEuler repo 前言
一键创建在线repo,脚本自动识辨系统无须更改,默认脚本走的是华为更改变量即可$repo_url即可。
openEuler Repo 一键更改脚本
- 兼容一键替换openEuler repo 20 21 22 23 24自动识辨
- 清华大学 openEuler repo
- 华为云源 openEuler repo
- 阿里云 openEuler repo
- openEuler 官方拉取慢,位置香港 repo
- 开源镜像源大全 参考
vi /openEuler_repo.sh
#!/bin/bash
# -*- coding: utf-8 -*-
# Author: make.han
# Email: CIASM@CIASM
# Date: 2024/07/31
# openEuler repo 20 21 22 23 24
echo "Delete default all repo"
rm -rf /etc/yum.repos.d/*
repo_name=huawei
basearch='$basearch'
repo_url='http://repo.huaweicloud.com'
openeuler_catalogue=openeuler
# check system version
NAME=$(cat /etc/os-release | grep "^NAME=" | cut -d'=' -f2 | tr -d '"')
VERSION_ID=$(cat /etc/os-release | grep "^VERSION_ID=" | cut -d'=' -f2 | tr -d '"')
ADDITIONAL_TEXT=$(cat /etc/os-release | grep "^VERSION=" | cut -d'(' -f2 | cut -d')' -f1)
# Output current system version information
echo "${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}"
echo "backup default all repo"
mkdir -p /repo
mv /etc/yum.repos.d/* /repo
echo "add new repo"
cat <<EOF>>/etc/yum.repos.d/openEuler.repo
[$repo_name-OS]
name=$repo_name-OS
baseurl=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/OS/$basearch/RPM-GPG-KEY-openEuler
[$repo_name-everything]
name=$repo_name-everything
baseurl=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/everything/$basearch/RPM-GPG-KEY-openEuler
[$repo_name-EPOL]
name=$repo_name-EPOL
baseurl=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/EPOL/main/$basearch/
enabled=1
gpgcheck=1
gpgkey=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/OS/$basearch/RPM-GPG-KEY-openEuler
[$repo_name-debuginfo]
name=$repo_name-debuginfo
baseurl=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[$repo_name-source]
name=$repo_name-source
baseurl=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/source/
enabled=1
gpgcheck=1
gpgkey=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/source/RPM-GPG-KEY-openEuler
[$repo_name-update]
name=$repo_name-update
baseurl=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/update/$basearch/
enabled=1
gpgcheck=1
gpgkey=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/OS/$basearch/RPM-GPG-KEY-openEuler
[$repo_name-update-source]
name=$repo_name-update-source
baseurl=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/update/source/
enabled=1
gpgcheck=1
gpgkey=$repo_url/$openeuler_catalogue/${NAME}-${VERSION_ID}-${ADDITIONAL_TEXT}/source/RPM-GPG-KEY-openEuler
EOF
echo "update repo"
yum clean all
yum makecache
执行一键更改repo
bash /openEuler_repo.sh