mirror of
https://gitee.com/SuperManito/LinuxMirrors
synced 2025-11-01 23:10:28 +08:00
新增适配 NixOS
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
## Author: SuperManito
|
||||
## Modified: 2025-01-22
|
||||
## Modified: 2025-02-20
|
||||
## License: MIT
|
||||
## GitHub: https://github.com/SuperManito/LinuxMirrors
|
||||
## Website: https://linuxmirrors.cn
|
||||
@@ -176,6 +176,7 @@ SYSTEM_OPENSUSE="openSUSE"
|
||||
SYSTEM_ARCH="Arch"
|
||||
SYSTEM_ALPINE="Alpine"
|
||||
SYSTEM_GENTOO="Gentoo"
|
||||
SYSTEM_NIXOS="NixOS"
|
||||
|
||||
## 定义系统版本文件
|
||||
File_LinuxRelease=/etc/os-release
|
||||
@@ -213,6 +214,8 @@ File_GentooMakeConf=/etc/portage/make.conf
|
||||
File_GentooMakeConfBackup=/etc/portage/make.conf.bak
|
||||
File_GentooReposConf=/etc/portage/repos.conf/gentoo.conf
|
||||
File_GentooReposConfBackup=/etc/portage/repos.conf/gentoo.conf.bak
|
||||
File_NixConf=/etc/nix/nix.conf
|
||||
File_NixConfBackup=/etc/nix/nix.conf.bak
|
||||
Dir_GentooReposConf=/etc/portage/repos.conf
|
||||
Dir_DebianExtendSource=/etc/apt/sources.list.d
|
||||
Dir_DebianExtendSourceBackup=/etc/apt/sources.list.d.bak
|
||||
@@ -220,6 +223,7 @@ Dir_YumRepos=/etc/yum.repos.d
|
||||
Dir_YumReposBackup=/etc/yum.repos.d.bak
|
||||
Dir_ZYppRepos=/etc/zypp/repos.d
|
||||
Dir_ZYppReposBackup=/etc/zypp/repos.d.bak
|
||||
Dir_NixConfig=/etc/nix
|
||||
|
||||
## 定义颜色变量
|
||||
RED='\033[31m'
|
||||
@@ -660,6 +664,8 @@ function collect_system_info() {
|
||||
SYSTEM_FACTIONS="${SYSTEM_GENTOO}"
|
||||
elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then
|
||||
SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}"
|
||||
elif [[ "${SYSTEM_NAME}" == *"NixOS"* ]]; then
|
||||
SYSTEM_FACTIONS="${SYSTEM_NIXOS}"
|
||||
else
|
||||
output_error "当前操作系统不在本脚本的支持范围内,请前往官网查看支持列表!"
|
||||
fi
|
||||
@@ -753,7 +759,7 @@ function collect_system_info() {
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"${SYSTEM_KALI}" | "${SYSTEM_DEEPIN}" | "${SYSTEM_ZORIN}" | "${SYSTEM_ARCH}" | "${SYSTEM_ALPINE}" | "${SYSTEM_GENTOO}" | "${SYSTEM_OPENKYLIN}")
|
||||
"${SYSTEM_KALI}" | "${SYSTEM_DEEPIN}" | "${SYSTEM_ZORIN}" | "${SYSTEM_ARCH}" | "${SYSTEM_ALPINE}" | "${SYSTEM_GENTOO}" | "${SYSTEM_OPENKYLIN}" | "${SYSTEM_NIXOS}")
|
||||
# 理论全部支持或不作判断
|
||||
;;
|
||||
*)
|
||||
@@ -860,6 +866,9 @@ function collect_system_info() {
|
||||
SOURCE_BRANCH="${SOURCE_BRANCH// /-}"
|
||||
fi
|
||||
;;
|
||||
"${SYSTEM_NIXOS}")
|
||||
SOURCE_BRANCH="nix-channels"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
## 定义软件源更新文字
|
||||
@@ -876,6 +885,9 @@ function collect_system_info() {
|
||||
"${SYSTEM_ARCH}" | "${SYSTEM_GENTOO}")
|
||||
SYNC_MIRROR_TEXT="同步软件源"
|
||||
;;
|
||||
"${SYSTEM_NIXOS}")
|
||||
SYNC_MIRROR_TEXT="更新二进制缓存与频道源"
|
||||
;;
|
||||
esac
|
||||
## 判断是否可以使用高级交互式选择器
|
||||
CAN_USE_ADVANCED_INTERACTIVE_SELECTION="false"
|
||||
@@ -1326,6 +1338,11 @@ function backup_original_mirrors() {
|
||||
[ -d "${Dir_GentooReposConf}" ] || mkdir -p "${Dir_GentooReposConf}"
|
||||
backup_file $File_GentooReposConf $File_GentooReposConfBackup "gentoo.conf"
|
||||
;;
|
||||
"${SYSTEM_NIXOS}")
|
||||
[ ! -d $Dir_NixConfig ] && mkdir -p $Dir_NixConfig
|
||||
# /etc/nix/nix.conf
|
||||
backup_file $File_NixConf $File_NixConfBackup "nix.conf"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
@@ -1523,6 +1540,9 @@ function change_mirrors_main() {
|
||||
diff_file $File_GentooMakeConfBackup $File_GentooMakeConf
|
||||
diff_file $File_GentooReposConfBackup $File_GentooReposConf
|
||||
;;
|
||||
"${SYSTEM_NIXOS}")
|
||||
diff_file $File_NixConfBackup $File_NixConf
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
@@ -1559,6 +1579,9 @@ function change_mirrors_main() {
|
||||
"${SYSTEM_OPENKYLIN}")
|
||||
change_mirrors_openKylin
|
||||
;;
|
||||
"${SYSTEM_NIXOS}")
|
||||
change_mirrors_NixOS
|
||||
;;
|
||||
esac
|
||||
## 比较差异
|
||||
if [[ "${PRINT_DIFF}" == "true" ]]; then
|
||||
@@ -1586,6 +1609,10 @@ function change_mirrors_main() {
|
||||
"${SYSTEM_GENTOO}")
|
||||
emerge --sync --quiet
|
||||
;;
|
||||
"${SYSTEM_NIXOS}")
|
||||
nix-store --verify
|
||||
nix-channel --update
|
||||
;;
|
||||
esac
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "\n$SUCCESS 软件源更换完毕"
|
||||
@@ -1679,6 +1706,9 @@ function upgrade_software() {
|
||||
"${SYSTEM_GENTOO}")
|
||||
emerge --update --deep --with-bdeps=y --ask=n @world
|
||||
;;
|
||||
"${SYSTEM_NIXOS}")
|
||||
nixos-rebuild switch
|
||||
;;
|
||||
esac
|
||||
if [[ "${CLEAN_CACHE}" == "false" ]]; then
|
||||
return
|
||||
@@ -1703,6 +1733,9 @@ function upgrade_software() {
|
||||
eclean-dist --deep >/dev/null 2>&1
|
||||
eclean-packages --deep >/dev/null 2>&1
|
||||
;;
|
||||
"${SYSTEM_NIXOS}")
|
||||
nix-collect-garbage -d >/dev/null 2>&1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -2301,6 +2334,23 @@ deb ${1} ${2}-updates ${3}
|
||||
$(gen_source "${base_url}" "${SYSTEM_VERSION_CODENAME}" "${repository_sections}")" >>$File_DebianSourceList
|
||||
}
|
||||
|
||||
## 更换 NixOS 发行版软件源
|
||||
function change_mirrors_NixOS() {
|
||||
local binary_cache_source channel_source
|
||||
if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then
|
||||
binary_cache_source="https://cache.nixos.org/"
|
||||
channel_source="https://nixos.org/channels"
|
||||
else
|
||||
binary_cache_source="${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/store https://cache.nixos.org/"
|
||||
channel_source="${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}"
|
||||
fi
|
||||
# binary cache
|
||||
sed -i "s|^substituters.*|substituters = ${binary_cache_source}|g" $File_NixConf
|
||||
# channel
|
||||
nix-channel --add "${channel_source}/nixos-${SYSTEM_VERSION_NUMBER}" nixos
|
||||
nix-channel --update >/dev/null 2>&1
|
||||
}
|
||||
|
||||
## EPEL (Extra Packages for Enterprise Linux) 附加软件包 - 安装或更换软件源
|
||||
function change_mirrors_or_install_EPEL() {
|
||||
if [[ "${INSTALL_EPEL}" != "true" ]]; then
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 SuperManito
|
||||
Copyright (c) 2025 SuperManito
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -99,7 +99,11 @@
|
||||
<td align="center">v3 / edge</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://www.gentoo.org" target="_blank"><img src="./docs/assets/images/icon/gentoo.svg" width="16" height="16" style="vertical-align: -0.25em"/></a> Gentoo</td>
|
||||
<td><a href="https://www.gentoo.org" target="_blank"><img src="./docs/assets/images/icon/gentoo.svg" width="16" height="16" style="vertical-align: -0.2em"/></a> Gentoo</td>
|
||||
<td align="center">all</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://nixos.org" target="_blank"><img src="./docs/assets/images/icon/nixos.svg" width="16" height="16" style="vertical-align: -0.15em"/></a> NixOS</td>
|
||||
<td align="center">all</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -116,7 +120,7 @@
|
||||
|
||||
### LICENSE
|
||||
|
||||
Copyright © 2024, [SuperManito](https://github.com/SuperManito). Released under the [MIT](https://github.com/SuperManito/LinuxMirrors/blob/main/LICENSE).
|
||||
Copyright © 2025, [SuperManito](https://github.com/SuperManito). Released under the [MIT](https://github.com/SuperManito/LinuxMirrors/blob/main/LICENSE).
|
||||
|
||||
<a href="https://star-history.com/#SuperManito/LinuxMirrors&Date">
|
||||
<picture>
|
||||
|
||||
1
docs/assets/images/icon/nixos.svg
Normal file
1
docs/assets/images/icon/nixos.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 7.6 KiB |
@@ -118,6 +118,7 @@ hide:
|
||||
| <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_ |
|
||||
| <a href="https://www.gentoo.org" target="_blank"><img src="/assets/images/icon/gentoo.svg" width="16" height="16" style="vertical-align: -0.2em"></a> Gentoo | _all_ |
|
||||
| <a href="https://nixos.org" target="_blank"><img src="/assets/images/icon/nixos.svg" width="16" height="16" style="vertical-align: -0.15em"></a> NixOS | _19 ~ 24_ |
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -10,22 +10,22 @@ hide:
|
||||
|
||||
> 下方列表中的镜像站均支持 `Debian` `Ubuntu` `CentOS` `openSUSE` `openEuler` 软件源,列表根据单位性质、地理位置、名称长度进行排序,与实际速度无关
|
||||
|
||||
| 镜像站 | IPv6 | Arch Linux | Kali Linux | Deepin | Rocky Linux | AlmaLinux | EPEL :material-information-outline:{ title="EPEL (Extra Packages for Enterprise Linux) 是由 Fedora 组织维护的一个附加软件包仓库,它主要适用于除 Fedora 操作系统以外的红帽系 Linux 发行版" } | Fedora | OpenCloudOS | Alpine Linux | Armbian | Proxmox | Linux Mint | Gentoo | Anolis OS | openKylin |
|
||||
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
|
||||
| [阿里云](https://mirrors.aliyun.com "mirrors.aliyun.com") | :supported: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: |
|
||||
| [腾讯云](https://mirrors.tencent.com "mirrors.tencent.com") | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: |
|
||||
| [华为云](https://mirrors.huaweicloud.com "mirrors.huaweicloud.com") | :unsupport: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: |
|
||||
| [网易](https://mirrors.163.com "mirrors.163.com") | :unsupport: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: |
|
||||
| [火山引擎](https://developer.volcengine.com/mirror "mirrors.volces.com") | :unsupport: | :unsupport: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: |
|
||||
| [清华大学](https://mirrors.tuna.tsinghua.edu.cn "mirrors.tuna.tsinghua.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: |
|
||||
| [北京大学](https://mirrors.pku.edu.cn/Mirrors "mirrors.pku.edu.cn") | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: |
|
||||
| [浙江大学](https://mirrors.zju.edu.cn "mirrors.zju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: |
|
||||
| [南京大学](https://mirrors.nju.edu.cn "mirrors.nju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: |
|
||||
| [兰州大学](https://mirror.lzu.edu.cn "mirror.lzu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: |
|
||||
| [上海交通大学](https://mirror.sjtu.edu.cn "mirror.sjtu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :incompatible: | :incompatible: | :supported: | :incompatible: | :supported: | :unsupport: | :supported: | :incompatible: | :unsupport: | :supported: |
|
||||
| [重庆邮电大学](https://mirrors.cqupt.edu.cn "mirrors.cqu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: |
|
||||
| [中国科学技术大学](https://mirrors.ustc.edu.cn "mirrors.ustc.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: |
|
||||
| [中国科学院软件研究所](https://mirror.iscas.ac.cn "mirror.iscas.ac.cn") | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: |
|
||||
| 镜像站 | IPv6 | Arch Linux | Kali Linux | Deepin | Rocky Linux | AlmaLinux | EPEL :material-information-outline:{ title="EPEL (Extra Packages for Enterprise Linux) 是由 Fedora 组织维护的一个附加软件包仓库,它主要适用于除 Fedora 操作系统以外的红帽系 Linux 发行版" } | Fedora | OpenCloudOS | Alpine Linux | Armbian | Proxmox | Linux Mint | Gentoo | Anolis OS | openKylin | NixOS |
|
||||
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
|
||||
| [阿里云](https://mirrors.aliyun.com "mirrors.aliyun.com") | :supported: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :unsupport: |
|
||||
| [腾讯云](https://mirrors.tencent.com "mirrors.tencent.com") | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: |
|
||||
| [华为云](https://mirrors.huaweicloud.com "mirrors.huaweicloud.com") | :unsupport: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: |
|
||||
| [网易](https://mirrors.163.com "mirrors.163.com") | :unsupport: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: |
|
||||
| [火山引擎](https://developer.volcengine.com/mirror "mirrors.volces.com") | :unsupport: | :unsupport: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: |
|
||||
| [清华大学](https://mirrors.tuna.tsinghua.edu.cn "mirrors.tuna.tsinghua.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: |
|
||||
| [北京大学](https://mirrors.pku.edu.cn/Mirrors "mirrors.pku.edu.cn") | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: |
|
||||
| [浙江大学](https://mirrors.zju.edu.cn "mirrors.zju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: |
|
||||
| [南京大学](https://mirrors.nju.edu.cn "mirrors.nju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported:
|
||||
| [兰州大学](https://mirror.lzu.edu.cn "mirror.lzu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: |
|
||||
| [上海交通大学](https://mirror.sjtu.edu.cn "mirror.sjtu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :incompatible: | :incompatible: | :supported: | :incompatible: | :supported: | :unsupport: | :supported: | :incompatible: | :unsupport: | :supported: | :unsupport: |
|
||||
| [重庆邮电大学](https://mirrors.cqupt.edu.cn "mirrors.cqu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: |
|
||||
| [中国科学技术大学](https://mirrors.ustc.edu.cn "mirrors.ustc.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: |
|
||||
| [中国科学院软件研究所](https://mirror.iscas.ac.cn "mirror.iscas.ac.cn") | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: |
|
||||
|
||||
???+ question "使用帮助"
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@ hide:
|
||||
|
||||
## :fontawesome-brands-docker:{style="color: #086dd7"} Docker 安装脚本
|
||||
|
||||
???+ tip inline end "友情提示"
|
||||
|
||||
该脚本近期进行了大量优化,代码逻辑变动较大,如有问题请及时反馈
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="https://www.debian.org" target="_blank"><img src="/assets/images/icon/debian.svg" width="16" height="16" style="vertical-align: -0.35em"></a> Debian</td>
|
||||
@@ -72,7 +68,9 @@ hide:
|
||||
bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/DockerInstallation.sh)
|
||||
```
|
||||
|
||||
脚本参考 [官方文档](https://docs.docker.com/engine/install) 使用系统包管理工具安装,集成安装 [`Docker Engine`](https://docs.docker.com/engine) 和 [`Docker Compose (插件)`](https://docs.docker.com/compose/install/linux),支持选择或更换软件源以及镜像仓库、安装指定版本、重装等功能,支持 ARM 架构处理器
|
||||
集成安装 [`Docker Engine`](https://docs.docker.com/engine) 和 [`Docker Compose (插件)`](https://docs.docker.com/compose/install/linux),支持选择或更换软件源以及镜像仓库、安装指定版本、重装等功能,支持 ARM 架构处理器
|
||||
|
||||
脚本参考 [官方文档](https://docs.docker.com/engine/install) 采用官方提供的方法使用系统包管理工具进行安装,这意味着可安装的版本是由官方仓库决定的,本脚本不存在兼容性等问题。
|
||||
|
||||
> 注:Docker Compose 自 V2 版本起开始作为 Docker CLI 的一部分,不再需要单独安装,请使用 `docker compose` 命令替代 `docker-compose`
|
||||
|
||||
|
||||
@@ -110,35 +110,35 @@ hide:
|
||||
|
||||
选项卡分别代表脚本内置软件源类型和获取脚本途径,请在使用前检查目标镜像站是否支持您所使用的操作系统,可以在[软件源列表](../mirrors/index.md)中查看具体有哪些软件源。
|
||||
|
||||
- ### 注意事项
|
||||
!!! tip "默认自动备份原有软件源内容,如需了解更多请翻阅下方文档"
|
||||
|
||||
<div class="grid cards" markdown>
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
- :material-numeric-1:{style="color: #3CA7E5" .lg} __需使用 `ROOT` 用户执行脚本__
|
||||
- :material-numeric-1:{style="color: #3CA7E5" .lg} __需使用 `ROOT` 用户执行脚本__
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
切换命令为 `sudo -i` 或 `su root`。不同系统使用的命令不同,因为部分系统没有在初始安装时为 ROOT 账户设置密码(例如 Ubuntu)或系统默认禁止 ROOT 用户登录。
|
||||
切换命令为 `sudo -i` 或 `su root`。不同系统使用的命令不同,因为部分系统没有在初始安装时为 ROOT 账户设置密码(例如 Ubuntu)或系统默认禁止 ROOT 用户登录。
|
||||
|
||||
- :material-numeric-2:{style="color: #3CA7E5" .lg} __建议使用支持 `SSH` 的现代化终端应用__
|
||||
- :material-numeric-2:{style="color: #3CA7E5" .lg} __建议使用支持 `SSH` 的现代化终端应用__
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
如果你系统命令行界面的中文显示乱码那么将导致无法查看交互内容,此外部分系统 GUI 图形界面的终端应用可能存在一些无法预料的显示问题。关于 SSH 服务部分系统会自动开启,否则请参考[开启方法](#关于开启-ssh-远程登录的方法)。
|
||||
如果你系统命令行界面的中文显示乱码那么将导致无法查看交互内容,此外部分系统 GUI 图形界面的终端应用可能存在一些无法预料的显示问题。关于 SSH 服务部分系统会自动开启,否则请参考[开启方法](#关于开启-ssh-远程登录的方法)。
|
||||
|
||||
- :material-numeric-3:{style="color: #3CA7E5" .lg} __如果是在新装系统上首次执行脚本__
|
||||
- :material-numeric-3:{style="color: #3CA7E5" .lg} __如果是在新装系统上首次执行脚本__
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
当前执行方式依赖 `curl` 指令获取脚本内容并执行,但部分操作系统没有预装此软件包,届时则会报错 `Command not found`,安装方法详见下方 [_关于报错 Command not found_](#关于报错-command-not-found)。
|
||||
当前执行方式依赖 `curl` 指令获取脚本内容并执行,但部分操作系统没有预装此软件包,届时则会报错 `Command not found`,安装方法详见下方 [_关于报错 Command not found_](#关于报错-command-not-found)。
|
||||
|
||||
- :material-numeric-4:{style="color: #3CA7E5" .lg} __脚本运行期间需要交互选择配置__
|
||||
- :material-numeric-4:{style="color: #3CA7E5" .lg} __脚本运行期间需要交互选择配置__
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
请通过方向键 ++arrow-up++++arrow-down++++arrow-left++++arrow-right++ 或 ++w++++a++++s++++d++ 控制选项并按 ++enter++ 回车键确认。如果发现交互异常那么请改变终端软件的窗口大小后重试,窗口尽量不要太小。
|
||||
请通过方向键 ++arrow-up++++arrow-down++++arrow-left++++arrow-right++ 或 ++w++++a++++s++++d++ 控制选项并按 ++enter++ 回车键确认。如果发现交互异常那么请改变终端软件的窗口大小后重试,窗口尽量不要太小。
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
- ### 常见问题
|
||||
|
||||
@@ -190,6 +190,12 @@ hide:
|
||||
emerge --ask curl
|
||||
```
|
||||
|
||||
=== "NixOS"
|
||||
|
||||
``` bash
|
||||
nix-env -iA nixos.curl
|
||||
```
|
||||
|
||||
??? tip "安装不上?(点击展开查看其它解决方法)"
|
||||
|
||||
假如系统原有软件源是无效的导致安装不上 `curl` 软件包,那么对于 Linux 初学者来说可能会比较麻烦,这里提供几个在线获取脚本的应急方法
|
||||
@@ -316,12 +322,22 @@ hide:
|
||||
emerge --sync --quiet
|
||||
```
|
||||
|
||||
=== "NixOS"
|
||||
|
||||
``` bash
|
||||
cp -rf /etc/nix/nix.conf.bak /etc/nix/nix.conf
|
||||
```
|
||||
|
||||
- #### 其它
|
||||
|
||||
!!! quote ""
|
||||
|
||||
- 如果提示 `bash: /proc/self/fd/11: No such file or directory`,请切换至 `Root` 用户执行,切换命令为 `sudo -i` 或 `su root`
|
||||
|
||||
- ### 关于备份原有软件源
|
||||
|
||||
脚本会自动备份原有软件源内容,备份路径为原有文件或目录的绝对路径加上 `.bak` 后缀,例如 `/etc/apt/sources.list => /etc/apt/sources.list.bak`,当检查到已存在备份内容时会询问是否覆盖备份。
|
||||
|
||||
- ### 关于调用脚本的互联网位置
|
||||
|
||||
项目利用 [GitHub Action](https://github.com/SuperManito/LinuxMirrors/blob/main/.github/workflows/build-docs.yml#L24) 在每次提交后自动拷贝源码到文档目录作为网站资源发布,网站托管于知名 CDN 云服务商几乎没有被劫持的风险请放心使用。
|
||||
@@ -330,15 +346,15 @@ hide:
|
||||
|
||||
- ### 关于软件源下载速度相关问题
|
||||
|
||||
首先在[软件源列表](../mirrors/index.md)页面的使用帮助有使用推荐,这是根据以往经验总结出来的,但总有用户在纠结软件源速度的问题。
|
||||
首先,在[软件源列表](../mirrors/index.md)的使用帮助处有写使用推荐,这是根据以往经验总结出来的,但总有用户在纠结软件源速度的问题。
|
||||
|
||||
软件源(镜像站)的网络延迟即 `Ping` 与下载速度没有太大的关联,双方地理位置间隔的远近不代表实际体验,有些镜像站下行带宽很高但实际测速却并不理想,因为这与镜像站的并发性能和负载策略有关。
|
||||
|
||||
网上也有很多基于 C、Python 编写的镜像站测速开源脚本,而本项目脚本基于 Bash Shell 编写且不依赖任何第三方库,Bash 是 Linux 运维中最常用的脚本语言并且绝大部分发行版都会预装,这意味着用户不需要安装任何环境就能直接运行,这种便利性是其它高级语言无法替代的,不过目前来看 Bash 脚本可能无法实现精准测速的功能。
|
||||
网上也有很多基于 C、Python 编写的镜像站测速开源脚本,而本项目脚本基于 Bash Shell 编写且不依赖任何第三方库,Bash 是 Linux 运维中最常用的脚本语言并且绝大部分发行版都会预装,这意味着用户不需要安装任何环境就能直接运行,这种便利性是其它高级语言无法替代的,不过目前来看 Bash 脚本可能无法实现精准测速的功能,使用其它高级语言编写测速功能无疑是造轮子的行为。
|
||||
|
||||
- ### 关于未启用的软件源
|
||||
- ### 关于未启用的软件源和仓库
|
||||
|
||||
脚本遵循系统默认设置即没有启用的软件源(仓库)不会在运行完本脚本后被启用,但是它们也随脚本更换了目标软件源地址,具体启用方法如下:
|
||||
脚本遵循系统默认设置,默认不启用的软件源(仓库)不会在运行完本脚本后被启用,但是它们也随脚本更换了目标软件源地址,具体启用方法如下:
|
||||
|
||||
=== "Debian 系 / openKylin"
|
||||
|
||||
@@ -434,6 +450,7 @@ hide:
|
||||
| <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 | `archlinux` `archlinuxarm` |
|
||||
| <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 | `alpine` |
|
||||
| <a href="https://www.gentoo.org" target="_blank"><img src="/assets/images/icon/gentoo.svg" width="16" height="16" style="vertical-align: -0.2em"></a> Gentoo | `gentoo` `gentoo-portage` |
|
||||
| <a href="https://nixos.org" target="_blank"><img src="/assets/images/icon/nixos.svg" width="16" height="16" style="vertical-align: -0.15em"></a> NixOS | `nix-channels` |
|
||||
|
||||
|
||||
请看下面的例子
|
||||
|
||||
@@ -2,7 +2,7 @@ site_name: LinuxMirrors
|
||||
repo_name: LinuxMirrors
|
||||
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>'
|
||||
copyright: 'Copyright © 2025 <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>'
|
||||
|
||||
extra_css:
|
||||
- stylesheets/extra.css
|
||||
@@ -62,6 +62,7 @@ theme:
|
||||
- content.code.annotate
|
||||
- search.suggest
|
||||
- search.highlight
|
||||
- search.share
|
||||
- announce.dismiss
|
||||
extra:
|
||||
generator: false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
mkdocs-material==9.5.50
|
||||
mkdocs-material==9.6.5
|
||||
mkdocs-glightbox==0.4.0
|
||||
mkdocs-exclude-search==0.6.6
|
||||
Reference in New Issue
Block a user