2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								| 名称 | 含义 | 选项值 |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| :-: | :-: | :-: |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| `--source`  | 指定软件源地址 | 地址 |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| `--branch`  | 指定软件源分支 | 分支名 |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| `--abroad`  | 使用海外软件源 | 无 |
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 23:41:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								| `--web-protocol`  | 指定 WEB 协议 | `http`  或 `https`  |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| `--intranet`  | 使用内网地址 | `true`  或 `false`  |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| `--install-epel`  | 安装 EPEL 附加软件包 | `true`  或 `false`  |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| `--close-firewall`  | 关闭防火墙 | `true`  或 `false`  |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| `--backup`  | 备份原有软件源 | `true`  或 `false`  |
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								| `--ignore-backup-tips`  | 忽略覆盖备份提示 | 无 |
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 23:41:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								| `--updata-software`  | 更新软件包 | `true`  或 `false`  |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| `--clean-cache`  | 清理下载缓存 | `true`  或 `false`  |
							 
						 
					
						
							
								
									
										
										
										
											2023-05-04 00:31:04 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								| `--help`  | 查看帮助菜单 | 无 |
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## 示例
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								### 指定软件源地址
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								若不想通过交互选择默认提供的软件源,你可以使用该命令选项指定软件源地址
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-04 20:44:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								``` { .bash .no-copy }
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 23:41:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bash ChangeMirrors.sh --source mirrors.ustc.edu.cn
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								### 指定软件源分支
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								使用场景:目标软件源有对应系统镜像但是不符合本脚本关于软件源分支设置的默认规则  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-06 16:44:27 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								本脚本为了适配大的环境不会针对某一镜像站独特的镜像分支名称而单独定制,最开始是为了更换国内软件源而设计适配的,默认使用的分支名称如下
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< table > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-05 22:08:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    < td > < 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< / td > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    < td  align = "center" > debian< / td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-05 22:08:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    < 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 > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-06 13:12:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    < 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 > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    < td  align = "center" > kali< / td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-05 22:08:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    < 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 > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-06 00:44:58 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    < td  align = "center" > centos/rocky< / td > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-05 22:08:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    < td > < a  href = "https://www.centos.org/centos-linux"  target = "_blank" > < img  src = "/../assets/images/icon/centos.svg"  width = "16"  height = "16"  style = "vertical-align: -0.15em" / > < / a >   CentOS< / td > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-06 16:44:27 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    < td  align = "center" > centos/centos-stream/centos-altarch< / td > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-06 13:12:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    < 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 > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    < td  align = "center" > rocky< / td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-06 16:44:27 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< 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< / td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								< tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-05 22:08:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    < 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 > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    < td  align = "center" > fedora< / td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-05 22:08:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    < td > < a  href = "https://www.openeuler.org/zh"  target = "_blank" > < img  src = "/../assets/images/icon/openeuler.ico"  width = "16"  height = "16"  style = "vertical-align: -0.25em" / > < / a >   openEuler< / td > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    < td  align = "center" > openeuler< / td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-05 22:08:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    < td > < a  href = "https://www.opensuse.org"  target = "_blank" > < img  src = "/../assets/images/icon/opensuse.svg"  width = "16"  height = "16"  style = "vertical-align: -0.25em" / > < / a >   openSUSE< / td > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    < td  align = "center" > opensuse< / td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-05 22:08:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< 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 > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								< / table > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								请看下面的例子
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-04 20:44:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								``` { .bash .no-copy title="使用阿里云的 Rocky Linux 软件源" }
							 
						 
					
						
							
								
									
										
										
										
											2023-05-06 16:44:27 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bash < (curl -sSL https://linuxmirrors.cn/main.sh) \
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								  --source mirrors.aliyun.com \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  --branch rockylinux
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								阿里云镜像站的 Rocky Linux 镜像分支名称为 [`rockylinux` ](https://mirrors.aliyun.com/rockylinux ),不符合默认规则,但是可以通过命令选项绕过脚本默认规则来实现
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## 无人值守
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								不通过交互完成换源操作,需要使用大量命令选项来实现,建议熟悉后再使用
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-04 20:44:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								``` { .bash .no-copy title="参考命令" }
							 
						 
					
						
							
								
									
										
										
										
											2023-05-06 16:44:27 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bash < (curl -sSL https://linuxmirrors.cn/main.sh) \
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 23:41:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  --source mirror.example.com \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  --web-protocol http \
							 
						 
					
						
							
								
									
										
										
										
											2023-05-03 22:50:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								  --intranet false \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  --install-epel true \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  --close-firewall true \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  --backup true \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  --updata-software false \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  --clean-cache false \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  --ignore-backup-tips
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```