更新文档

This commit is contained in:
Super Manito
2025-08-16 03:36:02 +08:00
parent 332f31a7c0
commit 69b601b843
10 changed files with 145 additions and 71 deletions

View File

@@ -135,7 +135,7 @@ hide:
</div> </div>
<div style="text-align: center; padding: 1rem 0" markdown> <div style="text-align: center; padding: 1rem 0" markdown>
[Get Started](use/index.md){ .md-button .md-button--primary } &nbsp; [View Mirror List](mirrors/index.md){ .md-button } [Get Started](use/index.md){ .md-button .md-button--primary } &nbsp; [Mirror List](mirrors/index.md){ .md-button }
</div> </div>
--8<-- "docs/sponsor/main.html" --8<-- "docs/sponsor/main.html"

View File

@@ -135,7 +135,7 @@ hide:
</div> </div>
<div style="text-align: center; padding: 1rem 0" markdown> <div style="text-align: center; padding: 1rem 0" markdown>
[开 始 使 用](use/index.md){ .md-button .md-button--primary } &nbsp; [查看软件源列表](mirrors/index.md){ .md-button } [开 始 使 用](use/index.md){ .md-button .md-button--primary } &nbsp; [软件源列表](mirrors/index.md){ .md-button }
</div> </div>
--8<-- "docs/sponsor/main.html" --8<-- "docs/sponsor/main.html"

View File

@@ -82,7 +82,7 @@ hide:
--- ---
腳本透過方向鍵互動逐步引導使用者選擇軟體源配置,讓換源更簡單 腳本透過方向鍵互動逐步引導使用者選擇軟體軟體源配置,讓換源更簡單
此外腳本提供了豐富的命令選項,支援 CI/CD 整合與自動化維運 此外腳本提供了豐富的命令選項,支援 CI/CD 整合與自動化維運
- :material-pencil-ruler-outline:{ .lg .middle } __高度可自定義__ - :material-pencil-ruler-outline:{ .lg .middle } __高度可自定義__
@@ -97,7 +97,7 @@ hide:
--- ---
項目已設立 MIT 開源授權協議,腳本程式碼完全開源且免費使用 項目已設立 MIT 開源授權協議,腳本程式碼完全開源且免費使用
請尊重作者的知識成果,傳播時請在顯著位置標註源或項目地址 請尊重作者的知識成果,傳播時請在顯著位置標註軟體源或項目地址
</div> </div>
@@ -135,7 +135,7 @@ hide:
</div> </div>
<div style="text-align: center; padding: 1rem 0" markdown> <div style="text-align: center; padding: 1rem 0" markdown>
[開 始 使 用](use/index.md){ .md-button .md-button--primary } &nbsp; [查看軟體源列表](mirrors/index.md){ .md-button } [開 始 使 用](use/index.md){ .md-button .md-button--primary } &nbsp; [軟體源列表](mirrors/index.md){ .md-button }
</div> </div>
--8<-- "docs/sponsor/main.html" --8<-- "docs/sponsor/main.html"

View File

@@ -217,13 +217,6 @@ hide:
> Full source format: `<WEB protocol>://<source address (domain or IP)>/<repository path>` > Full source format: `<WEB protocol>://<source address (domain or IP)>/<repository path>`
- #### Specify Docker CE Source Address
``` { .bash .no-copy }
bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --source mirror.example.com/docker-ce
```
> Note: The address path must include the Docker CE repository path, i.e., `docker-ce`.
- #### Specify Registry Mirror Address - #### Specify Registry Mirror Address
``` { .bash .no-copy } ``` { .bash .no-copy }
@@ -285,6 +278,13 @@ hide:
[[ $(systemctl is-active docker) == "active" ]] && systemctl restart docker || systemctl enable --now docker [[ $(systemctl is-active docker) == "active" ]] && systemctl restart docker || systemctl enable --now docker
``` ```
- #### Specify Docker CE Source Address
``` { .bash .no-copy }
bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --source mirror.example.com/docker-ce
```
> Note: The address path must include the Docker CE repository path, i.e., `docker-ce`.
- #### Specify Docker CE Repository - #### Specify Docker CE Repository
The script will automatically detect this in most cases. Specify only if you have special requirements. The script will automatically detect this in most cases. Specify only if you have special requirements.

View File

@@ -232,13 +232,6 @@ hide:
> 软件源完整格式 `<WEB协议>://<软件源地址(域名或IP)>/<软件源仓库(路径)>` > 软件源完整格式 `<WEB协议>://<软件源地址(域名或IP)>/<软件源仓库(路径)>`
- #### 指定 Docker CE 软件源地址
``` { .bash .no-copy }
bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --source mirror.example.com/docker-ce
```
> 注意该地址路径需要包含镜像站的 Docker CE 软件源仓库路径即 `docker-ce`
- #### 指定镜像仓库地址 - #### 指定镜像仓库地址
``` { .bash .no-copy } ``` { .bash .no-copy }
@@ -300,6 +293,13 @@ hide:
[[ $(systemctl is-active docker) == "active" ]] && systemctl restart docker || systemctl enable --now docker [[ $(systemctl is-active docker) == "active" ]] && systemctl restart docker || systemctl enable --now docker
``` ```
- #### 指定 Docker CE 软件源地址
``` { .bash .no-copy }
bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --source mirror.example.com/docker-ce
```
> 注意该地址路径需要包含镜像站的 Docker CE 软件源仓库路径即 `docker-ce`
- #### 指定 Docker CE 软件源仓库 - #### 指定 Docker CE 软件源仓库
脚本默认会自动判断一般无需指定,除非你有特殊需求 脚本默认会自动判断一般无需指定,除非你有特殊需求

View File

@@ -152,11 +152,11 @@ hide:
--- ---
用於控制拉取鏡像的預設源儲存倉庫,又稱為鏡像加速器,預設為官方容器鏡像倉庫 [Docker Hub](https://hub.docker.com) 用於控制拉取鏡像的預設軟體源儲存倉庫,又稱為鏡像加速器,預設為官方容器鏡像倉庫 [Docker Hub](https://hub.docker.com)
</div> </div>
由於一些不可抗力的因素,目前中國大陸網路環境無法訪問 [Docker Hub](https://hub.docker.com),因此無法正常拉取鏡像,建議使用下方提到的中國大陸可用鏡像倉庫 由於一些不可抗力的因素,目前中國大陸網路環境無法訪問 [Docker Hub](https://hub.docker.com),因此無法正常拉取鏡像,建議使用下方提到的中國大陸可用鏡像倉庫軟體
註:腳本內的指定 WEB 協議互動僅用於控制 `Docker CE` 軟體源,`Docker Registry` 強制使用 `HTTPS` 協議 註:腳本內的指定 WEB 協議互動僅用於控制 `Docker CE` 軟體源,`Docker Registry` 強制使用 `HTTPS` 協議
@@ -193,7 +193,7 @@ hide:
| Alibaba Cloud (Hong Kong) | [registry.cn-hongkong.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-hongkong.aliyuncs.com") | Google CloudEurope) | [eu.gcr.io](https://cloud.google.com/artifact-registry/docs/transition/gcr-repositories?hl=zh-cn "https://eu.gcr.io") | | Alibaba Cloud (Hong Kong) | [registry.cn-hongkong.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-hongkong.aliyuncs.com") | Google CloudEurope) | [eu.gcr.io](https://cloud.google.com/artifact-registry/docs/transition/gcr-repositories?hl=zh-cn "https://eu.gcr.io") |
| Tencent Cloud | [mirror.ccs.tencentyun.com](https://cloud.tencent.com/document/product/1207/45596 "https://mirror.ccs.tencentyun.com") | Docker Hub | [registry.hub.docker.com](https://hub.docker.com/ "registry.hub.docker.com") | | Tencent Cloud | [mirror.ccs.tencentyun.com](https://cloud.tencent.com/document/product/1207/45596 "https://mirror.ccs.tencentyun.com") | Docker Hub | [registry.hub.docker.com](https://hub.docker.com/ "registry.hub.docker.com") |
<blockquote style="border-left: none !important">註:中國大陸雲端運算企業的鏡像倉庫源僅針對其業務,中國大陸境內實例可能仍無法造訪 Docker Hub</blockquote> <blockquote style="border-left: none !important">註:中國大陸雲端運算企業的鏡像倉庫軟體源僅針對其業務,中國大陸境內實例可能仍無法造訪 Docker Hub</blockquote>
</div> </div>
@@ -201,7 +201,7 @@ hide:
| 名稱 | 意義 | 選項值 | | 名稱 | 意義 | 選項值 |
| :-: | :-: | :-: | | :-: | :-: | :-: |
| `--source` | 指定 `Docker CE` 源位址(網域名稱或IP) | `位址` | | `--source` | 指定 `Docker CE` 軟體源位址(網域名稱或IP) | `位址` |
| `--source-registry` | 指定鏡像倉庫位址(網域名稱或IP) | `位址` | | `--source-registry` | 指定鏡像倉庫位址(網域名稱或IP) | `位址` |
| `--branch` | 指定 Docker CE 源倉庫 | `倉庫名稱(詳見下方文檔)` | | `--branch` | 指定 Docker CE 源倉庫 | `倉庫名稱(詳見下方文檔)` |
| `--codename` | 指定 Debian 係作業系統的版本代號 | `代號名稱` | | `--codename` | 指定 Debian 係作業系統的版本代號 | `代號名稱` |
@@ -217,13 +217,6 @@ hide:
> 軟體源完整格式 `<WEB協議>://<軟體源位址(網域名稱或IP)>/<軟體源倉庫(路徑)>` > 軟體源完整格式 `<WEB協議>://<軟體源位址(網域名稱或IP)>/<軟體源倉庫(路徑)>`
- #### 指定 `Docker CE` 軟體源位址
``` { .bash .no-copy }
bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --source mirror.example.com/docker-ce
```
> 注意該位址路徑需要包含映像站的 Docker CE 軟體源倉庫路徑即 `docker-ce`
- #### 指定鏡像倉庫位址 - #### 指定鏡像倉庫位址
``` { .bash .no-copy } ``` { .bash .no-copy }
@@ -285,6 +278,13 @@ hide:
[[ $(systemctl is-active docker) == "active" ]] && systemctl restart docker || systemctl enable --now docker [[ $(systemctl is-active docker) == "active" ]] && systemctl restart docker || systemctl enable --now docker
``` ```
- #### 指定 `Docker CE` 軟體源位址
``` { .bash .no-copy }
bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --source mirror.example.com/docker-ce
```
> 注意該位址路徑需要包含映像站的 Docker CE 軟體源倉庫路徑即 `docker-ce`
- #### 指定 Docker CE 軟體源倉庫 - #### 指定 Docker CE 軟體源倉庫
腳本預設會自動判斷一般無需指定,除非你有特殊需求 腳本預設會自動判斷一般無需指定,除非你有特殊需求
@@ -322,7 +322,7 @@ hide:
> `Red Hat Enterprise Linux` &nbsp; `CentOS` &nbsp; `Rocky Linux` &nbsp; `AlmaLinux` &nbsp; `Fedora` &nbsp; `openEuler` &nbsp; `OpenCloudOS` &nbsp; `Anolis OS` > `Red Hat Enterprise Linux` &nbsp; `CentOS` &nbsp; `Rocky Linux` &nbsp; `AlmaLinux` &nbsp; `Fedora` &nbsp; `openEuler` &nbsp; `OpenCloudOS` &nbsp; `Anolis OS`
未出現在該清單中的版本則不支援透過本腳本安裝,如果取得不到版本清單說明你目前的系統環境還沒有正確配置 Docker CE 軟體源(執行腳本時不存在該問題) 未出現在該清單中的版本則不支援透過本腳本安裝,如果取得不到版本清單說明你目前的系統環境還沒有正確配置 Docker CE 軟體軟體源(執行腳本時不存在該問題)
- #### 無人值守(自動化) - #### 無人值守(自動化)

View File

@@ -127,10 +127,6 @@
background-color: var(--navbar-background) !important; background-color: var(--navbar-background) !important;
} }
.tabbed-content .highlight {
padding-top: .4rem;
}
.md-banner { .md-banner {
color: var(--md-default-fg-color--light); color: var(--md-default-fg-color--light);
background-color: hsla(240, 9%, 75%, 0.53); background-color: hsla(240, 9%, 75%, 0.53);

View File

@@ -505,7 +505,7 @@ Below are some advanced usage examples
| <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank"><img src="/assets/images/icon/raspberry-pi.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Raspberry Pi OS** | `raspberrypi` `raspbian` `debian` `debian-archive` | | <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank"><img src="/assets/images/icon/raspberry-pi.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Raspberry Pi OS** | `raspberrypi` `raspbian` `debian` `debian-archive` |
| <a href="https://access.redhat.com/products/red-hat-enterprise-linux" title="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.1em"></a> **Red Hat Enterprise Linux** :material-information-outline:{ title="Version 9 uses <code>CentOS Stream</code>, 7/8 use <code>CentOS</code>" } | `centos` `centos-stream` `centos-altarch` `centos-vault` | | <a href="https://access.redhat.com/products/red-hat-enterprise-linux" title="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.1em"></a> **Red Hat Enterprise Linux** :material-information-outline:{ title="Version 9 uses <code>CentOS Stream</code>, 7/8 use <code>CentOS</code>" } | `centos` `centos-stream` `centos-altarch` `centos-vault` |
| <a href="https://fedoraproject.org" title="https://fedoraproject.org" target="_blank"><img src="/assets/images/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.15em"></a> **Fedora** | `fedora` `fedora-archive` | | <a href="https://fedoraproject.org" title="https://fedoraproject.org" target="_blank"><img src="/assets/images/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.15em"></a> **Fedora** | `fedora` `fedora-archive` |
| <a href="https://www.centos.org" title="https://www.centos.org" target="_blank"><img src="/assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.125em"></a> **CentOS** | `centos` `centos-stream` `centos-altarch` `centos-vault` | | <a href="https://www.centos.org" title="https://www.centos.org" target="_blank"><img src="/assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.135em"></a> **CentOS** | `centos` `centos-stream` `centos-altarch` `centos-vault` |
| <a href="https://rockylinux.org" title="https://rockylinux.org" target="_blank"><img src="/assets/images/icon/rocky-linux.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Rocky Linux** | `rocky` | | <a href="https://rockylinux.org" title="https://rockylinux.org" target="_blank"><img src="/assets/images/icon/rocky-linux.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Rocky Linux** | `rocky` |
| <a href="https://almalinux.org" title="https://almalinux.org" target="_blank"><img src="/assets/images/icon/almalinux.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **AlmaLinux** | `almalinux` `almalinux-vault` | | <a href="https://almalinux.org" title="https://almalinux.org" target="_blank"><img src="/assets/images/icon/almalinux.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **AlmaLinux** | `almalinux` `almalinux-vault` |
| <a href="https://www.oracle.com/linux" title="https://www.oracle.com/linux" target="_blank"><img src="/assets/images/icon/oracle-linux.png" width="16" height="16" style="vertical-align: -0.25em"></a> **Oracle Linux** | `centos-stream` | | <a href="https://www.oracle.com/linux" title="https://www.oracle.com/linux" target="_blank"><img src="/assets/images/icon/oracle-linux.png" width="16" height="16" style="vertical-align: -0.25em"></a> **Oracle Linux** | `centos-stream` |
@@ -593,21 +593,47 @@ Below are some advanced usage examples
Usually for switching system versions. Example: Usually for switching system versions. Example:
=== "Upgrade GNU/Linux Debian to 12 Bookworm" === "Upgrade GNU/Linux Debian to 13 "trixie""
``` bash - Change version code
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --codename bookworm
``` ``` bash
bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
--codename trixie \
--upgrade-software false
```
- Disable the backports repository
``` bash
sed -i '/backports/s/^/# /' /etc/apt/sources.list
```
- Upgrade the system
``` bash
apt-get update
apt-get dist-upgrade
```
- After the upgrade is complete and the system is rebooted, perform the following steps
``` bash
# Clear the original software sources (back up any non-system software sources)
sed -i '1,$d' /etc/apt/sources.list
# Rerun the mirror switching script
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
```
=== "Switch GNU/Linux Debian to testing branch" === "Switch GNU/Linux Debian to testing branch"
``` bash ``` bash
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --codename testing bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
--codename testing \
--upgrade-software false
``` ```
After switching, run `apt-get dist-upgrade` and reboot, then rerun the script. Only changing the codename may cause compatibility issues later. ``` { .bash .no-copy title="If the script can't set the codename, you can manually replace it after running" }
``` { .bash title="If the script can't set the codename, you can manually replace it after running" }
sed -i "s/$(lsb_release -cs)/your-codename/g" /etc/apt/sources.list sed -i "s/$(lsb_release -cs)/your-codename/g" /etc/apt/sources.list
``` ```

View File

@@ -537,7 +537,7 @@ $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --help
| <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank"><img src="/assets/images/icon/raspberry-pi.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Raspberry Pi OS** | `raspberrypi` `raspbian` `debian` `debian-archive` | | <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank"><img src="/assets/images/icon/raspberry-pi.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Raspberry Pi OS** | `raspberrypi` `raspbian` `debian` `debian-archive` |
| <a href="https://access.redhat.com/products/red-hat-enterprise-linux" title="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.1em"></a> **Red Hat Enterprise Linux** :material-information-outline:{ title="9版本使用 <code>CentOS Stream</code> 7、8版本使用<code>CentOS</code>" } | `centos` `centos-stream` `centos-altarch` `centos-vault` | | <a href="https://access.redhat.com/products/red-hat-enterprise-linux" title="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.1em"></a> **Red Hat Enterprise Linux** :material-information-outline:{ title="9版本使用 <code>CentOS Stream</code> 7、8版本使用<code>CentOS</code>" } | `centos` `centos-stream` `centos-altarch` `centos-vault` |
| <a href="https://fedoraproject.org" title="https://fedoraproject.org" target="_blank"><img src="/assets/images/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.15em"></a> **Fedora** | `fedora` `fedora-archive` | | <a href="https://fedoraproject.org" title="https://fedoraproject.org" target="_blank"><img src="/assets/images/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.15em"></a> **Fedora** | `fedora` `fedora-archive` |
| <a href="https://www.centos.org" title="https://www.centos.org" target="_blank"><img src="/assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.125em"></a> **CentOS** | `centos` `centos-stream` `centos-altarch` `centos-vault` | | <a href="https://www.centos.org" title="https://www.centos.org" target="_blank"><img src="/assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.135em"></a> **CentOS** | `centos` `centos-stream` `centos-altarch` `centos-vault` |
| <a href="https://rockylinux.org" title="https://rockylinux.org" target="_blank"><img src="/assets/images/icon/rocky-linux.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Rocky Linux** | `rocky` | | <a href="https://rockylinux.org" title="https://rockylinux.org" target="_blank"><img src="/assets/images/icon/rocky-linux.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Rocky Linux** | `rocky` |
| <a href="https://almalinux.org" title="https://almalinux.org" target="_blank"><img src="/assets/images/icon/almalinux.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **AlmaLinux** | `almalinux` `almalinux-vault` | | <a href="https://almalinux.org" title="https://almalinux.org" target="_blank"><img src="/assets/images/icon/almalinux.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **AlmaLinux** | `almalinux` `almalinux-vault` |
| <a href="https://www.oracle.com/linux" title="https://www.oracle.com/linux" target="_blank"><img src="/assets/images/icon/oracle-linux.png" width="16" height="16" style="vertical-align: -0.25em"></a> **Oracle Linux** | `centos-stream` | | <a href="https://www.oracle.com/linux" title="https://www.oracle.com/linux" target="_blank"><img src="/assets/images/icon/oracle-linux.png" width="16" height="16" style="vertical-align: -0.25em"></a> **Oracle Linux** | `centos-stream` |
@@ -576,7 +576,7 @@ $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --help
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --only-epel bash <(curl -sSL https://linuxmirrors.cn/main.sh) --only-epel
``` ```
对于已经 EOL 的 EPEL 7 注意需要使用 [`archive`](https://dl.fedoraproject.org/pub/archive/epel) 仓库,境外以及海外网络环境建议通过命令选项 `--use-official-source-epel true` 使用官方源 对于已经 EOL 的 EPEL 7注意需要使用 [`archive`](https://dl.fedoraproject.org/pub/archive/epel) 仓库,境外以及海外网络环境建议通过命令选项 `--use-official-source-epel true` 使用官方源
- ### 恢复使用官方源 - ### 恢复使用官方源
@@ -625,21 +625,47 @@ $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --help
大多数情况下自定义版本代号用于更换系统版本,请看下面的例子 大多数情况下自定义版本代号用于更换系统版本,请看下面的例子
=== "升级 GNU/Linux Debian 至 12 版本 Bookworm" === "升级 GNU/Linux Debian 至 13 "trixie""
``` bash - 更换版本代号
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --codename bookworm
``` ``` bash
bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
--codename trixie \
--upgrade-software false
```
- 禁用 backports 仓库
``` bash
sed -i '/backports/s/^/# /' /etc/apt/sources.list
```
- 升级系统
``` bash
apt-get update
apt-get dist-upgrade
```
- 在升级完成并重新引导系统后执行以下步骤
``` bash
# 清空原有软件源(如有非系统软件源内容请自行备份)
sed -i '1,$d' /etc/apt/sources.list
# 重新执行换源脚本
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
```
=== "将 GNU/Linux Debian 的版本切换到测试分支" === "将 GNU/Linux Debian 的版本切换到测试分支"
``` bash ``` bash
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --codename testing bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
--codename testing \
--upgrade-software false
``` ```
更换软件源后还需要执行系统更新命令 `apt-get dist-upgrade`,并且建议在更新完成并重启系统后重新执行本换源脚本,因为仅更换软件源配置中的系统版本代号可能会在后期使用时产生一些兼容性问题 ``` { .bash .no-copy title="若脚本无法实现指定版本代号,你也可以在执行脚本后手动替换" }
``` { .bash title="若脚本无法实现指定版本代号,你也可以在执行脚本后手动替换" }
sed -i "s/$(lsb_release -cs)/指定版本代号/g" /etc/apt/sources.list sed -i "s/$(lsb_release -cs)/指定版本代号/g" /etc/apt/sources.list
``` ```

View File

@@ -507,7 +507,7 @@ hide:
| <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank"><img src="/assets/images/icon/raspberry-pi.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Raspberry Pi OS** | `raspberrypi` `raspbian` `debian` `debian-archive` | | <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank"><img src="/assets/images/icon/raspberry-pi.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Raspberry Pi OS** | `raspberrypi` `raspbian` `debian` `debian-archive` |
| <a href="https://access.redhat.com/products/red-hat-enterprise-linux" title="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.1em"></a> **Red Hat Enterprise Linux** :material-information-outline:{ title="9版本使用 <code>CentOS Stream</code> 7、8版本使用<code>CentOS</code>" } | `centos` `centos-stream` `centos-altarch` `centos-vault` | | <a href="https://access.redhat.com/products/red-hat-enterprise-linux" title="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.1em"></a> **Red Hat Enterprise Linux** :material-information-outline:{ title="9版本使用 <code>CentOS Stream</code> 7、8版本使用<code>CentOS</code>" } | `centos` `centos-stream` `centos-altarch` `centos-vault` |
| <a href="https://fedoraproject.org" title="https://fedoraproject.org" target="_blank"><img src="/assets/images/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.15em"></a> **Fedora** | `fedora` `fedora-archive` | | <a href="https://fedoraproject.org" title="https://fedoraproject.org" target="_blank"><img src="/assets/images/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.15em"></a> **Fedora** | `fedora` `fedora-archive` |
| <a href="https://www.centos.org" title="https://www.centos.org" target="_blank"><img src="/assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.125em"></a> **CentOS** | `centos` `centos-stream` `centos-altarch` `centos-vault` | | <a href="https://www.centos.org" title="https://www.centos.org" target="_blank"><img src="/assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.135em"></a> **CentOS** | `centos` `centos-stream` `centos-altarch` `centos-vault` |
| <a href="https://rockylinux.org" title="https://rockylinux.org" target="_blank"><img src="/assets/images/icon/rocky-linux.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Rocky Linux** | `rocky` | | <a href="https://rockylinux.org" title="https://rockylinux.org" target="_blank"><img src="/assets/images/icon/rocky-linux.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Rocky Linux** | `rocky` |
| <a href="https://almalinux.org" title="https://almalinux.org" target="_blank"><img src="/assets/images/icon/almalinux.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **AlmaLinux** | `almalinux` `almalinux-vault` | | <a href="https://almalinux.org" title="https://almalinux.org" target="_blank"><img src="/assets/images/icon/almalinux.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **AlmaLinux** | `almalinux` `almalinux-vault` |
| <a href="https://www.oracle.com/linux" title="https://www.oracle.com/linux" target="_blank"><img src="/assets/images/icon/oracle-linux.png" width="16" height="16" style="vertical-align: -0.25em"></a> **Oracle Linux** | `centos-stream` | | <a href="https://www.oracle.com/linux" title="https://www.oracle.com/linux" target="_blank"><img src="/assets/images/icon/oracle-linux.png" width="16" height="16" style="vertical-align: -0.25em"></a> **Oracle Linux** | `centos-stream` |
@@ -540,22 +540,22 @@ hide:
!!! info "EPEL (Extra Packages for Enterprise Linux) 是由 Fedora 組織維護的一個附加軟體包倉庫,它主要適用於除 Fedora 作業系統以外的紅帽系 Linux 發行版,配置 EPEL 倉庫已成為廣大用戶的普遍需求,建議預設安裝它" !!! info "EPEL (Extra Packages for Enterprise Linux) 是由 Fedora 組織維護的一個附加軟體包倉庫,它主要適用於除 Fedora 作業系統以外的紅帽系 Linux 發行版,配置 EPEL 倉庫已成為廣大用戶的普遍需求,建議預設安裝它"
有些時候你會發現想使用的鏡像站沒有 EPEL 倉庫,那麼你可以在第一次運行腳本時不安裝或更換 EPEL 源,然後再單獨執行下面的命令 有些時候你會發現想使用的鏡像站沒有 EPEL 倉庫,那麼你可以在第一次運行腳本時不安裝或更換 EPEL 軟體源,然後再單獨執行下面的命令
``` bash ``` bash
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --only-epel bash <(curl -sSL https://linuxmirrors.cn/main.sh) --only-epel
``` ```
對於已經 EOL 的 EPEL 7 注意需要使用 [`archive`](https://dl.fedoraproject.org/pub/archive/epel) 倉庫,境外以及海外網絡環境建議通過命令選項 `--use-official-source-epel true` 使用官方源 對於已經 EOL 的 EPEL 7注意需要使用 [`archive`](https://dl.fedoraproject.org/pub/archive/epel) 倉庫,境外以及海外網絡環境建議通過命令選項 `--use-official-source-epel true` 使用官方源
- ### 恢復使用官方源 - ### 恢復使用官方源
當你不小心刪除了官方源的備份時可以使用此命令來恢復,使用此命令選項後將跳過選擇軟體源步驟 當你不小心刪除了官方軟體源的備份時可以使用此命令來恢復,使用此命令選項後將跳過選擇軟體源步驟
``` bash ``` bash
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --use-official-source true bash <(curl -sSL https://linuxmirrors.cn/main.sh) --use-official-source true
``` ```
> 部分系統不存在官方源例如 `Arch Linux`,屆時會自動更換成相容性較高的阿里雲鏡像站 > 部分系統不存在官方軟體源例如 `Arch Linux`,屆時會自動更換成相容性較高的阿里雲鏡像站
- ### 特定係統的使用範例 - ### 特定係統的使用範例
@@ -575,15 +575,15 @@ hide:
--- ---
建議使用 `騰訊雲` 或 `阿里雲` 鏡像站,或透過 `--use-official-source true` 命令選項使用官方 建議使用 `騰訊雲` 或 `阿里雲` 鏡像站,或透過 `--use-official-source true` 命令選項使用官方軟體
</div> </div>
另外 EPEL 7 也進入了 EOL腳本同樣對其進行了適配 另外 EPEL 7 也進入了 EOL腳本同樣對其進行了適配
- #### 指定 GNU/Linux Debian 作業系統的 Security - #### 指定 GNU/Linux Debian 作業系統的 Security 軟體
如果你想盡可能提高伺服器的安全性建議使用官方源,因為鏡像同步存在延遲 如果你想盡可能提高伺服器的安全性建議使用官方軟體源,因為鏡像同步存在延遲
``` bash ``` bash
bash <(curl -sSL https://linuxmirrors.cn/main.sh) \ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
@@ -595,22 +595,48 @@ hide:
大多數情況下自訂版本代號用於更換系統版本,請看下面的例子 大多數情況下自訂版本代號用於更換系統版本,請看下面的例子
=== "升級 GNU/Linux Debian 至 12 版本 Bookworm" === "升級 GNU/Linux Debian 至 13 "trixie""
``` bash - 更換版本代號
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --codename bookworm
``` ``` bash
bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
--codename trixie \
--upgrade-software false
```
- 停用 backports 倉庫
``` bash
sed -i '/backports/s/^/# /' /etc/apt/sources.list
```
- 升級系統
``` bash
apt-get update
apt-get dist-upgrade
```
- 升級完成並重新引導系統後執行下列步驟
``` bash
# 清空原有軟體源(如有非系統軟體源內容請自行備份)
sed -i '1,$d' /etc/apt/sources.list
# 重新執行換源腳本
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
```
=== "將 GNU/Linux Debian 的版本切換到測試分支" === "將 GNU/Linux Debian 的版本切換到測試分支"
``` bash ``` bash
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --codename testing bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
--codename testing \
--upgrade-software false
``` ```
更換軟體源後還需要執行系統更新命令 `apt-get dist-upgrade`,並且建議在更新完成並重新啟動系統後重新執行本換源腳本,因為僅更換軟體源配置中的系統版本代號可能會在後期使用時產生一些相容性問題 ``` { .bash .no-copy title="如果腳本無法實現指定版本代號,你也可以在執行腳本後手動替換" }
sed -i "s/$(lsb_release -cs)/指定版本代號/g" /etc/apt/sources.list
``` { .bash title="如果腳本無法實現指定版本代號,你也可以在執行腳本後手動替換" }
sed -i "s/$(lsb_release -cs)/指定版本代号/g" /etc/apt/sources.list
``` ```
- #### 更換 Ubuntu EOL版本軟體源 - #### 更換 Ubuntu EOL版本軟體源