mirror of
https://gitee.com/SuperManito/LinuxMirrors
synced 2025-11-02 15:30:26 +08:00
适配 Alpine Linux & 优化
This commit is contained in:
298
ChangeMirrors.sh
298
ChangeMirrors.sh
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
## Author: SuperManito
|
||||
## Modified: 2024-01-13
|
||||
## Modified: 2024-01-17
|
||||
## License: MIT
|
||||
## GitHub: https://github.com/SuperManito/LinuxMirrors
|
||||
## Website: https://linuxmirrors.cn
|
||||
@@ -117,6 +117,7 @@ mirror_list_edu=(
|
||||
"齐鲁工业大学@mirrors.qlu.edu.cn"
|
||||
"华南农业大学@mirrors.scau.edu.cn"
|
||||
"西安交通大学@mirrors.xjtu.edu.cn"
|
||||
"江西理工大学@mirrors.jxust.edu.cn"
|
||||
"南阳理工学院@mirror.nyist.edu.cn"
|
||||
"武昌首义学院@mirrors.wsyu.edu.cn"
|
||||
"哈尔滨工业大学@mirrors.hit.edu.cn"
|
||||
@@ -162,20 +163,26 @@ SYSTEM_OPENCLOUDOS="OpenCloudOS"
|
||||
SYSTEM_OPENEULER="openEuler"
|
||||
SYSTEM_OPENSUSE="openSUSE"
|
||||
SYSTEM_ARCH="Arch"
|
||||
SYSTEM_ALPINE="Alpine"
|
||||
|
||||
## 定义目录和文件
|
||||
## 定义系统版本文件
|
||||
File_LinuxRelease=/etc/os-release
|
||||
File_RedHatRelease=/etc/redhat-release
|
||||
File_DebianVersion=/etc/debian_version
|
||||
File_OpenCloudOSRelease=/etc/opencloudos-release
|
||||
File_openEulerRelease=/etc/openEuler-release
|
||||
File_ArchRelease=/etc/arch-release
|
||||
File_DebianVersion=/etc/debian_version
|
||||
File_AlpineRelease=/etc/alpine-release
|
||||
|
||||
## 定义软件源相关文件或目录
|
||||
File_DebianSourceList=/etc/apt/sources.list
|
||||
File_DebianSourceListBackup=/etc/apt/sources.list.bak
|
||||
Dir_DebianExtendSource=/etc/apt/sources.list.d
|
||||
Dir_DebianExtendSourceBackup=/etc/apt/sources.list.d.bak
|
||||
File_ArchMirrorList=/etc/pacman.d/mirrorlist
|
||||
File_ArchMirrorListBackup=/etc/pacman.d/mirrorlist.bak
|
||||
File_AlpineRepositories=/etc/apk/repositories
|
||||
File_AlpineRepositoriesBackup=/etc/apk/repositories.bak
|
||||
Dir_YumRepos=/etc/yum.repos.d
|
||||
Dir_YumReposBackup=/etc/yum.repos.d.bak
|
||||
Dir_openSUSERepos=/etc/zypp/repos.d
|
||||
@@ -220,56 +227,6 @@ function PermissionJudgment() {
|
||||
fi
|
||||
}
|
||||
|
||||
## 命令选项兼容性判断
|
||||
function CheckCommandOptions() {
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}")
|
||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_DEBIAN}" ]]; then
|
||||
if [[ "${SOURCE_SECURITY}" == "true" || "${SOURCE_BRANCH_SECURITY}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持使用 security 仓库相关命令选项,请确认后重试!"
|
||||
fi
|
||||
fi
|
||||
if [[ "${INSTALL_EPEL}" == "true" || "${ONLY_EPEL}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持安装 EPEL 附件软件包故无法使用相关命令选项,请确认后重试!"
|
||||
fi
|
||||
;;
|
||||
"${SYSTEM_REDHAT}")
|
||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_CENTOS}" && "${SYSTEM_JUDGMENT}" != "${SYSTEM_RHEL}" && "${SYSTEM_JUDGMENT}" != "${SYSTEM_ALMALINUX}" ]]; then
|
||||
if [[ "${SOURCE_VAULT}" == "true" || "${SOURCE_BRANCH_VAULT}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持使用 vault 仓库相关命令选项,请确认后重试!"
|
||||
fi
|
||||
fi
|
||||
case "${SYSTEM_JUDGMENT}" in
|
||||
"${SYSTEM_FEDORA}")
|
||||
if [[ "${INSTALL_EPEL}" == "true" || "${ONLY_EPEL}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持安装 EPEL 附件软件包故无法使用相关命令选项,请确认后重试!"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [[ "${DEBIAN_CODENAME}" ]]; then
|
||||
Output_Error "当前系统不支持使用指定版本名称命令选项,请确认后重试!"
|
||||
fi
|
||||
;;
|
||||
"${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENSUSE}" | "${SYSTEM_ARCH}")
|
||||
if [[ "${SOURCE_SECURITY}" == "true" || "${SOURCE_BRANCH_SECURITY}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持使用 security 仓库相关命令选项,请确认后重试!"
|
||||
fi
|
||||
if [[ "${SOURCE_VAULT}" == "true" || "${SOURCE_BRANCH_VAULT}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持安装 EPEL 附件软件包故无法使用相关命令选项,请确认后重试!"
|
||||
fi
|
||||
if [[ "${INSTALL_EPEL}" == "true" || "${ONLY_EPEL}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持安装 EPEL 附件软件包故无法使用相关命令选项,请确认后重试!"
|
||||
fi
|
||||
if [[ "${DEBIAN_CODENAME}" ]]; then
|
||||
Output_Error "当前系统不支持使用指定版本名称命令选项,请确认后重试!"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [[ "${USE_ABROAD_SOURCE}" == "true" && "${USE_EDU_SOURCE}" == "true" ]]; then
|
||||
Output_Error "两种模式不可同时使用!"
|
||||
fi
|
||||
}
|
||||
|
||||
## 系统判定变量
|
||||
function EnvJudgment() {
|
||||
## 定义系统名称
|
||||
@@ -280,18 +237,19 @@ function EnvJudgment() {
|
||||
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/OpenCloudOS/openSUSE)
|
||||
## 判定当前系统派系
|
||||
if [ -s $File_DebianVersion ]; then
|
||||
SYSTEM_FACTIONS="${SYSTEM_DEBIAN}"
|
||||
elif [ -s $File_OpenCloudOSRelease ]; then
|
||||
# OpenCloudOS 判断优先级需要高于 RedHat,因为8版本基于红帽而9版本不是
|
||||
SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}"
|
||||
SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 注:OpenCloudOS 判断优先级需要高于 RedHat,因为8版本基于红帽而9版本不是
|
||||
elif [ -s $File_openEulerRelease ]; then
|
||||
SYSTEM_FACTIONS="${SYSTEM_OPENEULER}"
|
||||
elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then
|
||||
SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}"
|
||||
elif [ -f $File_ArchRelease ]; then
|
||||
SYSTEM_FACTIONS="${SYSTEM_ARCH}"
|
||||
elif [ -f $File_AlpineRelease ]; then
|
||||
SYSTEM_FACTIONS="${SYSTEM_ALPINE}"
|
||||
elif [ -s $File_RedHatRelease ]; then
|
||||
SYSTEM_FACTIONS="${SYSTEM_REDHAT}"
|
||||
else
|
||||
@@ -303,7 +261,7 @@ function EnvJudgment() {
|
||||
if [ ! -x /usr/bin/lsb_release ]; then
|
||||
apt-get install -y lsb-release
|
||||
if [ $? -ne 0 ]; then
|
||||
Output_Error "lsb-release 软件包安装失败\n 本脚本需要通过 lsb_release 指令判断系统类型,当前可能为精简安装的系统,因为正常情况下系统会自带该软件包,请自行安装后重新执行脚本!"
|
||||
Output_Error "lsb-release 软件包安装失败\n 本脚本需要通过 lsb_release 指令判断系统具体类型和版本,当前可能为精简安装的系统,因为正常情况下系统会自带该软件包,请自行安装后重新执行脚本!"
|
||||
fi
|
||||
fi
|
||||
SYSTEM_JUDGMENT="$(lsb_release -is)"
|
||||
@@ -316,17 +274,8 @@ function EnvJudgment() {
|
||||
## CentOS Stream
|
||||
grep -q "${SYSTEM_CENTOS_STREAM}" $File_RedHatRelease && SYSTEM_JUDGMENT="${SYSTEM_CENTOS_STREAM}"
|
||||
;;
|
||||
"${SYSTEM_OPENCLOUDOS}")
|
||||
SYSTEM_JUDGMENT="${SYSTEM_OPENCLOUDOS}"
|
||||
;;
|
||||
"${SYSTEM_OPENEULER}")
|
||||
SYSTEM_JUDGMENT="${SYSTEM_OPENEULER}"
|
||||
;;
|
||||
"${SYSTEM_OPENSUSE}")
|
||||
SYSTEM_JUDGMENT="${SYSTEM_OPENSUSE}"
|
||||
;;
|
||||
"${SYSTEM_ARCH}")
|
||||
SYSTEM_JUDGMENT="${SYSTEM_ARCH}"
|
||||
*)
|
||||
SYSTEM_JUDGMENT="${SYSTEM_FACTIONS}"
|
||||
;;
|
||||
esac
|
||||
## 判断系统和其版本是否受本脚本支持
|
||||
@@ -377,7 +326,7 @@ function EnvJudgment() {
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
"${SYSTEM_KALI}" | "${SYSTEM_DEEPIN}" | "${SYSTEM_ARCH}")
|
||||
"${SYSTEM_KALI}" | "${SYSTEM_DEEPIN}" | "${SYSTEM_ARCH}" | "${SYSTEM_ALPINE}")
|
||||
# 理论全部支持
|
||||
;;
|
||||
*)
|
||||
@@ -410,7 +359,7 @@ function EnvJudgment() {
|
||||
## 默认为系统名称小写,替换空格
|
||||
SOURCE_BRANCH="${SYSTEM_JUDGMENT,,}"
|
||||
SOURCE_BRANCH="${SOURCE_BRANCH// /-}"
|
||||
## 处理特殊
|
||||
## 处理特殊的分支名称
|
||||
case "${SYSTEM_JUDGMENT}" in
|
||||
"${SYSTEM_DEBIAN}")
|
||||
case ${SYSTEM_VERSION_NUMBER:0:1} in
|
||||
@@ -480,6 +429,56 @@ function EnvJudgment() {
|
||||
esac
|
||||
}
|
||||
|
||||
## 命令选项兼容性判断
|
||||
function CheckCommandOptions() {
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}")
|
||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_DEBIAN}" ]]; then
|
||||
if [[ "${SOURCE_SECURITY}" == "true" || "${SOURCE_BRANCH_SECURITY}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持使用 security 仓库相关命令选项,请确认后重试!"
|
||||
fi
|
||||
fi
|
||||
if [[ "${INSTALL_EPEL}" == "true" || "${ONLY_EPEL}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持安装 EPEL 附件软件包故无法使用相关命令选项,请确认后重试!"
|
||||
fi
|
||||
;;
|
||||
"${SYSTEM_REDHAT}")
|
||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_CENTOS}" && "${SYSTEM_JUDGMENT}" != "${SYSTEM_RHEL}" && "${SYSTEM_JUDGMENT}" != "${SYSTEM_ALMALINUX}" ]]; then
|
||||
if [[ "${SOURCE_VAULT}" == "true" || "${SOURCE_BRANCH_VAULT}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持使用 vault 仓库相关命令选项,请确认后重试!"
|
||||
fi
|
||||
fi
|
||||
case "${SYSTEM_JUDGMENT}" in
|
||||
"${SYSTEM_FEDORA}")
|
||||
if [[ "${INSTALL_EPEL}" == "true" || "${ONLY_EPEL}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持安装 EPEL 附件软件包故无法使用相关命令选项,请确认后重试!"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [[ "${DEBIAN_CODENAME}" ]]; then
|
||||
Output_Error "当前系统不支持使用指定版本名称命令选项,请确认后重试!"
|
||||
fi
|
||||
;;
|
||||
"${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENSUSE}" | "${SYSTEM_ARCH}" | "${SYSTEM_ALPINE}")
|
||||
if [[ "${SOURCE_SECURITY}" == "true" || "${SOURCE_BRANCH_SECURITY}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持使用 security 仓库相关命令选项,请确认后重试!"
|
||||
fi
|
||||
if [[ "${SOURCE_VAULT}" == "true" || "${SOURCE_BRANCH_VAULT}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持安装 EPEL 附件软件包故无法使用相关命令选项,请确认后重试!"
|
||||
fi
|
||||
if [[ "${INSTALL_EPEL}" == "true" || "${ONLY_EPEL}" == "true" ]]; then
|
||||
Output_Error "当前系统不支持安装 EPEL 附件软件包故无法使用相关命令选项,请确认后重试!"
|
||||
fi
|
||||
if [[ "${DEBIAN_CODENAME}" ]]; then
|
||||
Output_Error "当前系统不支持使用指定版本名称命令选项,请确认后重试!"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [[ "${USE_ABROAD_SOURCE}" == "true" && "${USE_EDU_SOURCE}" == "true" ]]; then
|
||||
Output_Error "两种模式不可同时使用!"
|
||||
fi
|
||||
}
|
||||
|
||||
## 选择软件源
|
||||
function ChooseMirrors() {
|
||||
## 打印软件源列表
|
||||
@@ -815,21 +814,25 @@ function BackupOriginMirrors() {
|
||||
if [[ "${BACKUP}" == "true" ]]; then
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}")
|
||||
## /etc/apt/sources.list
|
||||
# /etc/apt/sources.list
|
||||
BackupFile $File_DebianSourceList $File_DebianSourceListBackup " list "
|
||||
;;
|
||||
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_OPENEULER}")
|
||||
## /etc/yum.repos.d
|
||||
# /etc/yum.repos.d
|
||||
BackupRepo $Dir_YumRepos $Dir_YumReposBackup
|
||||
;;
|
||||
"${SYSTEM_OPENSUSE}")
|
||||
## /etc/zypp/repos.d
|
||||
# /etc/zypp/repos.d
|
||||
BackupRepo $Dir_openSUSERepos $Dir_openSUSEReposBackup
|
||||
;;
|
||||
"${SYSTEM_ARCH}")
|
||||
## /etc/pacman.d/mirrorlist
|
||||
# /etc/pacman.d/mirrorlist
|
||||
BackupFile $File_ArchMirrorList $File_ArchMirrorListBackup " mirrorlist "
|
||||
;;
|
||||
"${SYSTEM_ALPINE}")
|
||||
# /etc/apk/repositories
|
||||
BackupFile $File_AlpineRepositories $File_AlpineRepositoriesBackup " repositories "
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
@@ -911,6 +914,9 @@ function RemoveOriginMirrors() {
|
||||
"${SYSTEM_ARCH}")
|
||||
[ -f $File_ArchMirrorList ] && sed -i '1,$d' $File_ArchMirrorList
|
||||
;;
|
||||
"${SYSTEM_ALPINE}")
|
||||
[ -f $File_AlpineRepositories ] && sed -i '1,$d' $File_AlpineRepositories
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -958,6 +964,9 @@ function ChangeMirrors() {
|
||||
"${SYSTEM_ARCH}")
|
||||
DiffMode1 $File_ArchMirrorListBackup $File_ArchMirrorList
|
||||
;;
|
||||
"${SYSTEM_ALPINE}")
|
||||
DiffMode1 $File_AlpineRepositoriesBackup $File_AlpineRepositories
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
@@ -982,6 +991,9 @@ function ChangeMirrors() {
|
||||
"${SYSTEM_ARCH}")
|
||||
ArchMirrors
|
||||
;;
|
||||
"${SYSTEM_ALPINE}")
|
||||
AlpineMirrors
|
||||
;;
|
||||
esac
|
||||
## 比较差异
|
||||
if [[ "${PRINT_DIFF}" == true ]]; then
|
||||
@@ -1002,6 +1014,9 @@ function ChangeMirrors() {
|
||||
"${SYSTEM_ARCH}")
|
||||
pacman -Sy
|
||||
;;
|
||||
"${SYSTEM_ALPINE}")
|
||||
apk update -f
|
||||
;;
|
||||
esac
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "\n$COMPLETE 软件源更换完毕"
|
||||
@@ -1017,21 +1032,34 @@ function ChangeMirrors() {
|
||||
|
||||
## 更新软件包
|
||||
function UpdateSoftware() {
|
||||
function Main() {
|
||||
echo -e ''
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}")
|
||||
apt-get upgrade -y
|
||||
;;
|
||||
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_OPENEULER}")
|
||||
yum update -y --skip-broken
|
||||
;;
|
||||
"${SYSTEM_OPENSUSE}")
|
||||
zypper update -y
|
||||
function CleanCache() {
|
||||
## 跳过特殊系统
|
||||
case "${SYSTEM_JUDGMENT}" in
|
||||
"${SYSTEM_ARCH}" | "${SYSTEM_RHEL}" | "${SYSTEM_ALPINE}")
|
||||
return
|
||||
;;
|
||||
esac
|
||||
}
|
||||
function CleanCache() {
|
||||
## 交互确认
|
||||
if [[ -z "${CLEAN_CACHE}" ]]; then
|
||||
CLEAN_CACHE="false"
|
||||
local CHOICE
|
||||
CHOICE=$(echo -e "\n${BOLD}└─ 是否清理已下载的软件包缓存? [Y/n] ${PLAIN}")
|
||||
read -rp "${CHOICE}" INPUT
|
||||
[[ -z "${INPUT}" ]] && INPUT=Y
|
||||
case "${INPUT}" in
|
||||
[Yy] | [Yy][Ee][Ss])
|
||||
CLEAN_CACHE="true"
|
||||
;;
|
||||
[Nn] | [Nn][Oo]) ;;
|
||||
*)
|
||||
echo -e "\n$WARN 输入错误,默认不清理!"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [[ "${CLEAN_CACHE}" == "false" ]]; then
|
||||
return
|
||||
fi
|
||||
## 调用系统命令
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}")
|
||||
apt-get autoremove -y >/dev/null 2>&1
|
||||
@@ -1047,7 +1075,16 @@ function UpdateSoftware() {
|
||||
esac
|
||||
echo -e "\n$COMPLETE 清理完毕"
|
||||
}
|
||||
function MainInteraction() {
|
||||
|
||||
## 跳过特殊系统
|
||||
case "${SYSTEM_JUDGMENT}" in
|
||||
"${SYSTEM_ARCH}" | "${SYSTEM_RHEL}")
|
||||
return
|
||||
;;
|
||||
esac
|
||||
## 交互确认
|
||||
if [[ -z "${UPDATA_SOFTWARE}" ]]; then
|
||||
UPDATA_SOFTWARE="false"
|
||||
local CHOICE
|
||||
CHOICE=$(echo -e "\n${BOLD}└─ 是否跳过更新软件包? [Y/n] ${PLAIN}")
|
||||
read -rp "${CHOICE}" INPUT
|
||||
@@ -1055,49 +1092,33 @@ function UpdateSoftware() {
|
||||
case "${INPUT}" in
|
||||
[Yy] | [Yy][Ee][Ss]) ;;
|
||||
[Nn] | [Nn][Oo])
|
||||
Main
|
||||
if [[ "${CLEAN_CACHE}" == "true" ]]; then
|
||||
CleanCache
|
||||
elif [[ -z "${CLEAN_CACHE}" ]]; then
|
||||
CleanCacheInteraction
|
||||
fi
|
||||
UPDATA_SOFTWARE="true"
|
||||
;;
|
||||
*)
|
||||
echo -e "\n$WARN 输入错误,默认不更新!"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
function CleanCacheInteraction() {
|
||||
local CHOICE
|
||||
CHOICE=$(echo -e "\n${BOLD}└─ 是否清理已下载的软件包缓存? [Y/n] ${PLAIN}")
|
||||
read -rp "${CHOICE}" INPUT
|
||||
[[ -z "${INPUT}" ]] && INPUT=Y
|
||||
case "${INPUT}" in
|
||||
[Yy] | [Yy][Ee][Ss])
|
||||
CleanCache
|
||||
;;
|
||||
[Nn] | [Nn][Oo]) ;;
|
||||
*)
|
||||
echo -e "\n$WARN 输入错误,默认不清理!"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
## Arch Linux 和 Red Hat Enterprise Linux 系统不更新软件包
|
||||
if [[ "${UPDATA_SOFTWARE}" == "true" ]]; then
|
||||
Main
|
||||
if [[ "${CLEAN_CACHE}" == "true" ]]; then
|
||||
CleanCache
|
||||
elif [[ -z "${CLEAN_CACHE}" ]]; then
|
||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_ARCH}" && "${SYSTEM_JUDGMENT}" != "${SYSTEM_RHEL}" ]]; then
|
||||
CleanCacheInteraction
|
||||
fi
|
||||
fi
|
||||
elif [[ -z "${UPDATA_SOFTWARE}" ]]; then
|
||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_ARCH}" && "${SYSTEM_JUDGMENT}" != "${SYSTEM_RHEL}" ]]; then
|
||||
MainInteraction
|
||||
fi
|
||||
fi
|
||||
if [[ "${UPDATA_SOFTWARE}" == "false" ]]; then
|
||||
return
|
||||
fi
|
||||
echo -e ''
|
||||
## 调用系统命令
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}")
|
||||
apt-get upgrade -y
|
||||
;;
|
||||
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_OPENEULER}")
|
||||
yum update -y --skip-broken
|
||||
;;
|
||||
"${SYSTEM_OPENSUSE}")
|
||||
zypper update -y
|
||||
;;
|
||||
"${SYSTEM_ALPINE}")
|
||||
apk upgrade --no-cache
|
||||
;;
|
||||
esac
|
||||
CleanCache
|
||||
}
|
||||
|
||||
## 运行结束
|
||||
@@ -1263,6 +1284,7 @@ function RedHatMirrors() {
|
||||
GenRepoFiles_Fedora
|
||||
;;
|
||||
esac
|
||||
## 使用官方源
|
||||
if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then
|
||||
return
|
||||
fi
|
||||
@@ -1421,6 +1443,7 @@ function RedHatMirrors() {
|
||||
## 更换基于 OpenCloudOS 发行版的软件源
|
||||
function OpenCloudOSMirrors() {
|
||||
GenRepoFiles_OpenCloudOS "${SYSTEM_VERSION_NUMBER:0:1}"
|
||||
## 使用官方源
|
||||
if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then
|
||||
return
|
||||
fi
|
||||
@@ -1448,6 +1471,7 @@ function OpenCloudOSMirrors() {
|
||||
## 更换基于 openEuler 发行版的软件源
|
||||
function openEulerMirrors() {
|
||||
GenRepoFiles_openEuler
|
||||
## 使用官方源
|
||||
if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then
|
||||
return
|
||||
fi
|
||||
@@ -1470,6 +1494,7 @@ function openSUSEMirrors() {
|
||||
GenRepoFiles_openSUSE "tumbleweed"
|
||||
;;
|
||||
esac
|
||||
## 使用官方源
|
||||
if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then
|
||||
return
|
||||
fi
|
||||
@@ -1527,9 +1552,10 @@ function openSUSEMirrors() {
|
||||
|
||||
## 更换基于 Arch Linux 发行版的软件源
|
||||
function ArchMirrors() {
|
||||
## 使用官方源
|
||||
if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then
|
||||
SOURCE="mirrors.aliyun.com"
|
||||
echo -e "\n${TIP} 由于 Arch Linux 无官方源已切换至阿里源\n"
|
||||
echo -e "\n${TIP} 由于 Arch Linux 无官方源因此已切换至阿里源\n"
|
||||
fi
|
||||
## 修改源
|
||||
case "${SOURCE_BRANCH}" in
|
||||
@@ -1545,6 +1571,26 @@ function ArchMirrors() {
|
||||
esac
|
||||
}
|
||||
|
||||
## 更换基于 Alpine Linux 发行版的软件源
|
||||
function AlpineMirrors() {
|
||||
## 使用官方源
|
||||
if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then
|
||||
SOURCE="dl-cdn.alpinelinux.org"
|
||||
fi
|
||||
local version_name
|
||||
echo "${SYSTEM_PRETTY_NAME}" | grep " edge" -q
|
||||
if [ $? -eq 0 ]; then
|
||||
version_name="edge"
|
||||
else
|
||||
version_name="v${SYSTEM_VERSION_NUMBER%.*}"
|
||||
fi
|
||||
## 修改源
|
||||
echo "${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/${version_name}/main
|
||||
${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/${version_name}/community" >>$File_AlpineRepositories
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
## 生成 CentOS 官方 repo 源文件
|
||||
function GenRepoFiles_CentOS() {
|
||||
case "$1" in
|
||||
|
||||
@@ -70,6 +70,10 @@
|
||||
<td><a href="https://archlinux.org" target="_blank"><img src="./docs/assets/images/icon/arch-linux.ico" width="16" height="16" style="vertical-align: -0.15em"></a> Arch Linux</td>
|
||||
<td align="center">all</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://www.alpinelinux.org" target="_blank"><img src="./docs/assets/images/icon/alpine.png" width="16" height="16" style="vertical-align: -0.15em"/></a> Alpine Linux</td>
|
||||
<td align="center">v3 / edge</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p align="center">
|
||||
|
||||
BIN
docs/assets/images/icon/alpine.png
Normal file
BIN
docs/assets/images/icon/alpine.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@@ -8,30 +8,25 @@ hide:
|
||||
- footer
|
||||
---
|
||||
|
||||
# GNU/Linux 一键更换系统软件源脚本
|
||||
|
||||
{ width="300" }
|
||||
{ width="300" }
|
||||
|
||||
## 适配系统及其版本
|
||||
|
||||
!!! note inline end "说明"
|
||||
|
||||
当前支持基于 `Debian`、`RedHat`、`OpenCloudOS`、`openEuler`、`openSUSE`、`Arch Linux` 的发行版和及其部分衍生版本
|
||||
点击列表中的图标可快速前往其官网,理论支持所有架构的环境
|
||||
当前支持基于 `Debian`、`RedHat`、`OpenCloudOS`、`openEuler`、`openSUSE`、`Arch Linux`、`Alpine Linux` 的发行版和及其部分衍生版本
|
||||
点击列表中的图标可快速前往其官网,理论支持所有处理器架构的环境
|
||||
|
||||
暂无计划适配更多系统或版本
|
||||
如果你有需求那么请提交至 [Issues](https://github.com/SuperManito/LinuxMirrors/issues)
|
||||
|
||||
<div class="annotate" markdown>
|
||||
|
||||
| 名称 | 版本号 |
|
||||
|---|:---:|
|
||||
| 系统名称 | 适配版本 |
|
||||
| --- | :---: |
|
||||
| <a href="https://www.debian.org" target="_blank"><img src="/assets/images/icon/debian.svg" width="16" height="16" style="vertical-align: -0.45em"></a> Debian | 8.0 ~ 12 |
|
||||
| <a href="https://cn.ubuntu.com" target="_blank"><img src="/assets/images/icon/ubuntu.svg" width="16" height="16" style="vertical-align: -0.15em"></a> Ubuntu :material-information-outline:{ title="支持乌班图家族衍生操作系统,例如 <code>优麒麟</code> <code>Kubuntu</code> 等" } | 14.04 ~ 23 |
|
||||
| <a href="https://www.kali.org" target="_blank"><img src="/assets/images/icon/kali-linux.svg" width="16" height="16"></a> Kali Linux | 2.0 ~ 2023 |
|
||||
| <a href="https://www.deepin.org" target="_blank"><img src="/assets/images/icon/deepin.svg" width="16" height="16" style="vertical-align: -0.25em"></a> Deepin | all |
|
||||
| <a href="https://access.redhat.com/products/red-hat-enterprise-linux" target="_blank"><img src="/assets/images/icon/redhat.svg" width="16" height="16"></a> Red Hat Enterprise Linux :material-information-outline:{ title="使用 <code>Rocky Linux</code> 源" } | 7.0 ~ 9 |
|
||||
| <a href="https://access.redhat.com/products/red-hat-enterprise-linux" target="_blank"><img src="/assets/images/icon/redhat.svg" width="16" height="16"></a> Red Hat Enterprise Linux :material-information-outline:{ title="使用 <code>Rocky Linux</code> 或 <code>CentOS</code> 源" } | 7.0 ~ 9 |
|
||||
| <a href="https://fedoraproject.org/zh-Hans" target="_blank"><img src="/assets/images/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.15em"></a> Fedora | 30 ~ 39 |
|
||||
| <a href="https://www.centos.org" target="_blank"><img src="/assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.15em"></a> CentOS | 7.0 ~ 8.5 / Stream 8 ~ 9 |
|
||||
| <a href="https://rockylinux.org/zh_CN" target="_blank"><img src="/assets/images/icon/rocky-linux.svg" width="16" height="16" style="vertical-align: -0.25em"></a> Rocky Linux | 8 ~ 9 |
|
||||
@@ -40,11 +35,9 @@ hide:
|
||||
| <a href="https://www.openeuler.org/zh" target="_blank"><img src="/assets/images/icon/openeuler.ico" width="16" height="16" style="vertical-align: -0.3em"></a> openEuler | 21.03 ~ 23 |
|
||||
| <a href="https://www.opensuse.org" target="_blank"><img src="/assets/images/icon/opensuse.svg" width="16" height="16"></a> openSUSE | Leep 15 / Tumbleweed |
|
||||
| <a href="https://archlinux.org" target="_blank"><img src="/assets/images/icon/arch-linux.ico" width="16" height="16" style="vertical-align: -0.15em"></a> Arch Linux | all |
|
||||
|
||||
| <a href="https://www.alpinelinux.org" target="_blank"><img src="/assets/images/icon/alpine.png" width="16" height="16" style="vertical-align: -0.15em"></a> Alpine Linux | v3 / edge |
|
||||
</div>
|
||||
|
||||
[开始使用](use/index.md){ .md-button .md-button--primary } [查看软件源列表](mirrors/index.md){ .md-button }
|
||||
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
- :octicons-report-24:{ .lg .middle } __意见与建议__
|
||||
@@ -68,3 +61,6 @@ hide:
|
||||
</div>
|
||||
|
||||
> 这是一个开源的非盈利项目,旨在为从事计算机相关行业的朋友们提供便利
|
||||
|
||||
|
||||
[开 始 使 用](use/index.md){ .md-button .md-button--primary } [查看软件源列表](mirrors/index.md){ .md-button }
|
||||
|
||||
@@ -8,27 +8,26 @@ hide:
|
||||
|
||||
## 中国大陆 :flag-CN:
|
||||
|
||||
> 下方列表中的镜像站均支持 `Debian` `Ubuntu` `CentOS` `openSUSE` 软件源
|
||||
> 列表根据单位性质、地理位置、名称长度进行排序,与实际速度无关,目前没有扩充计划
|
||||
> 下方列表中的镜像站均支持 `Debian` `Ubuntu` `CentOS` `openSUSE` 软件源,列表根据单位性质、地理位置、名称长度进行排序,与实际速度无关
|
||||
|
||||
| 镜像站 | IPv6 | Arch | Kali | Deepin | Rocky | AlmaLinux | EPEL | Fedora | openEuler | OpenCloudOS |
|
||||
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
|
||||
| [阿里云](https://mirrors.aliyun.com "mirrors.aliyun.com") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-circle-off-outline:{style="color:#F6B604"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| [腾讯云](https://mirrors.tencent.com "mirrors.tencent.com") | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [华为云](https://mirrors.huaweicloud.com "mirrors.huaweicloud.com") | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-circle-off-outline:{style="color:#F6B604"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| [网易](https://mirrors.163.com "mirrors.163.com") | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| [搜狐](https://mirrors.sohu.com "mirrors.sohu.com") | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-circle-off-outline:{style="color:#F6B604"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} |
|
||||
| [火山引擎](https://mirrors.volces.com "mirrors.volces.com") | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-circle-off-outline:{style="color:#F6B604"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| [清华大学](https://mirrors.tuna.tsinghua.edu.cn "mirrors.tuna.tsinghua.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| [北京大学](https://mirrors.pku.edu.cn/Mirrors "mirrors.pku.edu.cn/Mirrors") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [浙江大学](https://mirrors.zju.edu.cn "mirrors.zju.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| [南京大学](https://mirrors.nju.edu.cn "mirrors.nju.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| [重庆大学](https://mirrors.cqu.edu.cn "mirrors.cqu.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-circle-off-outline:{style="color:#F6B604"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} |
|
||||
| [兰州大学](https://mirror.lzu.edu.cn "mirror.lzu.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| [上海交通大学](https://mirror.sjtu.edu.cn "mirror.sjtu.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [哈尔滨工业大学](https://mirrors.hit.edu.cn "mirrors.hit.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| [中国科学技术大学](https://mirrors.ustc.edu.cn "mirrors.ustc.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| [中国科学院软件研究所](https://mirror.iscas.ac.cn "mirror.iscas.ac.cn") | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| 镜像站 | IPv6 | Arch | Kali | Deepin | Rocky | AlmaLinux | EPEL | Fedora | openEuler | OpenCloudOS | Alpine |
|
||||
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
|
||||
| [阿里云](https://mirrors.aliyun.com "mirrors.aliyun.com") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-circle-off-outline:{style="color:#F6B604"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [腾讯云](https://mirrors.tencent.com "mirrors.tencent.com") | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [华为云](https://mirrors.huaweicloud.com "mirrors.huaweicloud.com") | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-circle-off-outline:{style="color:#F6B604"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [网易](https://mirrors.163.com "mirrors.163.com") | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} |
|
||||
| [搜狐](https://mirrors.sohu.com "mirrors.sohu.com") | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-circle-off-outline:{style="color:#F6B604"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} |
|
||||
| [火山引擎](https://mirrors.volces.com "mirrors.volces.com") | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-circle-off-outline:{style="color:#F6B604"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [清华大学](https://mirrors.tuna.tsinghua.edu.cn "mirrors.tuna.tsinghua.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [北京大学](https://mirrors.pku.edu.cn/Mirrors "mirrors.pku.edu.cn/Mirrors") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} |
|
||||
| [浙江大学](https://mirrors.zju.edu.cn "mirrors.zju.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [南京大学](https://mirrors.nju.edu.cn "mirrors.nju.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [重庆大学](https://mirrors.cqu.edu.cn "mirrors.cqu.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-circle-off-outline:{style="color:#F6B604"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [兰州大学](https://mirror.lzu.edu.cn "mirror.lzu.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [上海交通大学](https://mirror.sjtu.edu.cn "mirror.sjtu.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [哈尔滨工业大学](https://mirrors.hit.edu.cn "mirrors.hit.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [中国科学技术大学](https://mirrors.ustc.edu.cn "mirrors.ustc.edu.cn") | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} |
|
||||
| [中国科学院软件研究所](https://mirror.iscas.ac.cn "mirror.iscas.ac.cn") | :material-close:{style="color:#EF5350"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} | :material-check:{style="color:#4DB6AC"} |
|
||||
|
||||
???+ question "使用帮助"
|
||||
|
||||
@@ -59,6 +58,7 @@ hide:
|
||||
| 齐鲁工业大学 | [mirrors.qlu.edu.cn](https://mirrors.qlu.edu.cn "https://mirrors.qlu.edu.cn") |
|
||||
| 华南农业大学 | [mirrors.scau.edu.cn](https://mirrors.scau.edu.cn "https://mirrors.scau.edu.cn") |
|
||||
| 西安交通大学 | [mirrors.xjtu.edu.cn](https://mirrors.xjtu.edu.cn "https://mirrors.xjtu.edu.cn") |
|
||||
| 江西理工大学 | [mirrors.jxust.edu.cn](https://mirrors.jxust.edu.cn "https://mirrors.jxust.edu.cn") |
|
||||
| 南阳理工学院 | [mirror.nyist.edu.cn](https://mirror.nyist.edu.cn "https://mirror.nyist.edu.cn") |
|
||||
| 武昌首义学院 | [mirrors.wsyu.edu.cn](https://mirrors.wsyu.edu.cn "https://mirrors.wsyu.edu.cn") |
|
||||
| 哈尔滨工业大学 | [mirrors.hit.edu.cn](https://mirrors.hit.edu.cn "https://mirrors.hit.edu.cn") |
|
||||
|
||||
@@ -75,7 +75,7 @@ bash <(curl -sSL https://linuxmirrors.cn/docker.sh)
|
||||
|
||||
卸载命令如下:
|
||||
|
||||
=== "Debian 系 Linux"
|
||||
=== "Debian 系"
|
||||
|
||||
``` bash
|
||||
apt-get remove -y docker* containerd.io runc && apt-get autoremove
|
||||
@@ -83,7 +83,7 @@ bash <(curl -sSL https://linuxmirrors.cn/docker.sh)
|
||||
|
||||
> `Debian` `Ubuntu` `Kali` `Deepin`
|
||||
|
||||
=== "RedHat 系 Linux / OpenCloudOS / openEuler"
|
||||
=== "RedHat 系 / OpenCloudOS / openEuler"
|
||||
|
||||
``` bash
|
||||
yum remove -y docker* containerd.io podman* runc
|
||||
|
||||
@@ -37,9 +37,9 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
|
||||
|
||||
### 指定软件源分支
|
||||
|
||||
使用场景:目标软件源有对应系统镜像但是不符合本脚本关于软件源分支设置的默认规则
|
||||
使用场景:目标镜像站有对应的系统镜像但是不符合本项目脚本关于软件源分支设置的默认规则
|
||||
|
||||
本脚本为了适配大的环境不会针对某一镜像站独特的镜像分支名称而单独定制,最开始是为了更换国内软件源而设计适配的,默认使用的分支名称如下
|
||||
项目脚本为了适配大的环境不会针对某一镜像站独特的镜像分支名称而单独适配,默认使用的分支名称如下
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
@@ -48,7 +48,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://cn.ubuntu.com" target="_blank"><img src="/../assets/images/icon/ubuntu.svg" width="16" height="16" style="vertical-align: -0.15em"/></a> Ubuntu</td>
|
||||
<td align="center">ubuntu/ubuntu-ports</td>
|
||||
<td align="center">ubuntu / ubuntu-ports</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://www.kali.org" target="_blank"><img src="/../assets/images/icon/kali-linux.svg" width="16" height="16"/></a> Kali Linux</td>
|
||||
@@ -60,7 +60,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://access.redhat.com/products/red-hat-enterprise-linux" target="_blank"><img src="/../assets/images/icon/redhat.svg" width="16" height="16" style="vertical-align: -0.15em"/></a> Red Hat Enterprise Linux</td>
|
||||
<td align="center">centos/rocky</td>
|
||||
<td align="center">centos / centos-altarch / rocky</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://fedoraproject.org/zh-Hans" target="_blank"><img src="/../assets/images/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.15em"/></a> Fedora</td>
|
||||
@@ -68,7 +68,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://www.centos.org" target="_blank"><img src="/../assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.15em"/></a> CentOS</td>
|
||||
<td align="center">centos/centos-stream/centos-altarch/centos-vault</td>
|
||||
<td align="center">centos / centos-stream / centos-altarch / centos-vault</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://rockylinux.org" target="_blank"><img src="/../assets/images/icon/rocky-linux.svg" width="16" height="16" style="vertical-align: -0.25em"/></a> Rocky Linux</td>
|
||||
@@ -76,7 +76,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://almalinux.org/zh-hans" target="_blank"><img src="/assets/images/icon/almalinux.svg" width="16" height="16" style="vertical-align: -0.25em"/></a> AlmaLinux</td>
|
||||
<td align="center">almalinux/almalinux-vault</td>
|
||||
<td align="center">almalinux / almalinux-vault</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://www.opencloudos.org" target="_blank"><img src="/assets/images/icon/opencloudos.png" width="16" height="16" style="vertical-align: -0.25em"/></a> OpenCloudOS</td>
|
||||
@@ -92,7 +92,11 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://archlinux.org" target="_blank"><img src="/../assets/images/icon/arch-linux.ico" width="16" height="16" style="vertical-align: -0.15em"/></a> Arch Linux</td>
|
||||
<td align="center">archlinux/archlinuxarm</td>
|
||||
<td align="center">archlinux / archlinuxarm</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://www.alpinelinux.org" target="_blank"><img src="/../assets/images/icon/alpine.png" width="16" height="16" style="vertical-align: -0.15em"/></a> Alpine Linux</td>
|
||||
<td align="center">alpine</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -116,7 +120,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
|
||||
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --only-epel
|
||||
```
|
||||
|
||||
### 恢复官方源
|
||||
### 恢复使用官方源
|
||||
|
||||
当你不小心删除了官方源的备份时可以使用此命令来恢复,使用此命令选项后将跳过选择软件源步骤
|
||||
|
||||
@@ -134,9 +138,9 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
|
||||
--branch-security debian-security
|
||||
```
|
||||
|
||||
### 指定 Debian 系操作系统的版本名称
|
||||
### 指定 Debian 系 Linux 版本代号
|
||||
|
||||
你可以自定义该版本名称,大多数情况下用于升级系统版本,请看下面的例子
|
||||
大多数情况下自定义版本代号用于升级系统版本,请看下面的例子
|
||||
|
||||
``` { .bash .no-copy title="升级 Debian 至最新 12 版本 Bookworm" }
|
||||
bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
|
||||
|
||||
@@ -3,39 +3,43 @@
|
||||
|
||||
!!! quote ""
|
||||
|
||||
- 如果提示 `Command 'curl' not found` 则说明当前未安装 `curl` 软件包
|
||||
=== "Debian 系"
|
||||
|
||||
=== "Debian 系 Linux"
|
||||
``` sh
|
||||
apt-get install -y curl
|
||||
```
|
||||
|
||||
``` sh
|
||||
apt-get install -y curl
|
||||
```
|
||||
> `Debian` `Ubuntu` `Kali` `Deepin`
|
||||
|
||||
> `Debian` `Ubuntu` `Kali` `Deepin`
|
||||
新装系统需要先执行一遍更新 `apt-get update`
|
||||
|
||||
新装系统需要先执行一遍更新 `apt-get update`
|
||||
=== "RedHat 系 / OpenCloudOS / openEuler"
|
||||
|
||||
=== "RedHat 系 Linux / OpenCloudOS / openEuler"
|
||||
``` sh
|
||||
yum install -y curl || dnf install -y curl
|
||||
```
|
||||
|
||||
``` sh
|
||||
yum install -y curl || dnf install -y curl
|
||||
```
|
||||
> `Red Hat Enterprise Linux` `CentOS` `Rocky Linux` `AlmaLinux` `Fedora` `OpenCloudOS` `openEuler`
|
||||
|
||||
> `Red Hat Enterprise Linux` `CentOS` `Rocky Linux` `AlmaLinux` `Fedora` `OpenCloudOS` `openEuler`
|
||||
新装系统需要先执行一遍更新 `yum makecache`
|
||||
|
||||
新装系统需要先执行一遍更新 `yum makecache`
|
||||
=== "openSUSE"
|
||||
|
||||
=== "openSUSE"
|
||||
``` sh
|
||||
zypper install curl
|
||||
```
|
||||
|
||||
``` sh
|
||||
zypper install curl
|
||||
```
|
||||
=== "Arch Linux"
|
||||
|
||||
=== "Arch Linux"
|
||||
``` sh
|
||||
pacman -S curl
|
||||
```
|
||||
|
||||
``` sh
|
||||
pacman -S curl
|
||||
```
|
||||
=== "Alpine Linux"
|
||||
|
||||
``` sh
|
||||
apk --no-cache add -f curl bash
|
||||
```
|
||||
|
||||
## 关于开启 SSH 远程登录的方法
|
||||
|
||||
@@ -70,7 +74,7 @@
|
||||
|
||||
!!! quote ""
|
||||
|
||||
=== "Debian 系 Linux"
|
||||
=== "Debian 系"
|
||||
|
||||
``` sh
|
||||
cp -rvf /etc/apt/sources.list.bak /etc/apt/sources.list
|
||||
@@ -79,7 +83,7 @@
|
||||
|
||||
> `Debian` `Ubuntu` `Kali` `Deepin`
|
||||
|
||||
=== "RedHat 系 Linux / OpenCloudOS / openEuler"
|
||||
=== "RedHat 系 / OpenCloudOS / openEuler"
|
||||
|
||||
``` sh
|
||||
cp -rvf /etc/yum.repos.d.bak /etc/yum.repos.d
|
||||
@@ -102,6 +106,13 @@
|
||||
pacman -Sy
|
||||
```
|
||||
|
||||
=== "Alpine Linux"
|
||||
|
||||
``` sh
|
||||
cp -rvf /etc/apk/repositories.bak /etc/apk/repositories
|
||||
apk update -f
|
||||
```
|
||||
|
||||
## 其它
|
||||
|
||||
!!! quote ""
|
||||
|
||||
@@ -11,7 +11,7 @@ hide:
|
||||
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
|
||||
```
|
||||
|
||||
!!! question "请在使用前检查目标镜像站是否支持您正在使用的操作系统"
|
||||
!!! question "请在使用前检查目标镜像站是否支持您所使用的操作系统"
|
||||
|
||||
??? quote "原始执行命令"
|
||||
|
||||
@@ -37,7 +37,7 @@ hide:
|
||||
|
||||
1. 通过 `--edu` 命令选项来使用中国大陆教育单位软件源
|
||||
|
||||
!!! question "请在使用前检查目标镜像站是否支持您正在使用的操作系统"
|
||||
!!! question "请在使用前检查目标镜像站是否支持您所使用的操作系统"
|
||||
|
||||
??? quote "原始执行命令"
|
||||
|
||||
@@ -63,7 +63,7 @@ hide:
|
||||
|
||||
1. 通过 `--abroad` 命令选项来使用海外软件源
|
||||
|
||||
!!! question "请在使用前检查目标镜像站是否支持您正在使用的操作系统"
|
||||
!!! question "请在使用前检查目标镜像站是否支持您所使用的操作系统"
|
||||
|
||||
??? quote "原始执行命令"
|
||||
|
||||
@@ -109,13 +109,13 @@ hide:
|
||||
|
||||
遵循系统默认设置即没有启用的软件源不会在运行完本脚本后被启用,但是它们也随脚本更换了目标软件源地址,如果你有使用需求请阅读下面的启用方法
|
||||
|
||||
=== "Debian 系 Linux"
|
||||
=== "Debian 系"
|
||||
|
||||
默认禁用了`deb-src`源码仓库和`proposed`预发布软件源,若需启用请将 `/etc/apt/sources.list` 文件中相关内容的所在行取消注释
|
||||
|
||||
> `Debian` `Ubuntu` `Kali` `Deepin`
|
||||
|
||||
=== "RedHat 系 Linux / OpenCloudOS / openEuler"
|
||||
=== "RedHat 系 / OpenCloudOS / openEuler"
|
||||
|
||||
部分仓库默认没有启用,若需启用请将 `/etc/yum.repos.d` 目录下相关 repo 文件中的 `enabled` 值修改为 `1`
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
site_name: LinuxMirrors
|
||||
repo_name: SuperManito/LinuxMirrors
|
||||
repo_name: GitHub Repository
|
||||
repo_url: https://github.com/SuperManito/LinuxMirrors
|
||||
edit_uri: edit/main/docs/
|
||||
copyright: 'Copyright © 2024 <a href="https://github.com/SuperManito" target="_blank"> SuperManito</a> <a href="https://www.netlify.com" target="_blank"><img height="64" width="64" src="/assets/images/icon/netlify.svg" style="vertical-align: -0.6em"></a>'
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
mkdocs-material==9.5.3
|
||||
mkdocs-material==9.5.4
|
||||
mkdocs-glightbox==0.3.5
|
||||
mkdocs-exclude-search==0.6.6
|
||||
Reference in New Issue
Block a user