mirror of
				https://gitee.com/SuperManito/LinuxMirrors
				synced 2025-11-04 08:20:28 +08:00 
			
		
		
		
	优化
This commit is contained in:
		@@ -1,8 +1,8 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
## Author: SuperManito
 | 
			
		||||
## Modified: 2023-06-20
 | 
			
		||||
## Modified: 2023-06-24
 | 
			
		||||
## License: MIT
 | 
			
		||||
## Github: https://github.com/SuperManito/LinuxMirrors
 | 
			
		||||
## GitHub: https://github.com/SuperManito/LinuxMirrors
 | 
			
		||||
## Website: https://linuxmirrors.cn
 | 
			
		||||
 | 
			
		||||
## 软件源列表
 | 
			
		||||
@@ -99,7 +99,6 @@ mirror_list_abroad=(
 | 
			
		||||
)
 | 
			
		||||
# 中国大陆教育网格式:"软件源名称@软件源地址"
 | 
			
		||||
mirror_list_edu=(
 | 
			
		||||
    "ISCAS@mirror.iscas.ac.cn"
 | 
			
		||||
    "清华大学@mirrors.tuna.tsinghua.edu.cn"
 | 
			
		||||
    "北京大学@mirrors.pku.edu.cn"
 | 
			
		||||
    "南京大学@mirrors.nju.edu.cn"
 | 
			
		||||
@@ -119,14 +118,14 @@ mirror_list_edu=(
 | 
			
		||||
    "武昌首义学院@mirrors.wsyu.edu.cn"
 | 
			
		||||
    "哈尔滨工业大学@mirrors.hit.edu.cn"
 | 
			
		||||
    "北京外国语大学@mirrors.bfsu.edu.cn"
 | 
			
		||||
    "大连东软信息学院@mirrors.neusoft.edu.cn"
 | 
			
		||||
    "西北农林科技大学@mirrors.nwafu.edu.cn"
 | 
			
		||||
    "中国科学技术大学@mirrors.ustc.edu.cn"
 | 
			
		||||
    "西北农林科技大学@mirrors.nwafu.edu.cn"
 | 
			
		||||
    "大连东软信息学院@mirrors.neusoft.edu.cn"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
## 配置需要区分公网地址和内网地址的软件源(不分地域)
 | 
			
		||||
# 配置方法:需要同时在两个数组变量中分别定义软件源地址,并且保证排列顺序一致
 | 
			
		||||
# 工作原理:当检测到用户所选择的软件源地址在 “软件源公网地址列表” 中时就会询问是否切换为内网地址,然后从 “软件源内网地址列表” 相同的位置提取内网地址
 | 
			
		||||
# 工作原理:当检测到用户所选择的软件源地址在 “软件源公网地址列表” 中时就会询问是否切换为内网地址,然后在 “软件源内网地址列表” 从相同的位置提取内网地址
 | 
			
		||||
# 软件源公网地址列表
 | 
			
		||||
mirror_list_extranet=(
 | 
			
		||||
    "mirrors.aliyun.com"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +1,17 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
## Author: SuperManito
 | 
			
		||||
## Modified: 2023-06-21
 | 
			
		||||
## Modified: 2023-06-24
 | 
			
		||||
## License: MIT
 | 
			
		||||
## Github: https://github.com/SuperManito/LinuxMirrors
 | 
			
		||||
## GitHub: https://github.com/SuperManito/LinuxMirrors
 | 
			
		||||
## Website: https://linuxmirrors.cn
 | 
			
		||||
 | 
			
		||||
## Docker DE 软件源列表
 | 
			
		||||
# 国内格式:"软件源名称@软件源地址"
 | 
			
		||||
## Docker CE 软件源列表
 | 
			
		||||
# 格式:"软件源名称@软件源地址"
 | 
			
		||||
mirror_list_docker_ce=(
 | 
			
		||||
    "阿里云@mirrors.aliyun.com/docker-ce"
 | 
			
		||||
    "腾讯云@mirrors.tencent.com/docker-ce"
 | 
			
		||||
    "华为云@repo.huaweicloud.com/docker-ce"
 | 
			
		||||
    "微软云@mirror.azure.cn/docker-ce"
 | 
			
		||||
    "微软 Azure 中国@mirror.azure.cn/docker-ce"
 | 
			
		||||
    "网易@mirrors.163.com/docker-ce"
 | 
			
		||||
    "清华大学@mirrors.tuna.tsinghua.edu.cn/docker-ce"
 | 
			
		||||
    "北京大学@mirrors.pku.edu.cn/docker-ce"
 | 
			
		||||
@@ -23,8 +23,13 @@ mirror_list_docker_ce=(
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
## Docker Registry 镜像仓库列表
 | 
			
		||||
# 国内格式:"软件源名称@软件源地址"
 | 
			
		||||
# 格式:"软件源名称@软件源地址"
 | 
			
		||||
mirror_list_registry=(
 | 
			
		||||
    "上海交通大学@docker.mirrors.sjtug.sjtu.edu.cn"
 | 
			
		||||
    "网易@hub-mirror.c.163.com"
 | 
			
		||||
    "道客 DaoCloud@f1361db2.m.daocloud.io"
 | 
			
		||||
    "腾讯云@mirror.ccs.tencentyun.com"
 | 
			
		||||
    "微软 Azure 中国@dockerhub.azk8s.com"
 | 
			
		||||
    "阿里云(杭州)@registry.cn-hangzhou.aliyuncs.com"
 | 
			
		||||
    "阿里云(上海)@registry.cn-shanghai.aliyuncs.com"
 | 
			
		||||
    "阿里云(青岛)@registry.cn-qingdao.aliyuncs.com"
 | 
			
		||||
@@ -36,11 +41,6 @@ mirror_list_registry=(
 | 
			
		||||
    "阿里云(河源)@registry.cn-heyuan.aliyuncs.com"
 | 
			
		||||
    "阿里云(广州)@registry.cn-guangzhou.aliyuncs.com"
 | 
			
		||||
    "阿里云(成都)@registry.cn-chengdu.aliyuncs.com"
 | 
			
		||||
    "腾讯云@mirror.ccs.tencentyun.com"
 | 
			
		||||
    "微软云@dockerhub.azk8s.com"
 | 
			
		||||
    "网易@hub-mirror.c.163.com"
 | 
			
		||||
    "上海交通大学@docker.mirrors.sjtug.sjtu.edu.cn"
 | 
			
		||||
    "道客 DaoCloud@f1361db2.m.daocloud.io"
 | 
			
		||||
    "阿里云(香港)@registry.cn-hongkong.aliyuncs.com"
 | 
			
		||||
    "阿里云(日本-东京)@registry.ap-northeast-1.aliyuncs.com"
 | 
			
		||||
    "阿里云(新加坡)@registry.ap-southeast-1.aliyuncs.com"
 | 
			
		||||
@@ -53,7 +53,7 @@ mirror_list_registry=(
 | 
			
		||||
    "阿里云(美国西部-硅谷)@registry.us-west-1.aliyuncs.com"
 | 
			
		||||
    "阿里云(美国东部-弗吉尼亚)@registry.us-east-1.aliyuncs.com"
 | 
			
		||||
    "阿里云(阿联酋-迪拜)@registry.me-east-1.aliyuncs.com"
 | 
			
		||||
    "谷歌云@gcr.io"
 | 
			
		||||
    "谷歌云@mirror.gcr.io"
 | 
			
		||||
    "官方@registry.hub.docker.com"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,32 @@ hide:
 | 
			
		||||
 | 
			
		||||
    目前不建议使用`阿里云`镜像站,由于使用人数过多其公网下行带宽已被限制在了10M左右。如果你的内网环境过于复杂例如经过了多次NAT转换那么请不要使用`清华大学(TUNA)`镜像站,容易被阻断
 | 
			
		||||
 | 
			
		||||
??? note "国内教育网"
 | 
			
		||||
 | 
			
		||||
    | 镜像站名称 | 镜像站地址 |
 | 
			
		||||
    | :- | :-: |
 | 
			
		||||
    | 清华大学 | [mirrors.tuna.tsinghua.edu.cn](https://mirrors.tuna.tsinghua.edu.cn) |
 | 
			
		||||
    | 北京大学 | [mirrors.pku.edu.cn](https://mirrors.pku.edu.cn) |
 | 
			
		||||
    | 南京大学 | [mirrors.nju.edu.cn](https://mirrors.nju.edu.cn) |
 | 
			
		||||
    | 重庆大学 | [mirrors.cqu.edu.cn](https://mirrors.cqu.edu.cn) |
 | 
			
		||||
    | 兰州大学 | [mirror.lzu.edu.cn](https://mirror.lzu.edu.cn) |
 | 
			
		||||
    | 浙江大学 | [mirrors.zju.edu.cn](https://mirrors.zju.edu.cn) |
 | 
			
		||||
    | 山东大学 | [mirrors.sdu.edu.cn](https://mirrors.sdu.edu.cn) |
 | 
			
		||||
    | 吉林大学 | [mirrors.jlu.edu.cn](https://mirrors.jlu.edu.cn) |
 | 
			
		||||
    | 上海交通大学 | [mirror.sjtu.edu.cn](https://mirror.sjtu.edu.cn) |
 | 
			
		||||
    | 上海科技大学 | [mirrors.shanghaitech.edu.cn](https://mirrors.shanghaitech.edu.cn) |
 | 
			
		||||
    | 南方科技大学 | [mirrors.sustech.edu.cn](https://mirrors.sustech.edu.cn) |
 | 
			
		||||
    | 南京邮电大学 | [mirrors.njupt.edu.cn](https://mirrors.njupt.edu.cn) |
 | 
			
		||||
    | 电子科技大学 | [mirrors.uestc.cn](https://mirrors.uestc.cn) |
 | 
			
		||||
    | 北京交通大学 | [mirror.bjtu.edu.cn](https://mirror.bjtu.edu.cn) |
 | 
			
		||||
    | 齐鲁工业大学 | [mirrors.qlu.edu.cn](https://mirrors.qlu.edu.cn) |
 | 
			
		||||
    | 南阳理工学院 | [mirror.nyist.edu.cn](https://mirror.nyist.edu.cn) |
 | 
			
		||||
    | 武昌首义学院 | [mirrors.wsyu.edu.cn](https://mirrors.wsyu.edu.cn) |
 | 
			
		||||
    | 哈尔滨工业大学 | [mirrors.hit.edu.cn](https://mirrors.hit.edu.cn) |
 | 
			
		||||
    | 北京外国语大学 | [mirrors.bfsu.edu.cn](https://mirrors.bfsu.edu.cn) |
 | 
			
		||||
    | 中国科学技术大学 | [mirrors.ustc.edu.cn](https://mirrors.ustc.edu.cn) |
 | 
			
		||||
    | 西北农林科技大学 | [mirrors.nwafu.edu.cn](https://mirrors.nwafu.edu.cn) |
 | 
			
		||||
    | 大连东软信息学院 | [mirrors.neusoft.edu.cn](https://mirrors.neusoft.edu.cn) |
 | 
			
		||||
 | 
			
		||||
## 海外地区 :flag-world-map:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,9 +36,17 @@ bash <(curl -sSL https://linuxmirrors.cn/docker.sh)
 | 
			
		||||
 | 
			
		||||
??? quote "原始执行脚本方法"
 | 
			
		||||
 | 
			
		||||
    ``` bash
 | 
			
		||||
    bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh)
 | 
			
		||||
    ```
 | 
			
		||||
    === ":simple-github: GitHub"
 | 
			
		||||
 | 
			
		||||
        ``` bash
 | 
			
		||||
        bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/DockerInstallation.sh)
 | 
			
		||||
        ```
 | 
			
		||||
 | 
			
		||||
    === ":simple-gitee: Gitee"
 | 
			
		||||
 | 
			
		||||
        ``` bash
 | 
			
		||||
        bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh)
 | 
			
		||||
        ```
 | 
			
		||||
 | 
			
		||||
!!! node ""
 | 
			
		||||
 | 
			
		||||
@@ -51,12 +59,14 @@ bash <(curl -sSL https://linuxmirrors.cn/docker.sh)
 | 
			
		||||
 | 
			
		||||
| 名称 | 含义 | 选项值 |
 | 
			
		||||
| :-: | :-: | :-: |
 | 
			
		||||
| `--source` | 指定 `Docker CE` 源地址 | 地址 |
 | 
			
		||||
| `--source-registry` | 指定镜像仓库地址 | 地址 |
 | 
			
		||||
| `--source` | 指定 `Docker CE` 源地址(域名或IP) | 地址 |
 | 
			
		||||
| `--source-registry` | 指定镜像仓库地址(域名或IP) | 地址 |
 | 
			
		||||
| `--codename` | 指定 Debian 系操作系统的版本名称 | 版本名 |
 | 
			
		||||
| `--install-latested` | 控制是否安装最新版本的 Docker Engine | `true` 或 `false` |
 | 
			
		||||
| `--ignore-backup-tips` | 忽略覆盖备份提示(即不覆盖备份) | 无 |
 | 
			
		||||
 | 
			
		||||
> 软件源格式 `<指定WEB协议>://<软件源地址>/<软件源分支>`
 | 
			
		||||
 | 
			
		||||
### 关于服务报错无法启动
 | 
			
		||||
 | 
			
		||||
!!! quote ""
 | 
			
		||||
 
 | 
			
		||||
@@ -40,3 +40,6 @@
 | 
			
		||||
    font-size: .8rem !important;
 | 
			
		||||
    font-weight: 600 !important;
 | 
			
		||||
}
 | 
			
		||||
.md-typeset {
 | 
			
		||||
    font-size: 16px;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,9 @@
 | 
			
		||||
| :-: | :-: | :-: |
 | 
			
		||||
| `--abroad` | 使用海外软件源 | 无 |
 | 
			
		||||
| `--edu` | 使用中国大陆教育网软件源 | 无 |
 | 
			
		||||
| `--source` | 指定软件源地址 | 地址 |
 | 
			
		||||
| `--source-security` | 指定 Debian 的 security 软件源地址 | 地址 |
 | 
			
		||||
| `--source-vault` | 指定 CentOS/AlmaLinux 的 vault 软件源地址 | 地址 |
 | 
			
		||||
| `--source` | 指定软件源地址(域名或IP) | 地址 |
 | 
			
		||||
| `--source-security` | 指定 Debian 的 security 软件源地址(域名或IP) | 地址 |
 | 
			
		||||
| `--source-vault` | 指定 CentOS/AlmaLinux 的 vault 软件源地址(域名或IP) | 地址 |
 | 
			
		||||
| `--branch` | 指定软件源分支(路径) | 分支名 |
 | 
			
		||||
| `--branch-security` | 指定 Debian 的 security 软件源分支(路径) | 分支名 |
 | 
			
		||||
| `--branch-vault` | 指定 CentOS/AlmaLinux 的 vault 软件源分支(路径) | 分支名 |
 | 
			
		||||
@@ -21,6 +21,8 @@
 | 
			
		||||
| `--print-diff` | 打印源文件修改前后差异 | `true` 或 `false` |
 | 
			
		||||
| `--help` | 查看帮助菜单 | 无 |
 | 
			
		||||
 | 
			
		||||
> 软件源格式 `<指定WEB协议>://<软件源地址>/<软件源分支>`
 | 
			
		||||
 | 
			
		||||
## 示例
 | 
			
		||||
 | 
			
		||||
### 指定软件源地址
 | 
			
		||||
@@ -97,7 +99,9 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
 | 
			
		||||
  --branch rockylinux
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
阿里云镜像站的 Rocky Linux 镜像分支名称为 [`rockylinux`](https://mirrors.aliyun.com/rockylinux),不符合默认规则,但是可以通过命令选项绕过脚本默认规则来实现
 | 
			
		||||
阿里云镜像站的 Rocky Linux 镜像分支名称为 [`rockylinux`](https://mirrors.aliyun.com/rockylinux),不符合默认规则,但是可以通过命令选项绕过脚本默认规则来实现。
 | 
			
		||||
 | 
			
		||||
什么是默认规则?参考这几个例子: `Debian GNU/Linux => debian`、`Kali Linux => kali`、`Rocky Linux => rocky`、`AlmaLinux => almalinux`
 | 
			
		||||
 | 
			
		||||
### 单独更换 EPEL 源
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,34 +5,72 @@ hide:
 | 
			
		||||
 | 
			
		||||
## 执行命令
 | 
			
		||||
 | 
			
		||||
### 国内使用(默认)
 | 
			
		||||
> 建议在使用前确认目标镜像站是否支持您正在使用的操作系统
 | 
			
		||||
 | 
			
		||||
``` bash
 | 
			
		||||
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### 海外使用
 | 
			
		||||
 | 
			
		||||
``` bash
 | 
			
		||||
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --abroad # (1)!
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
1.  通过 `--abroad` 命令选项来使用海外软件源
 | 
			
		||||
 | 
			
		||||
### 国内教育网使用
 | 
			
		||||
 | 
			
		||||
``` bash
 | 
			
		||||
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --edu # (1)!
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
1.  通过 `--edu` 命令选项来使用中国教育单位软件源
 | 
			
		||||
 | 
			
		||||
??? quote "原始执行脚本方法"
 | 
			
		||||
=== ":material-home: 国内使用(默认)"
 | 
			
		||||
 | 
			
		||||
    ``` bash
 | 
			
		||||
    bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh)
 | 
			
		||||
    bash <(curl -sSL https://linuxmirrors.cn/main.sh)
 | 
			
		||||
    ```
 | 
			
		||||
 | 
			
		||||
    ??? quote "原始执行脚本方法"
 | 
			
		||||
 | 
			
		||||
        === ":simple-github: GitHub"
 | 
			
		||||
 | 
			
		||||
            ``` bash
 | 
			
		||||
            bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh)
 | 
			
		||||
            ```
 | 
			
		||||
 | 
			
		||||
        === ":simple-gitee: Gitee"
 | 
			
		||||
 | 
			
		||||
            ``` bash
 | 
			
		||||
            bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh)
 | 
			
		||||
            ```
 | 
			
		||||
 | 
			
		||||
=== ":material-school: 国内教育网使用"
 | 
			
		||||
 | 
			
		||||
    ``` bash
 | 
			
		||||
    bash <(curl -sSL https://linuxmirrors.cn/main.sh) --edu # (1)!
 | 
			
		||||
    ```
 | 
			
		||||
 | 
			
		||||
    1.  通过 `--edu` 命令选项来使用中国教育单位软件源
 | 
			
		||||
 | 
			
		||||
    ??? quote "原始执行脚本方法"
 | 
			
		||||
 | 
			
		||||
        === ":simple-github: GitHub"
 | 
			
		||||
 | 
			
		||||
            ``` bash
 | 
			
		||||
            bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh) --edu
 | 
			
		||||
            ```
 | 
			
		||||
 | 
			
		||||
        === ":simple-gitee: Gitee"
 | 
			
		||||
 | 
			
		||||
            ``` bash
 | 
			
		||||
            bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --edu
 | 
			
		||||
            ```
 | 
			
		||||
 | 
			
		||||
=== ":octicons-globe-16: 海外使用"
 | 
			
		||||
 | 
			
		||||
    ``` bash
 | 
			
		||||
    bash <(curl -sSL https://linuxmirrors.cn/main.sh) --abroad # (1)!
 | 
			
		||||
    ```
 | 
			
		||||
 | 
			
		||||
    1.  通过 `--abroad` 命令选项来使用海外软件源
 | 
			
		||||
 | 
			
		||||
    ??? quote "原始执行脚本方法"
 | 
			
		||||
 | 
			
		||||
        === ":simple-github: GitHub"
 | 
			
		||||
 | 
			
		||||
            ``` bash
 | 
			
		||||
            bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh) --abroad
 | 
			
		||||
            ```
 | 
			
		||||
 | 
			
		||||
        === ":simple-gitee: Gitee"
 | 
			
		||||
 | 
			
		||||
            ``` bash
 | 
			
		||||
            bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --abroad
 | 
			
		||||
            ```
 | 
			
		||||
 | 
			
		||||
## 注意事项
 | 
			
		||||
 | 
			
		||||
:material-numeric-1:{style="color: #3CA7E5"} 需使用 `Root` 用户执行脚本
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,3 @@
 | 
			
		||||
mkdocs-material==9.1.6
 | 
			
		||||
mkdocs-glightbox==0.3.4
 | 
			
		||||
mkdocs-exclude-search==0.6.5
 | 
			
		||||
Mkdocs-material==9.1.17
 | 
			
		||||
Mkdocs-glightbox==0.3.4
 | 
			
		||||
Mkdocs-exclude-search==0.6.5
 | 
			
		||||
		Reference in New Issue
	
	Block a user