新增适配 openSUSE & 一些优化

This commit is contained in:
SuperManito
2023-05-01 16:27:11 +08:00
parent 8035a61382
commit b69e0c9942
6 changed files with 703 additions and 237 deletions

View File

@@ -15,31 +15,45 @@
<!-- 👆这样括起来的信息将被隐藏,填写时注意不要写在里面。 -->
## 1. 处理器架构
<!-- 将中括号内的 "空格" 替换为 "x" ,即为选中,例:" - [x] 否 " -->
- [ ] `x86_64` `x86_32`
- [ ] `arm64` `arm/v8` `arm/v7` `arm/v6`
- [ ] `ppc64le` `s390x`
- [ ] `Other`
## 2. 使用环境
## 1. 操作系统
<!-- 将中括号内的 "空格" 替换为 "x" ,即为选中,例:" - [x] 是 " -->
- [ ] `Debian`
- [ ] `Ubuntu`
- [ ] `Kali Linux`
- [ ] `Red Hat Enterprise Linux`
- [ ] `CentOS`
- [ ] `CentOS Stream`
- [ ] `Fedora`
- [ ] `Rocky Linux`
- [ ] `openEuler`
- [ ] `openSUSE`
## 3. 使用环境版本
<!-- 具体版本号 查看命令uname -a-->
A
## 2. 处理器架构
<!-- 将中括号内的 "空格" 替换为 "x" ,即为选中,例:" - [x] 否 " -->
- [ ] `x86_64` `x86_32`
- [ ] `arm64` `arm/v8` `arm/v7` `arm/v6`
- [ ] `ppc64le` `s390x`
- [ ] `Other`
## 4. 详细叙述您的问题
## 3. 系统详细信息
<!-- 请将命令 "cat /etc/os-release" 的输出结果粘贴在下方 -->
```
```
## 4. 环境信息
<!-- 请将命令 "uname -a" 的输出结果粘贴在下方 -->
```
```
## 5. 详细叙述您的问题
### (1) 具体问题
A
### (2) 详细的系统日志
<!-- 请在此处粘贴详细完整的日志,从执行脚本开始到结束。 -->
A
```
```

View File

@@ -24,31 +24,45 @@ assignees: ''
<!-- 👆这样括起来的信息将被隐藏,填写时注意不要写在里面。 -->
## 1. 处理器架构
<!-- 将中括号内的 "空格" 替换为 "x" ,即为选中,例:" - [x] 否 " -->
- [ ] `x86_64` `x86_32`
- [ ] `arm64` `arm/v8` `arm/v7` `arm/v6`
- [ ] `ppc64le` `s390x`
- [ ] `Other`
## 2. 使用环境
## 1. 操作系统
<!-- 将中括号内的 "空格" 替换为 "x" ,即为选中,例:" - [x] 是 " -->
- [ ] `Debian`
- [ ] `Ubuntu`
- [ ] `Kali Linux`
- [ ] `Red Hat Enterprise Linux`
- [ ] `CentOS`
- [ ] `CentOS Stream`
- [ ] `Fedora`
- [ ] `Rocky Linux`
- [ ] `openEuler`
- [ ] `openSUSE`
## 3. 使用环境版本
<!-- 具体版本号 查看命令uname -a-->
A
## 2. 处理器架构
<!-- 将中括号内的 "空格" 替换为 "x" ,即为选中,例:" - [x] 否 " -->
- [ ] `x86_64` `x86_32`
- [ ] `arm64` `arm/v8` `arm/v7` `arm/v6`
- [ ] `ppc64le` `s390x`
- [ ] `Other`
## 4. 详细叙述您的问题
## 3. 系统详细信息
<!-- 请将命令 "cat /etc/os-release" 的输出结果粘贴在下方 -->
```
```
## 4. 环境信息
<!-- 请将命令 "uname -a" 的输出结果粘贴在下方 -->
```
```
## 5. 详细叙述您的问题
### (1) 具体问题
A
### (2) 详细的系统日志
<!-- 请在此处粘贴详细完整的日志,从执行脚本开始到结束。 -->
A
```
```

View File

@@ -1,13 +1,11 @@
#!/bin/bash
## Author: SuperManito
## Modified: 2023-04-21
## Modified: 2023-05-01
## License: GPL-2.0
## Github: https://github.com/SuperManito/LinuxMirrors
## Gitee: https://gitee.com/SuperManito/LinuxMirrors
## 定义系统判定变量
ARCH=$(uname -m)
DebianRelease_CMD="lsb_release"
SYSTEM_DEBIAN="Debian"
SYSTEM_UBUNTU="Ubuntu"
SYSTEM_KALI="Kali"
@@ -18,6 +16,7 @@ SYSTEM_CENTOS_STREAM="CentOS Stream"
SYSTEM_ROCKY="Rocky"
SYSTEM_FEDORA="Fedora"
SYSTEM_OPENEULER="openEuler"
SYSTEM_OPENSUSE="openSUSE"
## 定义目录和文件
File_LinuxRelease=/etc/os-release
@@ -32,8 +31,10 @@ Dir_RedHatRepos=/etc/yum.repos.d
Dir_RedHatReposBackup=/etc/yum.repos.d.bak
Dir_openEulerRepos=/etc/yum.repos.d
Dir_openEulerReposBackup=/etc/yum.repos.d.bak
SelinuxConfig=/etc/selinux/config
Dir_openSUSERepos=/etc/zypp/repos.d
Dir_openSUSEReposBackup=/etc/zypp/repos.d.bak
## 定义颜色变量
RED='\033[31m'
GREEN='\033[32m'
YELLOW='\033[33m'
@@ -51,50 +52,42 @@ function AuthorSignature() {
echo -e " \033[1;34m官方网站\033[0m https://supermanito.github.io/LinuxMirrors\n"
}
## 组合函数
function Combin_Function() {
PermissionJudgment
EnvJudgment
ChooseMirrors
BackupMirrors
RemoveOldMirrors
ChangeMirrors
UpgradeSoftware
AuthorSignature
}
## 系统判定变量
function EnvJudgment() {
## 判定当前系统基于 Debian or RedHat
if [ -s $File_RedHatRelease ]; then
SYSTEM_FACTIONS=${SYSTEM_REDHAT}
elif [ -s $File_DebianVersion ]; then
SYSTEM_FACTIONS=${SYSTEM_DEBIAN}
elif [ -s $File_openEulerRelease ]; then
SYSTEM_FACTIONS=${SYSTEM_OPENEULER}
else
echo -e "\n$ERROR 无法判断当前运行环境,请先确认本脚本是否已经适配当前操作系统\n"
exit
fi
## 定义系统名称
SYSTEM_NAME="$(cat $File_LinuxRelease | grep -E "^NAME=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
cat $File_LinuxRelease | grep "PRETTY_NAME=" -q
[ $? -eq 0 ] && SYSTEM_PRETTY_NAME="$(cat $File_LinuxRelease | grep -E "^PRETTY_NAME=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
## 定义系统版本号
SYSTEM_VERSION_NUMBER="$(cat $File_LinuxRelease | grep -E "VERSION_ID=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
SYSTEM_VERSION_NUMBER="$(cat $File_LinuxRelease | grep -E "^VERSION_ID=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
## 定义系统ID
SYSTEM_ID="$(cat $File_LinuxRelease | grep -E "^ID=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
## 判定当前系统派系Debian/RedHat/openEuler/openSUSE
if [ -s $File_RedHatRelease ]; then
SYSTEM_FACTIONS="${SYSTEM_REDHAT}"
elif [ -s $File_DebianVersion ]; then
SYSTEM_FACTIONS="${SYSTEM_DEBIAN}"
elif [ -s $File_openEulerRelease ]; then
SYSTEM_FACTIONS="${SYSTEM_OPENEULER}"
elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then
SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}"
else
echo -e "\n$ERROR 无法判断当前运行环境,请先确认本脚本是否已经适配当前操作系统\n"
exit 1
fi
## 判定系统名称、版本、版本号
case ${SYSTEM_FACTIONS} in
case "${SYSTEM_FACTIONS}" in
"${SYSTEM_DEBIAN}")
if [ ! -x /usr/bin/lsb_release ]; then
apt-get install -y lsb-release
if [ $? -eq 0 ]; then
clear
else
if [ $? -ne 0 ]; then
echo -e "\n$ERROR lsb-release 软件包安装失败"
echo -e "\n本脚本需要通过 lsb_release 指令判断系统类型,当前可能为精简安装的系统,因为正常情况下系统会自带该软件包,请自行安装后重新执行脚本!\n"
exit
exit 1
fi
fi
SYSTEM_JUDGMENT="$(${DebianRelease_CMD} -is)"
SYSTEM_VERSION_CODENAME="$(${DebianRelease_CMD} -cs)"
SYSTEM_JUDGMENT="$(lsb_release -is)"
SYSTEM_VERSION_CODENAME="$(lsb_release -cs)"
;;
"${SYSTEM_REDHAT}")
SYSTEM_JUDGMENT="$(cat $File_RedHatRelease | awk -F ' ' '{printf$1}')"
@@ -104,9 +97,12 @@ function EnvJudgment() {
"${SYSTEM_OPENEULER}")
SYSTEM_JUDGMENT="$(cat $File_openEulerRelease | awk -F ' ' '{printf$1}')"
;;
"${SYSTEM_OPENSUSE}")
SYSTEM_JUDGMENT="${SYSTEM_OPENSUSE}"
;;
esac
## 判定系统处理器架构
case ${ARCH} in
case $(uname -m) in
x86_64)
SYSTEM_ARCH="x86_64"
;;
@@ -123,12 +119,12 @@ function EnvJudgment() {
SYSTEM_ARCH="x86_32"
;;
*)
SYSTEM_ARCH=${ARCH}
SYSTEM_ARCH=$(uname -m)
;;
esac
## 定义软件源分支名称
if [ "${SYSTEM_JUDGMENT}" = ${SYSTEM_UBUNTU} ]; then
if [ ${ARCH} = "x86_64" ] || [ ${ARCH} = "*i?86*" ]; then
if [ ${SYSTEM_ARCH} = "x86_64" ] || [ $(uname -m) = "*i?86*" ]; then
SOURCE_BRANCH="${SYSTEM_JUDGMENT,,}"
else
SOURCE_BRANCH=ubuntu-ports
@@ -137,11 +133,11 @@ function EnvJudgment() {
SOURCE_BRANCH="$(echo "${SYSTEM_JUDGMENT,,}" | sed "s/ /-/g")"
fi
## 定义软件源同步/更新文字
case ${SYSTEM_FACTIONS} in
case "${SYSTEM_FACTIONS}" in
"${SYSTEM_DEBIAN}")
SYNC_TXT="更新"
;;
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}")
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENSUSE}")
SYNC_TXT="同步"
;;
esac
@@ -151,27 +147,30 @@ function EnvJudgment() {
function PermissionJudgment() {
## 权限判定
if [ $UID -ne 0 ]; then
echo -e "\n$ERROR 权限不足,请使用 Root 用户\n"
exit
echo -e "\n$ERROR 权限不足,请使用 Root 用户运行本脚本\n"
exit 1
fi
}
## 关闭防火墙和SELinux
function CloseFirewall() {
if [[ $(systemctl is-active firewalld) == "active" ]]; then
CHOICE_C=$(echo -e "\n${BOLD}└─ 是否关闭防火墙和 SELinux ? [Y/n] ${PLAIN}")
read -p "${CHOICE_C}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss])
systemctl disable --now firewalld >/dev/null 2>&1
[ -s $SelinuxConfig ] && sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" $SelinuxConfig && setenforce 0 >/dev/null 2>&1
;;
[Nn] | [Nn][Oo]) ;;
*)
echo -e "\n$WARN 输入错误,默认不关闭!"
;;
esac
local SelinuxConf=/etc/selinux/config
if [ -x /usr/bin/systemctl ]; then
if [[ $(systemctl is-active firewalld) == "active" ]]; then
local CHOICE=$(echo -e "\n${BOLD}└─ 是否关闭防火墙和 SELinux ? [Y/n] ${PLAIN}")
read -p "${CHOICE}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss])
systemctl disable --now firewalld >/dev/null 2>&1
[ -s $SelinuxConf ] && sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" $SelinuxConfig && setenforce 0 >/dev/null 2>&1
;;
[Nn] | [Nn][Oo]) ;;
*)
echo -e "\n$WARN 输入错误,默认不关闭!"
;;
esac
fi
fi
}
@@ -180,7 +179,7 @@ function BackupMirrors() {
local VERIFICATION_FILES=1
local VERIFICATION_BACKUPFILES=1
case ${SYSTEM_FACTIONS} in
case "${SYSTEM_FACTIONS}" in
"${SYSTEM_DEBIAN}")
## 判断 /etc/apt/sources.list.d 目录下是否存在文件
[ -d $Dir_DebianExtendSource ] && ls $Dir_DebianExtendSource | grep *.list -q
@@ -205,14 +204,22 @@ function BackupMirrors() {
[ -d $Dir_openEulerReposBackup ] && ls $Dir_openEulerReposBackup | grep repo -q
VERIFICATION_BACKUPFILES=$?
;;
"${SYSTEM_OPENSUSE}")
## 判断 /etc/zypp/repos.d 目录下是否存在文件
[ -d $Dir_openSUSERepos ] && ls $Dir_openSUSERepos | grep repo -q
VERIFICATION_FILES=$?
## 判断 /etc/zypp/repos.d.bak 目录下是否存在文件
[ -d $Dir_openSUSEReposBackup ] && ls $Dir_openSUSEReposBackup | grep repo -q
VERIFICATION_BACKUPFILES=$?
;;
esac
case ${SYSTEM_FACTIONS} in
case "${SYSTEM_FACTIONS}" in
"${SYSTEM_DEBIAN}")
## /etc/apt/sources.list
if [ -s $File_DebianSourceList ]; then
if [ -s $File_DebianSourceListBackup ]; then
CHOICE_BACKUP1=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 list 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
local CHOICE_BACKUP1=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 list 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
read -p "${CHOICE_BACKUP1}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
@@ -239,7 +246,7 @@ function BackupMirrors() {
## /etc/apt/sources.list.d
if [ -d $Dir_DebianExtendSource ] && [ ${VERIFICATION_FILES} -eq 0 ]; then
if [ -d $Dir_DebianExtendSourceBackup ] && [ ${VERIFICATION_BACKUPFILES} -eq 0 ]; then
CHOICE_BACKUP2=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 list 第三方源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
local CHOICE_BACKUP2=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 list 第三方源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
read -p "${CHOICE_BACKUP2}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
@@ -265,7 +272,7 @@ function BackupMirrors() {
## /etc/yum.repos.d
if [ ${VERIFICATION_FILES} -eq 0 ]; then
if [ -d $Dir_RedHatReposBackup ] && [ ${VERIFICATION_BACKUPFILES} -eq 0 ]; then
CHOICE_BACKUP3=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 repo 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
local CHOICE_BACKUP3=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 repo 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
read -p "${CHOICE_BACKUP3}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
@@ -293,8 +300,8 @@ function BackupMirrors() {
## /etc/yum.repos.d
if [ ${VERIFICATION_FILES} -eq 0 ]; then
if [ -d $Dir_openEulerReposBackup ] && [ ${VERIFICATION_BACKUPFILES} -eq 0 ]; then
CHOICE_BACKUP3=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 repo 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
read -p "${CHOICE_BACKUP3}" INPUT
local CHOICE_BACKUP4=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 repo 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
read -p "${CHOICE_BACKUP4}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss]) ;;
@@ -317,12 +324,40 @@ function BackupMirrors() {
[ -d $Dir_openEulerRepos ] || mkdir -p $Dir_openEulerRepos
fi
;;
"${SYSTEM_OPENSUSE}")
## /etc/zypp/repos.d
if [ ${VERIFICATION_FILES} -eq 0 ]; then
if [ -d $Dir_openSUSEReposBackup ] && [ ${VERIFICATION_BACKUPFILES} -eq 0 ]; then
local CHOICE_BACKUP4=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 repo 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
read -p "${CHOICE_BACKUP4}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss]) ;;
[Nn] | [Nn][Oo])
echo ''
cp -rvf $Dir_openSUSERepos/* $Dir_openSUSEReposBackup 2>&1
;;
*)
echo -e "\n$WARN 输入错误,默认不覆盖!"
;;
esac
else
[ ! -d $Dir_openSUSEReposBackup ] && mkdir -p $Dir_openSUSEReposBackup
echo ''
cp -vrf $Dir_openSUSERepos/* $Dir_openSUSEReposBackup 2>&1
echo -e "\n$COMPLETE 已备份原有 repo 源文件至 $Dir_openSUSEReposBackup 目录"
sleep 1s
fi
else
[ -d $Dir_openSUSERepos ] || mkdir -p $Dir_openSUSERepos
fi
;;
esac
}
## 删除原有源
function RemoveOldMirrors() {
case ${SYSTEM_FACTIONS} in
case "${SYSTEM_FACTIONS}" in
"${SYSTEM_DEBIAN}")
[ -f $File_DebianSourceList ] && sed -i '1,$d' $File_DebianSourceList
;;
@@ -343,12 +378,15 @@ function RemoveOldMirrors() {
"${SYSTEM_OPENEULER}")
[ -d $Dir_openEulerRepos ] && rm -rf $Dir_openEulerRepos/*
;;
"${SYSTEM_OPENSUSE}")
[ -d $Dir_openSUSERepos ] && rm -rf $Dir_openSUSERepos/repo-*
;;
esac
}
## 换源
function ChangeMirrors() {
case ${SYSTEM_FACTIONS} in
case "${SYSTEM_FACTIONS}" in
"${SYSTEM_DEBIAN}")
DebianMirrors
;;
@@ -358,18 +396,23 @@ function ChangeMirrors() {
"${SYSTEM_OPENEULER}")
openEulerMirrors
;;
"${SYSTEM_OPENSUSE}")
openSUSEMirrors
;;
esac
echo -e "\n${WORKING} 开始${SYNC_TXT}软件源...\n"
case ${SYSTEM_FACTIONS} in
case "${SYSTEM_FACTIONS}" in
"${SYSTEM_DEBIAN}")
apt-get update
;;
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}")
yum makecache
;;
"${SYSTEM_OPENSUSE}")
zypper ref
;;
esac
VERIFICATION_SOURCESYNC=$?
if [ ${VERIFICATION_SOURCESYNC} -eq 0 ]; then
if [ $? -eq 0 ]; then
echo -e "\n$COMPLETE 软件源更换完毕"
else
echo -e "\n$ERROR 软件源${SYNC_TXT}失败\n"
@@ -383,33 +426,42 @@ function ChangeMirrors() {
## 更新软件包
function UpgradeSoftware() {
CHOICE_B=$(echo -e "\n${BOLD}└─ 是否跳过更新软件包? [Y/n] ${PLAIN}")
read -p "${CHOICE_B}" INPUT
local CHOICE_A=$(echo -e "\n${BOLD}└─ 是否跳过更新软件包? [Y/n] ${PLAIN}")
read -p "${CHOICE_A}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss]) ;;
[Nn] | [Nn][Oo])
echo -e ''
case ${SYSTEM_FACTIONS} in
case "${SYSTEM_FACTIONS}" in
"${SYSTEM_DEBIAN}")
apt-get upgrade -y
;;
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}")
yum update -y
;;
"${SYSTEM_OPENSUSE}")
zypper update -y
;;
esac
CHOICE_C=$(echo -e "\n${BOLD}└─ 是否清理已下载的软件包缓存? [Y/n] ${PLAIN}")
read -p "${CHOICE_C}" INPUT
local CHOICE_B=$(echo -e "\n${BOLD}└─ 是否清理已下载的软件包缓存? [Y/n] ${PLAIN}")
read -p "${CHOICE_B}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss])
if [ ${SYSTEM_FACTIONS} = ${SYSTEM_DEBIAN} ]; then
case "${SYSTEM_FACTIONS}" in
"${SYSTEM_DEBIAN}")
apt-get autoremove -y >/dev/null 2>&1
apt-get clean >/dev/null 2>&1
elif [ ${SYSTEM_FACTIONS} = ${SYSTEM_REDHAT} ]; then
;;
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}")
yum autoremove -y >/dev/null 2>&1
yum clean packages -y >/dev/null 2>&1
fi
;;
"${SYSTEM_OPENSUSE}")
zypper clean >/dev/null 2>&1
;;
esac
echo -e "\n$COMPLETE 清理完毕"
;;
[Nn] | [Nn][Oo]) ;;
@@ -457,8 +509,9 @@ deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-back
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}-security ${SYSTEM_VERSION_CODENAME}/updates main contrib non-free" >>$File_DebianSourceList
;;
"${SYSTEM_KALI}")
echo "deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME} main non-free contrib
deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME} main non-free contrib" >>$File_DebianSourceList
echo "## 默认禁用源码镜像以提高速度,如需启用请自行取消注释
deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME} main non-free contrib
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME} main non-free contrib" >>$File_DebianSourceList
;;
esac
}
@@ -468,13 +521,13 @@ function RedHatMirrors() {
## 生成基于 RedHat 发行版和及其衍生发行版的官方 repo 源文件
case "${SYSTEM_JUDGMENT}" in
"${SYSTEM_RHEL}" | "${SYSTEM_CENTOS}")
GenRepoFiles_CentOS
GenRepoFiles_CentOS ${SYSTEM_VERSION_NUMBER:0:1}
;;
"${SYSTEM_CENTOS_STREAM}")
GenRepoFiles_CentOSStream
GenRepoFiles_CentOSStream ${SYSTEM_VERSION_NUMBER:0:1}
;;
"${SYSTEM_ROCKY}")
GenRepoFiles_RockyLinux
GenRepoFiles_RockyLinux ${SYSTEM_VERSION_NUMBER:0:1}
;;
"${SYSTEM_FEDORA}")
GenRepoFiles_Fedora
@@ -608,9 +661,6 @@ function RedHatMirrors() {
fedora-updates-testing-modular.repo
;;
esac
## 清理 yum 缓存
yum clean all >/dev/null 2>&1
}
## 更换基于 openEuler 系 Linux 发行版的国内源
@@ -624,6 +674,104 @@ function openEulerMirrors() {
sed -i "s|repo.openeuler.org|${SOURCE}/${SOURCE_BRANCH}|g" openEuler.repo
}
## 更换基于 openSUSE 系 Linux 发行版的国内源
function openSUSEMirrors() {
case "${SYSTEM_ID}" in
"opensuse-leap")
GenRepoFiles_openSUSE "leap" "${SYSTEM_VERSION_NUMBER}"
;;
"opensuse-tumbleweed")
GenRepoFiles_openSUSE "tumbleweed"
;;
esac
cd $Dir_openSUSERepos
# 更换 WEB 协议HTTP/HTTPS
sed -i "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" repo-*
# 更换软件源
case "${SYSTEM_ID}" in
opensuse-leap)
case "${SYSTEM_VERSION_NUMBER}" in
15.[0-2])
sed -i "s|download.opensuse.org|${SOURCE}/${SOURCE_BRANCH}|g" \
repo-debug-non-oss.repo \
repo-debug.repo \
repo-debug-update-non-oss.repo \
repo-debug-update.repo \
repo-non-oss.repo \
repo-oss.repo \
repo-source-non-oss.repo \
repo-source.repo \
repo-update-non-oss.repo \
repo-update.repo
;;
*)
sed -i "s|download.opensuse.org|${SOURCE}/${SOURCE_BRANCH}|g" \
repo-backports-debug-update.repo \
repo-backports-update.repo \
repo-debug-non-oss.repo \
repo-debug.repo \
repo-debug-update-non-oss.repo \
repo-debug-update.repo \
repo-non-oss.repo \
repo-oss.repo \
repo-sle-debug-update.repo \
repo-sle-update.repo \
repo-source.repo \
repo-update-non-oss.repo \
repo-update.repo
;;
esac
;;
opensuse-tumbleweed)
sed -i "s|download.opensuse.org|${SOURCE}/${SOURCE_BRANCH}|g" \
repo-debug.repo \
repo-non-oss.repo \
repo-openh264.repo \
repo-oss.repo \
repo-source.repo \
repo-update.repo
;;
esac
}
# 适用于 RHEL/CentOS(Stream)/RockyLinux 的 EPEL 附加软件包(安装/换源)
function ChooseInstallEPEL() {
case "${SYSTEM_JUDGMENT}" in
"${SYSTEM_RHEL}" | "${SYSTEM_CENTOS}" | "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ROCKY}")
## 判断是否已安装 EPEL 软件包
rpm -qa | grep epel-release -q
VERIFICATION_EPEL=$?
## 判断 /etc/yum.repos.d 目录下是否存在 epel 附加软件包 repo 源文件
[ -d $Dir_RedHatRepos ] && ls $Dir_RedHatRepos | grep epel -q
VERIFICATION_EPELFILES=$?
## 判断 /etc/yum.repos.d.bak 目录下是否存在 epel 附加软件包 repo 源文件
[ -d $Dir_RedHatReposBackup ] && ls $Dir_RedHatReposBackup | grep epel -q
VERIFICATION_EPELBACKUPFILES=$?
if [ ${VERIFICATION_EPEL} -eq 0 ]; then
local CHOICE=$(echo -e "\n ${BOLD}└─ 检测到系统已安装 EPEL 附加软件包,是否替换/覆盖为国内源? [Y/n] ${PLAIN}")
else
local CHOICE=$(echo -e "\n ${BOLD}└─ 是否安装 EPEL 附加软件包? [Y/n] ${PLAIN}")
fi
read -p "${CHOICE}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss])
EPEL_INSTALL="True"
;;
[Nn] | [Nn][Oo])
EPEL_INSTALL="False"
;;
*)
echo -e "\n $WARN 输入错误,默认不更换!"
EPEL_INSTALL="False"
;;
esac
;;
esac
}
## 安装/更换基于 RHEL/CentOS 等红帽系 Linux 的 EPEL (Extra Packages for Enterprise Linux) 附加软件包国内源
function EPELMirrors() {
## 安装 EPEL 软件包
@@ -704,7 +852,7 @@ function ChooseMirrors() {
[Nn] | [Nn][Oo])
SOURCE=${Intranet}
echo -e "\n $WARN 已切换至云计算厂商镜像站的内网访问地址,仅限对应厂商云服务器用户使用!"
NOT_SUPPORT_HTTPS="True"
ONLY_HTTP="True"
;;
*)
SOURCE=${Extranet}
@@ -713,13 +861,21 @@ function ChooseMirrors() {
esac
}
function WelcomeTitle() {
echo -e '+-------------------------------------+'
echo -e '| |'
echo -e '| 欢迎使用 Linux 一键更换国内软件源 |'
echo -e '| |'
echo -e '+-------------------------------------+'
echo -e ''
echo -e " 运行环境 ${BLUE}${SYSTEM_PRETTY_NAME:-"${SYSTEM_NAME} ${SYSTEM_VERSION_NUMBER}"} ${SYSTEM_ARCH}${PLAIN}"
echo -e " 系统时间 ${BLUE}$(date "+%Y-%m-%d %H:%M:%S") $(timedatectl status | grep "Time zone" | awk -F ':' '{print$2}' | awk -F ' ' '{print$1}')${PLAIN}"
echo -e ''
}
clear
echo -e '+-------------------------------------+'
echo -e '| |'
echo -e '| 欢迎使用 Linux 一键更换国内软件源 |'
echo -e '| |'
echo -e '+-------------------------------------+'
echo -e ''
WelcomeTitle
echo -e ' ❖ 阿里云 1)'
echo -e ' ❖ 腾讯云 2)'
echo -e ' ❖ 华为云 3)'
@@ -735,11 +891,8 @@ function ChooseMirrors() {
echo -e ' ❖ 哈尔滨工业大学 13)'
echo -e ' ❖ 中国科学技术大学 14)'
echo -e ' ❖ 中国科学院软件研究所 15)'
echo -e ''
echo -e " 运行环境 ${BLUE}${SYSTEM_NAME} ${SYSTEM_VERSION_NUMBER} ${SYSTEM_ARCH}${PLAIN}"
echo -e " 系统时间 ${BLUE}$(date "+%Y-%m-%d %H:%M:%S")${PLAIN} ${BLUE}$(cat /etc/timezone)${PLAIN}"
CHOICE_A=$(echo -e "\n${BOLD}└─ 请选择并输入你想使用的软件源 [ 1-15 ]${PLAIN}")
read -p "${CHOICE_A}" INPUT
local CHOICE=$(echo -e "\n${BOLD}└─ 请选择并输入你想使用的软件源 [ 1-15 ]${PLAIN}")
read -p "${CHOICE}" INPUT
case $INPUT in
1 | 2 | 3)
Cloud_Computing_Vendors_Mirrors $INPUT
@@ -786,48 +939,15 @@ function ChooseMirrors() {
sleep 2s
;;
esac
}
# 适用于 RHEL/CentOS/Rocky 的 EPEL 附加软件包(安装/换源
case "${SYSTEM_JUDGMENT}" in
"${SYSTEM_RHEL}" | "${SYSTEM_CENTOS}" | "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ROCKY}")
## 判断是否已安装 EPEL 软件包
rpm -qa | grep epel-release -q
VERIFICATION_EPEL=$?
## 判断 /etc/yum.repos.d 目录下是否存在 epel 附加软件包 repo 源文件
[ -d $Dir_RedHatRepos ] && ls $Dir_RedHatRepos | grep epel -q
VERIFICATION_EPELFILES=$?
## 判断 /etc/yum.repos.d.bak 目录下是否存在 epel 附加软件包 repo 源文件
[ -d $Dir_RedHatReposBackup ] && ls $Dir_RedHatReposBackup | grep epel -q
VERIFICATION_EPELBACKUPFILES=$?
if [ ${VERIFICATION_EPEL} -eq 0 ]; then
CHOICE_D=$(echo -e "\n ${BOLD}└─ 检测到系统已安装 EPEL 附加软件包,是否替换/覆盖为国内源? [Y/n] ${PLAIN}")
else
CHOICE_D=$(echo -e "\n ${BOLD}└─ 是否安装 EPEL 附加软件包? [Y/n] ${PLAIN}")
fi
read -p "${CHOICE_D}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss])
EPEL_INSTALL="True"
;;
[Nn] | [Nn][Oo])
EPEL_INSTALL="False"
;;
*)
echo -e "\n $WARN 输入错误,默认不更换!"
EPEL_INSTALL="False"
;;
esac
;;
esac
## 选择同步软件源所使用的 WEB 协议( HTTP80 端口HTTPS443 端口)
if [[ ${NOT_SUPPORT_HTTPS} == "True" ]]; then
## 选择同步软件源所使用的 WEB 协议( HTTP80 端口HTTPS443 端口
function ChooseWebProtocol() {
if [[ ${ONLY_HTTP} == "True" ]]; then
WEB_PROTOCOL="http"
else
CHOICE_E=$(echo -e "\n${BOLD}└─ 软件源是否使用 HTTP 协议? [Y/n] ${PLAIN}")
read -p "${CHOICE_E}" INPUT
local CHOICE=$(echo -e "\n${BOLD}└─ 软件源是否使用 HTTP 协议? [Y/n] ${PLAIN}")
read -p "${CHOICE}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss])
@@ -842,14 +962,11 @@ function ChooseMirrors() {
;;
esac
fi
## 关闭防火墙和SELinux
[[ ${SYSTEM_FACTIONS} = ${SYSTEM_REDHAT} || ${SYSTEM_FACTIONS} = ${SYSTEM_OPENEULER} ]] && CloseFirewall
}
## 生成 CentOS 官方 repo 源文件
function GenRepoFiles_CentOS() {
case ${SYSTEM_VERSION_NUMBER:0:1} in
case $1 in
8)
cat >$Dir_RedHatRepos/CentOS-Linux-AppStream.repo <<\EOF
# CentOS-Linux-AppStream.repo
@@ -1280,7 +1397,7 @@ EOF
## 生成 CentOS Stream 官方 repo 源文件
function GenRepoFiles_CentOSStream() {
case ${SYSTEM_VERSION_NUMBER:0:1} in
case $1 in
9)
cat >$Dir_RedHatRepos/centos.repo <<\EOF
[baseos]
@@ -1782,7 +1899,7 @@ EOF
## 生成 Rocky Linux 官方 repo 源文件
function GenRepoFiles_RockyLinux() {
case ${SYSTEM_VERSION_NUMBER:0:1} in
case $1 in
9)
cat >$Dir_RedHatRepos/rocky.repo <<\EOF
# rocky.repo
@@ -2784,6 +2901,285 @@ gpgkey=http://repo.openeuler.org/openEuler-$releasever/source/RPM-GPG-KEY-openEu
EOF
}
## 生成 openSUSE 官方 repo 源文件
function GenRepoFiles_openSUSE() {
case $1 in
leap)
case $2 in
15.[0-2])
cat >$Dir_openSUSERepos/repo-debug-non-oss.repo <<\EOF
[repo-debug-non-oss]
name=Debug Repository (Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/non-oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug.repo <<\EOF
[repo-debug]
name=Debug Repository
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug-update-non-oss.repo <<\EOF
[repo-debug-update-non-oss]
name=Update Repository (Debug, Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/non-oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug-update.repo <<\EOF
[repo-debug-update]
name=Update Repository (Debug)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-non-oss.repo <<\EOF
[repo-non-oss]
name=Non-OSS Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/non-oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-oss.repo <<\EOF
[repo-oss]
name=Main Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-source-non-oss.repo <<\EOF
[repo-source-non-oss]
name=Source Repository (Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/non-oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-source.repo <<\EOF
[repo-source]
name=Source Repository
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-update-non-oss.repo <<\EOF
[repo-update-non-oss]
name=Update Repository (Non-Oss)
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/non-oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-update.repo <<\EOF
[repo-update]
name=Main Update Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/oss/
type=rpm-md
keeppackages=0
EOF
;;
*)
cat >$Dir_openSUSERepos/repo-backports-debug-update.repo <<\EOF
[repo-backports-debug-update]
name=Update repository with updates for openSUSE Leap debuginfo packages from openSUSE Backports
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/backports_debug/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-backports-update.repo <<\EOF
[repo-backports-update]
name=Update repository of openSUSE Backports
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/backports/
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug-non-oss.repo <<\EOF
[repo-debug-non-oss]
name=Debug Repository (Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/non-oss/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug.repo <<\EOF
[repo-debug]
name=Debug Repository
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/oss/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug-update-non-oss.repo <<\EOF
[repo-debug-update-non-oss]
name=Update Repository (Debug, Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/non-oss/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug-update.repo <<\EOF
[repo-debug-update]
name=Update Repository (Debug)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/oss/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-non-oss.repo <<\EOF
[repo-non-oss]
name=Non-OSS Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/non-oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-oss.repo <<\EOF
[repo-oss]
name=Main Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-sle-debug-update.repo <<\EOF
[repo-sle-debug-update]
name=Update repository with debuginfo for updates from SUSE Linux Enterprise 15
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/sle/
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-sle-update.repo <<\EOF
[repo-sle-update]
name=Update repository with updates from SUSE Linux Enterprise 15
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/sle/
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-source.repo <<\EOF
[repo-source]
name=Source Repository
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/oss/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-update-non-oss.repo <<\EOF
[repo-update-non-oss]
name=Update Repository (Non-Oss)
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/non-oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-update.repo <<\EOF
[repo-update]
name=Main Update Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/oss/
type=rpm-md
keeppackages=0
EOF
;;
esac
;;
tumbleweed)
cat >$Dir_openSUSERepos/repo-debug.repo <<\EOF
[repo-debug]
name=openSUSE-Tumbleweed-Debug
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/tumbleweed/repo/oss/
path=/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-non-oss.repo <<\EOF
[repo-non-oss]
name=openSUSE-Tumbleweed-Non-Oss
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/tumbleweed/repo/non-oss/
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-openh264.repo <<\EOF
[repo-openh264]
name=Open H.264 Codec (openSUSE Tumbleweed)
enabled=1
autorefresh=1
baseurl=http://codecs.opensuse.org/openh264/openSUSE_Tumbleweed
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-oss.repo <<\EOF
[repo-oss]
name=openSUSE-Tumbleweed-Oss
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/tumbleweed/repo/oss/
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-source.repo <<\EOF
[repo-source]
name=openSUSE-Tumbleweed-Source
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/source/tumbleweed/repo/oss/
path=/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-update.repo <<\EOF
[repo-update]
name=openSUSE-Tumbleweed-Update
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/tumbleweed/
path=/
type=rpm-md
keeppackages=0
EOF
;;
esac
}
## 生成 EPEL 附加软件包官方 repo 源文件
function GenRepoFiles_EPEL() {
case ${SYSTEM_VERSION_NUMBER:0:1} in
@@ -3041,4 +3437,19 @@ EOF
esac
}
## 组合函数
function Combin_Function() {
PermissionJudgment
EnvJudgment
ChooseMirrors
ChooseWebProtocol
ChooseInstallEPEL
CloseFirewall
BackupMirrors
RemoveOldMirrors
ChangeMirrors
UpgradeSoftware
AuthorSignature
}
Combin_Function

View File

@@ -1,56 +1,60 @@
# ![LinuxMirrors](./docs/img/logo.png)
- __`GNU/Linux` 一键更换国内软件源脚本__
- __GNU/Linux 一键更换国内软件源脚本__
- __本项目旨在为从事计算机相关行业的朋友们提供便利__
- __理论支持所有架构的环境ARM 环境已经过测试__
- __理论支持所有架构的环境ARM64 环境已经过测试__
***
- ### 适配的 GNU/Linux 发行版 <img src="./docs/img/icon/linux.svg" width="16" height="16" alt="Linux Logo"/>
- ### 适配系统 <img src="./docs/img/icon/linux.svg" width="16" height="16" style="vertical-align: -0.15em" alt="Linux Logo"/>
<table>
<tr>
<td rowspan="10"> 支持<br/>版本<br/>
<td rowspan="11"> 支持<br/>版本<br/>
</tr>
<tr>
<td><a href="https://www.debian.org"><img src="./docs/img/icon/debian.svg" width="16" height="16"/></a>&nbsp;Debian</td>
<td><a href="https://www.debian.org" target="_blank"><img src="./docs/img/icon/debian.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Debian</td>
<td align="center">8.0 ~ 11</td>
</tr>
<tr>
<td><a href="https://cn.ubuntu.com"><img src="./docs/img/icon/ubuntu.svg" width="16" height="16"/></a>&nbsp;Ubuntu</td>
<td><a href="https://cn.ubuntu.com" target="_blank"><img src="./docs/img/icon/ubuntu.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Ubuntu</td>
<td align="center">16.04 ~ 23</td>
</tr>
<tr>
<td><a href="https://www.kali.org"><img src="./docs/img/icon/kali.svg" width="16" height="16"/></a>&nbsp;Kali Linux</td>
<td><a href="https://www.kali.org" target="_blank"><img src="./docs/img/icon/kali.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Kali Linux</td>
<td align="center">2.0 ~ 2023</td>
</tr>
<tr>
<td><a href="https://access.redhat.com/products/red-hat-enterprise-linux"><img src="./docs/img/icon/redhat.svg" width="16" height="16"/></a>&nbsp;Red Hat Enterprise Linux</td>
<td><a href="https://access.redhat.com/products/red-hat-enterprise-linux" target="_blank"><img src="./docs/img/icon/redhat.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Red Hat Enterprise Linux</td>
<td align="center">7.0 ~ 8.5</td>
</tr>
<tr>
<td><a href="https://www.centos.org/centos-linux"><img src="./docs/img/icon/centos.svg" width="16" height="16"/></a>&nbsp;CentOS</td>
<td><a href="https://www.centos.org/centos-linux" target="_blank"><img src="./docs/img/icon/centos.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;CentOS</td>
<td align="center">7.0 ~ 8.5</td>
</tr>
<tr>
<td><a href="https://www.centos.org/centos-stream"><img src="./docs/img/icon/centos.svg" width="16" height="16"/></a>&nbsp;CentOS Stream</td>
<td><a href="https://www.centos.org/centos-stream" target="_blank"><img src="./docs/img/icon/centos.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;CentOS Stream</td>
<td align="center">8 ~ 9</td>
</tr>
<tr>
<td><a href="https://rockylinux.org"><img src="./docs/img/icon/rocky.svg" width="16" height="16"/></a>&nbsp;Rocky Linux</td>
<td><a href="https://rockylinux.org" target="_blank"><img src="./docs/img/icon/rocky.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Rocky Linux</td>
<td align="center">8.0 ~ 9</td>
</tr>
<tr>
<td><a href="https://fedoraproject.org/zh-Hans"><img src="./docs/img/icon/fedora.ico" width="16" height="16"/></a>&nbsp;Fedora</td>
<td><a href="https://fedoraproject.org/zh-Hans" target="_blank"><img src="./docs/img/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Fedora</td>
<td align="center">28 ~ 37</td>
</tr>
<tr>
<td><a href="https://www.openeuler.org/zh"><img src="./docs/img/icon/openEuler.ico" width="16" height="16"/></a>&nbsp;openEuler</td>
<td><a href="https://www.openeuler.org/zh" target="_blank"><img src="./docs/img/icon/openeuler.ico" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;openEuler</td>
<td align="center">21.03 ~ 23</td>
</tr>
<tr>
<td><a href="https://www.opensuse.org" target="_blank"><img src="./docs/img/icon/opensuse.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;openSUSE</td>
<td align="center">Leep 15 / Tumbleweed</td>
</tr>
</table>
目前仅支持上述基于 Debian、RedHat、openEuler 的发行版和及其部分衍生版本
当前支持上述基于 Debian、RedHat、openEuler、openSUSE 的发行版和及其部分衍生版本,不再此支持范围内的操作系统请勿运行本脚本
- ### 使用方法
@@ -61,7 +65,7 @@
- #### 注意事项
1. 完整复制上面的命令到终端按回车键即可执行,若无法安装 `curl` 软件包可复制源码到本地后通过 `bash` 手动执行
2. 为了适配所有环境,建议使用 `Root` 用户执行脚本,切换命令为 `sudo -i` ,如遇报错请查看常见问题与帮助
2. 为了适配所有环境,需要使用 `Root` 用户执行脚本,切换命令为 `su root` ,如遇报错请查看常见问题与帮助
3. 如果您使用的环境没有安装或不支持简体中文环境,请通过 `SSH客户端工具` 使用,否则将无法正确选择交互内容
4. 执行脚本过程中会自动备份原有源无需手动备份,期间会在终端输出多个主观选择交互内容,可按回车键快速确定
5. 脚本支持在原有源配置错误或者不存在的情况下使用,并且可以重复使用;脚本变更的软件源默认使用 `HTTP` 协议
@@ -70,30 +74,33 @@
> __未启用的源__
> _Debian 系 Linux 默认禁用了**源码仓库**和**预发布软件源**,若需启用请将 `/etc/apt/sources.list` 文件中相关内容的所在行**取消注释**_
> _RedHat 系 Linux 部分仓库**默认没有启用**,若需启用请将 `/etc/yum.repos.d` 目录下相关 **repo** 文件中的 `enabled` 值修改为 `1`_
> _RedHat 系 Linux 部分仓库**默认没有启用**,若需启用请将 `/etc/yum.repos.d` 目录下相关 **repo** 文件中的 `enabled` 值修改为 `1`_
> _openEuler 系 Linux 部分仓库**默认没有启用**,若需启用请将 `/etc/yum.repos.d` 目录下相关 **repo** 文件中的 `enabled` 值修改为 `1`_
> _openSUSE 系 Linux 部分仓库**默认没有启用**,若需启用请将 `/etc/zypp/repos.d` 目录下相关 **repo** 文件中的 `enabled` 值修改为 `1`_
- #### 软件源
| | 镜像站名称 | 镜像站地址 | IPv6 | Kali Linux | Rocky Linux | Fedora | openEuler | EPEL |
| :---: | :---------------: | :-----------------------------------------------------------------------: | :---: | :--------: | :---------: | :----: | :-------: | :---: |
| 1 | 阿里云 | [mirrors.aliyun.com](https://mirrors.aliyun.com) | ✓ | ✓ | | ✓ | ✓ | ✓ |
| 2 | 腾讯云 | [mirrors.tencent.com](https://mirrors.tencent.com) | ✓ | ✓ | ✓ | ✓ | | ✓ |
| 3 | 华为云 | [mirrors.huaweicloud.com](https://mirrors.huaweicloud.com) | ✓ | ✓ | | ✓ | ✓ | ✓ |
| 4 | 网易 | [mirrors.163.com](https://mirrors.163.com) | | | ✓ | ✓ | ✓ | |
| 5 | 搜狐 | [mirrors.sohu.com](https://mirrors.sohu.com) | | | | ✓ | | |
| 6 | 清华大学 | [mirrors.tuna.tsinghua.edu.cn](https://mirrors.tuna.tsinghua.edu.cn) | ✓ | ✓ | | ✓ | ✓ | ✓ |
| 7 | 北京大学 | [mirrors.pku.edu.cn](https://mirrors.pku.edu.cn/Mirrors) | ✓ | | | | ✓ | ✓ |
| 8 | 浙江大学 | [mirrors.zju.edu.cn](https://mirrors.zju.edu.cn) | | ✓ | ✓ | ✓ | ✓ | ✓ |
| 9 | 南京大学 | [mirrors.nju.edu.cn](https://mirrors.nju.edu.cn) | | ✓ | ✓ | ✓ | ✓ | ✓ |
| 10 | 重庆大学 | [mirrors.cqu.edu.cn](https://mirrors.cqu.edu.cn) | | ✓ | | ✓ | | ✓ |
| 11 | 兰州大学 | [mirror.lzu.edu.cn](https://mirror.lzu.edu.cn) | ✓ | | ✓ | ✓ | ✓ | ✓ |
| 12 | 上海交通大学 | [mirror.sjtu.edu.cn](https://mirror.sjtu.edu.cn) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 13 | 哈尔滨工业大学 | [mirrors.hit.edu.cn](https://mirrors.hit.edu.cn) | ✓ | ✓ | | | ✓ | ✓ |
| 14 | 中国科学技术大学 | [mirrors.ustc.edu.cn](https://mirrors.ustc.edu.cn) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 15 | 中国科学院软件研究所 | [mirror.iscas.ac.cn](https://mirror.iscas.ac.cn) | | ✓ | ✓ | ✓ | ✓ | ✓ |
| | 镜像站名称 | 镜像站地址 | IPv6 | Kali Linux | Rocky Linux | Fedora | openEuler | openSUSE | EPEL |
| :---: | :---------------: | :------------------------------------------------------------------: | :---: | :--------: | :---------: | :----: | :-------: | :-------: | :---: |
| 1 | 阿里云 | [mirrors.aliyun.com](https://mirrors.aliyun.com) | ✓ | ✓ | | ✓ | ✓ | | ✓ |
| 2 | 腾讯云 | [mirrors.tencent.com](https://mirrors.tencent.com) | ✓ | ✓ | ✓ | ✓ | | | ✓ |
| 3 | 华为云 | [mirrors.huaweicloud.com](https://mirrors.huaweicloud.com) | ✓ | ✓ | | ✓ | ✓ | | ✓ |
| 4 | 网易 | [mirrors.163.com](https://mirrors.163.com) | | | ✓ | ✓ | ✓ | | |
| 5 | 搜狐 | [mirrors.sohu.com](https://mirrors.sohu.com) | | | | ✓ | | | |
| 6 | 清华大学 | [mirrors.tuna.tsinghua.edu.cn](https://mirrors.tuna.tsinghua.edu.cn) | ✓ | ✓ | | ✓ | ✓ | | ✓ |
| 7 | 北京大学 | [mirrors.pku.edu.cn](https://mirrors.pku.edu.cn/Mirrors) | ✓ | | | | ✓ | | ✓ |
| 8 | 浙江大学 | [mirrors.zju.edu.cn](https://mirrors.zju.edu.cn) | | ✓ | ✓ | ✓ | ✓ | | ✓ |
| 9 | 南京大学 | [mirrors.nju.edu.cn](https://mirrors.nju.edu.cn) | | ✓ | ✓ | ✓ | ✓ | | ✓ |
| 10 | 重庆大学 | [mirrors.cqu.edu.cn](https://mirrors.cqu.edu.cn) | | ✓ | | ✓ | | | ✓ |
| 11 | 兰州大学 | [mirror.lzu.edu.cn](https://mirror.lzu.edu.cn) | ✓ | | ✓ | ✓ | ✓ | | ✓ |
| 12 | 上海交通大学 | [mirror.sjtu.edu.cn](https://mirror.sjtu.edu.cn) | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ |
| 13 | 哈尔滨工业大学 | [mirrors.hit.edu.cn](https://mirrors.hit.edu.cn) | ✓ | ✓ | | | ✓ | | ✓ |
| 14 | 中国科学技术大学 | [mirrors.ustc.edu.cn](https://mirrors.ustc.edu.cn) | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ |
| 15 | 中国科学院软件研究所 | [mirror.iscas.ac.cn](https://mirror.iscas.ac.cn) | | ✓ | ✓ | ✓ | ✓ | | ✓ |
以上为脚本当前使用的开源镜像站,所有镜像站均支持 `Debian` `Ubuntu` `CentOS` 软件源
如果使用过程中脚本不能正常输出中文内容则可对照此列表使用,顺序与脚本一致,之后一路回车即可
如果使用过程中脚本不能正常输出中文内容则可对照此列表使用,顺序与脚本一致,之后一路回车即可
华北地区建议优先使用 `中科大`、`腾讯云`、`清华大学`,软件源的速度区分刷新速度和下载速度,具体请结合实际地理位置进行选择尝试
- #### 常见问题与帮助
@@ -125,6 +132,12 @@
cp -rvf /etc/yum.repos.d.bak /etc/yum.repos.d
```
- openSUSE
```
cp -rvf /etc/zypp/repos.d.bak /etc/zypp/repos.d
```
- #### 脚本执行流程
- └ 选择国内源 `交互`
@@ -147,8 +160,8 @@
bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh)
```
`Docker CE`Docker Community Edition 镜像仓库,用于下载并安装 Docker 相关软件包
`Docker Hub`Docker Hub 镜像仓库,默认为官方提供的公共库,用于切换下载镜像时的来源仓库,又称镜像加速器
`Docker CE` Docker Community Edition 镜像仓库,用于下载并安装 Docker 相关软件包
`Docker Hub` Docker Hub 镜像仓库,默认为官方提供的公共库,用于切换下载镜像时的来源仓库,又称镜像加速器
> __注意__
> 脚本集成安装 `Docker Engine` 与 `Docker Compose`,可手动选择安装版本和下载源,还可手动选择镜像加速器,支持国内外服务器环境和 `ARM`架构处理器环境使用。

View File

@@ -2,54 +2,58 @@
- #### __GNU/Linux 一键更换国内软件源脚本__ <!-- {docsify-ignore} -->
- #### __本项目旨在为从事计算机相关行业的朋友们提供便利__ <!-- {docsify-ignore} -->
- #### __理论支持所有架构的环境ARM 环境已经过测试__ <!-- {docsify-ignore} -->
- #### __理论支持所有架构的环境ARM64 环境已经过测试__ <!-- {docsify-ignore} -->
## :fa-brands fa-linux: 适配系统
<table>
<tr>
<td rowspan="10"> 支持<br/>版本<br/>
<td rowspan="11"> 支持<br/>版本<br/>
</tr>
<tr>
<td><a href="https://www.debian.org"><img src="./img/icon/debian.svg" width="16" height="16"/></a>&nbsp;Debian</td>
<td><a href="https://www.debian.org" target="_blank"><img src="./img/icon/debian.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Debian</td>
<td align="center">8.0 ~ 11</td>
</tr>
<tr>
<td><a href="https://cn.ubuntu.com"><img src="./img/icon/ubuntu.svg" width="16" height="16"/></a>&nbsp;Ubuntu</td>
<td><a href="https://cn.ubuntu.com" target="_blank"><img src="./img/icon/ubuntu.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Ubuntu</td>
<td align="center">16.04 ~ 23</td>
</tr>
<tr>
<td><a href="https://www.kali.org"><img src="./img/icon/kali.svg" width="16" height="16"/></a>&nbsp;Kali Linux</td>
<td><a href="https://www.kali.org" target="_blank"><img src="./img/icon/kali.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Kali Linux</td>
<td align="center">2.0 ~ 2023</td>
</tr>
<tr>
<td><a href="https://access.redhat.com/products/red-hat-enterprise-linux"><img src="./img/icon/redhat.svg" width="16" height="16"/></a>&nbsp;Red Hat Enterprise Linux</td>
<td><a href="https://access.redhat.com/products/red-hat-enterprise-linux" target="_blank"><img src="./img/icon/redhat.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Red Hat Enterprise Linux</td>
<td align="center">7.0 ~ 8.5</td>
</tr>
<tr>
<td><a href="https://www.centos.org/centos-linux"><img src="./img/icon/centos.svg" width="16" height="16"/></a>&nbsp;CentOS</td>
<td><a href="https://www.centos.org/centos-linux" target="_blank"><img src="./img/icon/centos.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;CentOS</td>
<td align="center">7.0 ~ 8.5</td>
</tr>
<tr>
<td><a href="https://www.centos.org/centos-stream"><img src="./img/icon/centos.svg" width="16" height="16"/></a>&nbsp;CentOS Stream</td>
<td><a href="https://www.centos.org/centos-stream" target="_blank"><img src="./img/icon/centos.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;CentOS Stream</td>
<td align="center">8 ~ 9</td>
</tr>
<tr>
<td><a href="https://rockylinux.org"><img src="./img/icon/rocky.svg" width="16" height="16"/></a>&nbsp;Rocky Linux</td>
<td><a href="https://rockylinux.org" target="_blank"><img src="./img/icon/rocky.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Rocky Linux</td>
<td align="center">8.0 ~ 9</td>
</tr>
<tr>
<td><a href="https://fedoraproject.org/zh-Hans"><img src="./img/icon/fedora.ico" width="16" height="16"/></a>&nbsp;Fedora</td>
<td><a href="https://fedoraproject.org/zh-Hans" target="_blank"><img src="./img/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Fedora</td>
<td align="center">28 ~ 37</td>
</tr>
<tr>
<td><a href="https://www.openeuler.org/zh"><img src="./img/icon/openEuler.ico" width="16" height="16"/></a>&nbsp;openEuler</td>
<td><a href="https://www.openeuler.org/zh" target="_blank"><img src="./img/icon/openeuler.ico" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;openEuler</td>
<td align="center">21.03 ~ 23</td>
</tr>
<tr>
<td><a href="https://www.opensuse.org" target="_blank"><img src="./img/icon/opensuse.svg" width="16" height="16" style="vertical-align: -0.25em"/></a>&nbsp;openSUSE</td>
<td align="center">Leep 15 / Tumbleweed</td>
</tr>
</table>
> [!NOTE|label:说明]
> 目前仅支持上述基于 Debian、RedHat、openEuler 的发行版和及其部分衍生版本
> 当前支持上述基于 Debian、RedHat、openEuler、openSUSE 的发行版和及其部分衍生版本,不再此支持范围内的操作系统请勿运行本脚本
## <i class="fa-solid fa-wheelchair-move fa-bounce" style=" --fa-bounce-start-scale-x: 1; --fa-bounce-start-scale-y: 1; --fa-bounce-jump-scale-x: 1; --fa-bounce-jump-scale-y: 1; --fa-bounce-land-scale-x: 1; --fa-bounce-land-scale-y: 1; " ></i> 使用方法
@@ -57,39 +61,42 @@
bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh)
```
- ### 注意事项
- ### 注意事项
1. 完整复制上面的命令到终端按回车键即可执行,若无法安装 `curl` 软件包可复制源码到本地后通过 `bash` 手动执行
2. 为了适配所有环境,建议使用 `Root` 用户执行脚本,切换命令为 `sudo -i` ,如遇报错请查看常见问题与帮助
2. 为了适配所有环境,需要使用 `Root` 用户执行脚本,切换命令为 `su root` ,如遇报错请查看常见问题与帮助
3. 如果您使用的环境没有安装或不支持简体中文环境,请通过 `SSH客户端工具` 使用,否则将无法正确选择交互内容
4. 执行脚本过程中会自动备份原有源无需手动备份,期间会在终端输出多个主观选择交互内容,可按回车键快速确定
5. 脚本支持在原有源配置错误或者不存在的情况下使用,并且可以重复使用;脚本变更的软件源默认使用 `HTTP` 协议
> [!WARNING|label:未启用的源]
> **Debian** 系 Linux 默认禁用了**源码仓库**和**预发布软件源**,若需启用请将 `/etc/apt/sources.list` 文件中相关内容的所在行**取消注释**
> **RedHat** 系 Linux 部分仓库**默认没有启用**,若需启用请将 `/etc/yum.repos.d` 目录下相关 **repo** 文件中的 `enabled` 值修改为 `1`
> **RedHat** 系 Linux 部分仓库**默认没有启用**,若需启用请将 `/etc/yum.repos.d` 目录下相关 **repo** 文件中的 `enabled` 值修改为 `1`
> **openEuler** 系 Linux 部分仓库**默认没有启用**,若需启用请将 `/etc/yum.repos.d` 目录下相关 **repo** 文件中的 `enabled` 值修改为 `1`
> **openSUSE** 系 Linux 部分仓库**默认没有启用**,若需启用请将 `/etc/zypp/repos.d` 目录下相关 **repo** 文件中的 `enabled` 值修改为 `1`
- ### <i class="fa-solid fa-list-ol fa-fade" style="--fa-animation-duration: 2s; --fa-fade-opacity: 0.6;" ></i> 软件源
| | 镜像站名称 | 镜像站地址 | IPv6 | Kali Linux | Rocky Linux | Fedora | openEuler | EPEL |
| :---: | :---------------: | :-----------------------------------------------------------------------: | :---: | :--------: | :---------: | :----: | :-------: | :---: |
| 1 | 阿里云 | [mirrors.aliyun.com](https://mirrors.aliyun.com) | ✓ | ✓ | | ✓ | ✓ | ✓ |
| 2 | 腾讯云 | [mirrors.tencent.com](https://mirrors.tencent.com) | ✓ | ✓ | ✓ | ✓ | | ✓ |
| 3 | 华为云 | [mirrors.huaweicloud.com](https://mirrors.huaweicloud.com) | ✓ | ✓ | | ✓ | ✓ | ✓ |
| 4 | 网易 | [mirrors.163.com](https://mirrors.163.com) | | | ✓ | ✓ | ✓ | |
| 5 | 搜狐 | [mirrors.sohu.com](https://mirrors.sohu.com) | | | | ✓ | | |
| 6 | 清华大学 | [mirrors.tuna.tsinghua.edu.cn](https://mirrors.tuna.tsinghua.edu.cn) | ✓ | ✓ | | ✓ | ✓ | ✓ |
| 7 | 北京大学 | [mirrors.pku.edu.cn](https://mirrors.pku.edu.cn/Mirrors) | ✓ | | | | ✓ | ✓ |
| 8 | 浙江大学 | [mirrors.zju.edu.cn](https://mirrors.zju.edu.cn) | | ✓ | ✓ | ✓ | ✓ | ✓ |
| 9 | 南京大学 | [mirrors.nju.edu.cn](https://mirrors.nju.edu.cn) | | ✓ | ✓ | ✓ | ✓ | ✓ |
| 10 | 重庆大学 | [mirrors.cqu.edu.cn](https://mirrors.cqu.edu.cn) | | ✓ | | ✓ | | ✓ |
| 11 | 兰州大学 | [mirror.lzu.edu.cn](https://mirror.lzu.edu.cn) | ✓ | | ✓ | ✓ | ✓ | ✓ |
| 12 | 上海交通大学 | [mirror.sjtu.edu.cn](https://mirror.sjtu.edu.cn) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 13 | 哈尔滨工业大学 | [mirrors.hit.edu.cn](https://mirrors.hit.edu.cn) | ✓ | ✓ | | | ✓ | ✓ |
| 14 | 中国科学技术大学 | [mirrors.ustc.edu.cn](https://mirrors.ustc.edu.cn) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 15 | 中国科学院软件研究所 | [mirror.iscas.ac.cn](https://mirror.iscas.ac.cn) | | ✓ | ✓ | ✓ | ✓ | ✓ |
| | 镜像站名称 | 镜像站地址 | IPv6 | Kali Linux | Rocky Linux | Fedora | openEuler | openSUSE | EPEL |
| :---: | :---------------: | :------------------------------------------------------------------: | :---: | :--------: | :---------: | :----: | :-------: | :------: | :---: |
| 1 | 阿里云 | [mirrors.aliyun.com](https://mirrors.aliyun.com) | ✓ | ✓ | | ✓ | ✓ | | ✓ |
| 2 | 腾讯云 | [mirrors.tencent.com](https://mirrors.tencent.com) | ✓ | ✓ | ✓ | ✓ | | | ✓ |
| 3 | 华为云 | [mirrors.huaweicloud.com](https://mirrors.huaweicloud.com) | ✓ | ✓ | | ✓ | ✓ | | ✓ |
| 4 | 网易 | [mirrors.163.com](https://mirrors.163.com) | | | ✓ | ✓ | ✓ | | |
| 5 | 搜狐 | [mirrors.sohu.com](https://mirrors.sohu.com) | | | | ✓ | | | |
| 6 | 清华大学 | [mirrors.tuna.tsinghua.edu.cn](https://mirrors.tuna.tsinghua.edu.cn) | ✓ | ✓ | | ✓ | ✓ | | ✓ |
| 7 | 北京大学 | [mirrors.pku.edu.cn](https://mirrors.pku.edu.cn/Mirrors) | ✓ | | | | ✓ | | ✓ |
| 8 | 浙江大学 | [mirrors.zju.edu.cn](https://mirrors.zju.edu.cn) | | ✓ | ✓ | ✓ | ✓ | | ✓ |
| 9 | 南京大学 | [mirrors.nju.edu.cn](https://mirrors.nju.edu.cn) | | ✓ | ✓ | ✓ | ✓ | | ✓ |
| 10 | 重庆大学 | [mirrors.cqu.edu.cn](https://mirrors.cqu.edu.cn) | | ✓ | | ✓ | | | ✓ |
| 11 | 兰州大学 | [mirror.lzu.edu.cn](https://mirror.lzu.edu.cn) | ✓ | | ✓ | ✓ | ✓ | | ✓ |
| 12 | 上海交通大学 | [mirror.sjtu.edu.cn](https://mirror.sjtu.edu.cn) | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ |
| 13 | 哈尔滨工业大学 | [mirrors.hit.edu.cn](https://mirrors.hit.edu.cn) | ✓ | ✓ | | | ✓ | | ✓ |
| 14 | 中国科学技术大学 | [mirrors.ustc.edu.cn](https://mirrors.ustc.edu.cn) | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ |
| 15 | 中国科学院软件研究所 | [mirror.iscas.ac.cn](https://mirror.iscas.ac.cn) | | ✓ | ✓ | ✓ | ✓ | | ✓ |
以上为脚本当前使用的开源镜像站,所有镜像站均支持 `Debian` `Ubuntu` `CentOS` 软件源
以上为脚本当前使用的开源镜像站,所有镜像站均支持 `Debian` `Ubuntu` `CentOS` 软件源
华北地区建议优先使用 `中科大``腾讯云``清华大学`,软件源的速度区分刷新速度和下载速度,具体请结合实际地理位置进行选择尝试
> [!TIP]
> 如果使用过程中脚本不能正常输出中文内容则可对照此列表使用,顺序与脚本一致,之后一路回车即可
@@ -118,12 +125,18 @@ bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirro
cp -rvf /etc/apt/sources.list.bak /etc/apt/sources.list
```
- RedHat 系
- RedHat 系 / openEuler
```
cp -rvf /etc/yum.repos.d.bak /etc/yum.repos.d
```
- openSUSE
```
cp -rvf /etc/zypp/repos.d.bak /etc/zypp/repos.d
```
- ### <i class="fa-regular fa-list-tree fa-fade" style="--fa-animation-duration: 2s; --fa-fade-opacity: 0.6;" ></i> 脚本执行流程
- └ 选择国内源 `交互`

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.7 KiB