更新文档

This commit is contained in:
Super Manito
2025-04-08 02:28:46 +08:00
parent e63dea7e64
commit 984cfa4eed
14 changed files with 287 additions and 249 deletions

View File

@@ -631,7 +631,16 @@ function run_end() {
echo '' echo ''
return return
fi fi
echo -e "\n✨ 脚本运行完毕,更多使用教程详见官网 👉 \033[3mhttps://linuxmirrors.cn\033[0m\n\n🔥 1Panel · Linux 面板|极简运维 ➜ https://1panel.cn \033[3;2m【广告】\033[0m\n🔥 林枫云 · 专注独立IP高频VPSR9/i9系列定制 ➜ https://www.dkdun.cn \033[3;2m【广告】\033[0m\n\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m\n" local sponsor_ad=(
"🔥 1Panel · Linux 面板|极简运维 ➜ https://1panel.cn \033[3;2m【广告】\033[0m"
"🔥 林枫云 · 专注独立IP高频VPSR9/i9系列定制 ➜ https://www.dkdun.cn \033[3;2m【广告】\033[0m"
"🔥 乔星欢 · 香港4核4G服务器28元起_香港500Mbps大带宽 ➜ https://www.qiaoxh.com \033[3;2m【广告】\033[0m"
)
echo -e "\n✨ 脚本运行完毕,更多使用教程详见官网 👉 \033[3mhttps://linuxmirrors.cn\033[0m\n"
for ad in "${sponsor_ad[@]}"; do
echo -e " ${ad}"
done
echo -e "\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m\n"
} }
## 报错退出 ## 报错退出

View File

@@ -340,7 +340,16 @@ function run_end() {
echo '' echo ''
return return
fi fi
echo -e "\n✨ 脚本运行完毕,更多使用教程详见官网 👉 \033[3mhttps://linuxmirrors.cn\033[0m\n\n🔥 1Panel · Linux 面板|极简运维 ➜ https://1panel.cn \033[3;2m【广告】\033[0m\n🔥 林枫云 · 专注独立IP高频VPSR9/i9系列定制 ➜ https://www.dkdun.cn \033[3;2m【广告】\033[0m\n\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m\n" local sponsor_ad=(
"🔥 1Panel · Linux 面板|极简运维 ➜ https://1panel.cn \033[3;2m【广告】\033[0m"
"🔥 林枫云 · 专注独立IP高频VPSR9/i9系列定制 ➜ https://www.dkdun.cn \033[3;2m【广告】\033[0m"
"🔥 乔星欢 · 香港4核4G服务器28元起_香港500Mbps大带宽 ➜ https://www.qiaoxh.com \033[3;2m【广告】\033[0m"
)
echo -e "\n✨ 脚本运行完毕,更多使用教程详见官网 👉 \033[3mhttps://linuxmirrors.cn\033[0m\n"
for ad in "${sponsor_ad[@]}"; do
echo -e " ${ad}"
done
echo -e "\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m\n"
} }
## 报错退出 ## 报错退出

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.0 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@@ -125,21 +125,4 @@ hide:
[开 始 使 用](use/index.md){ .md-button .md-button--primary }   [查看软件源列表](mirrors/index.md){ .md-button } [开 始 使 用](use/index.md){ .md-button .md-button--primary }   [查看软件源列表](mirrors/index.md){ .md-button }
<div class="md-nav__sponsor-bottom" style="border-top: none; margin-top: 0"> --8<-- "docs/sponsor/main.html"
<div class="sponsor-label">
<strong>赞助商</strong>
</div>
<div class="sponsor-wrapper sponsor-flex-wrapper">
<a class="sponsor-item sponsor-flex-item" target="_blank" href="https://1panel.cn" title="1Panel · 新一代的 Linux 服务器运维管理面板">
<img src="/assets/images/sponsor/1panel.png" alt="1Panel" style="width: 60%" />
</a>
<a class="sponsor-item sponsor-flex-item" target="_blank" href="https://www.dkdun.cn/aff/VAWGETUL" title="林枫云 · 专注独立IP高频VPSR9/i9系列定制">
<img src="/assets/images/sponsor/linfengyun-light.png#only-light" alt="林枫云" style="width: 60%" />
<img src="/assets/images/sponsor/linfengyun-dark.png#only-dark" alt="林枫云" style="width: 60%" />
</a>
<a class="sponsor-item sponsor-flex-item" target="_blank" href="https://arcadia.cool" title="Arcadia 一站式代码运维平台">
<img src="/assets/images/sponsor/arcadia-light.png#only-light" alt="Arcadia" style="width: 60%" />
<img src="/assets/images/sponsor/arcadia-dark.png#only-dark" alt="Arcadia" style="width: 60%" />
</a>
</div>
</div>

View File

@@ -4,6 +4,8 @@ hide:
- toc - toc
- feedback - feedback
- footer - footer
search:
exclude: true
--- ---
## 中国大陆 :flag-CN: ## 中国大陆 :flag-CN:

View File

@@ -6,29 +6,16 @@ hide:
- footer - footer
--- ---
<div class="md-nav__sponsor-bottom" style="border-top: none; margin-top: 0"> --8<-- "docs/sponsor/main.html"
<div class="sponsor-label">
<strong>赞助商</strong>
</div>
<div class="sponsor-wrapper sponsor-flex-wrapper">
<a class="sponsor-item sponsor-flex-item" target="_blank" href="https://1panel.cn" title="1Panel · 新一代的 Linux 服务器运维管理面板">
<img src="/assets/images/sponsor/1panel.png" alt="1Panel" style="width: 60%" />
</a>
<a class="sponsor-item sponsor-flex-item" target="_blank" href="https://www.dkdun.cn/aff/VAWGETUL" title="林枫云 · 专注独立IP高频VPSR9/i9系列定制">
<img src="/assets/images/sponsor/linfengyun-light.png#only-light" alt="林枫云" style="width: 60%" />
<img src="/assets/images/sponsor/linfengyun-dark.png#only-dark" alt="林枫云" style="width: 60%" />
</a>
<a class="sponsor-item sponsor-flex-item" target="_blank" href="https://arcadia.cool" title="Arcadia 一站式代码运维平台">
<img src="/assets/images/sponsor/arcadia-light.png#only-light" alt="Arcadia" style="width: 60%" />
<img src="/assets/images/sponsor/arcadia-dark.png#only-dark" alt="Arcadia" style="width: 60%" />
</a>
</div>
</div>
# 成为赞助商 #
<button class="md-button md-button--primary" style="padding: 6px 20px 0 20px" title="https://afdian.com/a/SuperManito" onclick="window.open('https://afdian.com/a/SuperManito')"> <figure style="margin: 0 auto" markdown>
![](../assets/images/sponsor/ifdian.png){ width="120" } <figcaption><h3 style="font-style: normal !important"><strong>成为赞助商</strong></h3></figcaption>
</button> <figcaption>
<button class="md-button md-button--primary" style="padding: 4px 8px 0 8px; border-radius: 5px" title="https://afdian.com/a/SuperManito" onclick="window.open('https://afdian.com/a/SuperManito')">
> 点击按钮前往查看爱发电主页上的说明并与作者取得联系 <img src="/assets/images/sponsor/ifdian.png" alt="1Panel" style="width: 120px" />
</button>
</figcaption>
<figcaption><p style="color: var(--md-default-fg-color--light)">请前往作者爱发电主页查看说明并与作者取得联系</p></figcaption>
</figure>

22
docs/sponsor/main.html Normal file
View File

@@ -0,0 +1,22 @@
<div class="sponsor" style="border-top: none; margin-top: 0">
<div class="sponsor-label">
<strong>赞助商</strong>
</div>
<div class="sponsor-wrapper sponsor-flex-wrapper">
<a class="sponsor-item sponsor-flex-item" target="_blank" href="https://1panel.cn" title="新一代的 Linux 服务器运维管理面板">
<img src="/assets/images/sponsor/1panel.png" alt="1Panel" style="width: 60%" />
</a>
<a class="sponsor-item sponsor-flex-item" target="_blank" href="https://www.dkdun.cn/aff/VAWGETUL" title="林枫云 · 专注独立IP高频VPSR9/i9系列定制">
<img src="/assets/images/sponsor/linfengyun-light.png#only-light" alt="林枫云" style="width: 60%" />
<img src="/assets/images/sponsor/linfengyun-dark.png#only-dark" alt="林枫云" style="width: 60%" />
</a>
<a class="sponsor-item sponsor-flex-item" target="_blank" href="https://www.qiaoxh.com/?from=linuxmirrors.cn" title="乔星欢 · 香港4核4G服务器28元起_香港500Mbps大带宽">
<img src="/assets/images/sponsor/qiaoxh-light.svg#only-light" alt="乔星欢" style="width: 60%; margin-bottom: 6px" />
<img src="/assets/images/sponsor/qiaoxh-dark.svg#only-dark" alt="乔星欢" style="width: 60%; margin-bottom: 6px" />
</a>
<a class="sponsor-item sponsor-flex-item" target="_blank" href="https://arcadia.cool" title="一站式代码运维平台">
<img src="/assets/images/sponsor/arcadia-light.png#only-light" alt="Arcadia" style="width: 60%" />
<img src="/assets/images/sponsor/arcadia-dark.png#only-dark" alt="Arcadia" style="width: 60%" />
</a>
</div>
</div>

View File

@@ -6,6 +6,21 @@
--md-default-bg-color--dark: hsla(var(--md-hue), 15%, 14%, 1); --md-default-bg-color--dark: hsla(var(--md-hue), 15%, 14%, 1);
} }
[data-md-color-primary=white] {
--md-typeset-a-color: #2080f0;
}
[data-md-color-scheme='slate'][data-md-color-primary=black] {
--md-typeset-a-color: #2080f0;
}
.md-typeset .admonition.tip, .md-typeset details.tip {
border-color: #009400;
}
.md-typeset .tip>.admonition-title, .md-typeset .tip>summary {
background-color: #0094001a;
}
.md-header { .md-header {
background-color: hsla(240, 9%, 75%, 0.33); background-color: hsla(240, 9%, 75%, 0.33);
-webkit-backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
@@ -85,25 +100,25 @@
vertical-align: -0.35em !important; vertical-align: -0.35em !important;
} }
.md-nav__sponsor-bottom { .sponsor {
margin-top: 2rem; margin-top: 2rem;
padding-top: 1rem; padding-top: 1rem;
border-top: 1px solid var(--md-default-fg-color--lightest); border-top: 1px solid var(--md-default-fg-color--lightest);
} }
.md-nav__sponsor-bottom .sponsor-label { .sponsor .sponsor-label {
font-size: 0.8rem; font-size: 0.8rem;
text-align: center; text-align: center;
margin-bottom: 0.2rem; margin-bottom: 0.2rem;
color: var(--md-default-fg-color); color: var(--md-default-fg-color);
} }
.md-nav__sponsor-bottom .sponsor-wrapper { .sponsor .sponsor-wrapper {
width: 100%; width: 100%;
padding: 0.5rem 0; padding: 0.5rem 0;
} }
.md-nav__sponsor-bottom .sponsor-item { .sponsor .sponsor-item {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@@ -116,11 +131,11 @@
max-height: 80px; max-height: 80px;
} }
.md-nav__sponsor-bottom .sponsor-item:hover { .sponsor .sponsor-item:hover {
background-color: var(--md-code-bg-color); background-color: var(--md-code-bg-color);
} }
.md-nav__sponsor-bottom .sponsor-item img { .sponsor .sponsor-item img {
max-width: 100%; max-width: 100%;
height: auto; height: auto;
vertical-align: middle; vertical-align: middle;
@@ -139,14 +154,23 @@
max-width: 300px; max-width: 300px;
} }
@media screen and (max-width: 960px) { @media screen and (max-width: 768px) {
.sponsor-flex-item { .sponsor-flex-item {
flex: 0 1 calc(50% - 1rem); flex: 0 1 calc(50% - 1rem);
min-width: 150px;
max-width: calc(50% - 1rem);
}
}
@media screen and (max-width: 480px) {
.sponsor .sponsor-item {
padding: 0;
height: 40px;
} }
} }
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
.md-nav__sponsor-bottom { .sponsor-toc {
display: none; display: none;
} }
} }

View File

@@ -23,8 +23,9 @@
if (typeof document.startViewTransition !== 'function') { if (typeof document.startViewTransition !== 'function') {
return // 不支持 View Transitions API 的浏览器直接返回 return // 不支持 View Transitions API 的浏览器直接返回
} }
// 获取所有主题切换按钮 // 获取所有主题切换按钮 - 更精确的选择器
const themeToggles = document.querySelectorAll('.md-header__button.md-icon') // 只选择form[data-md-component="palette"]内部的按钮,而不是所有md-header__button
const themeToggles = document.querySelectorAll('form[data-md-component="palette"] .md-header__button.md-icon')
themeToggles.forEach((toggle) => { themeToggles.forEach((toggle) => {
toggle.addEventListener( toggle.addEventListener(
'click', 'click',
@@ -36,28 +37,12 @@
const targetId = this.getAttribute('for') const targetId = this.getAttribute('for')
const targetInput = document.getElementById(targetId) const targetInput = document.getElementById(targetId)
if (!targetInput) return if (!targetInput) return
// 获取当前存储的主题信息和即将切换到的主题信息 // 获取当前主题状态
const currentPalette = __md_get('__palette') const currentScheme = document.body.getAttribute('data-md-color-scheme')
const currentScheme = currentPalette?.color?.scheme || '' const isCurrentDark = currentScheme.includes('slate')
const currentMedia = currentPalette?.color?.media || '' // 点击后会切换到相反的主题
// 获取新主题信息 const isNewDark = !isCurrentDark
const newScheme = targetInput.getAttribute('data-md-color-scheme') // 当前主题和目标主题相同则不触发动画
const newMedia = targetInput.getAttribute('data-md-color-media')
// 判断当前浏览器/系统主题
const isSystemDark = window.matchMedia('(prefers-color-scheme: dark)').matches
// 判断是否切换到暗色主题
const isDark = newScheme != 'default'
// 确定当前主题的实际暗色状态
let isCurrentDark = currentScheme.includes('slate')
if (currentMedia === '(prefers-color-scheme)') {
isCurrentDark = isSystemDark
}
// 确定新主题的实际暗色状态
let isNewDark = newScheme.includes('slate')
if (newMedia === '(prefers-color-scheme)') {
isNewDark = isSystemDark
}
// 如果当前主题和目标主题相同,则不需要动画
if (isCurrentDark === isNewDark) { if (isCurrentDark === isNewDark) {
targetInput.click() targetInput.click()
return return
@@ -74,8 +59,8 @@
// 切换主题 // 切换主题
targetInput.click() targetInput.click()
// 添加暗/亮模式类,用于动画控制 // 添加暗/亮模式类,用于动画控制
document.documentElement.classList.remove(isDark ? 'light' : 'dark') document.documentElement.classList.remove(isNewDark ? 'light' : 'dark')
document.documentElement.classList.add(isDark ? 'dark' : 'light') document.documentElement.classList.add(isNewDark ? 'dark' : 'light')
// 等待主题变化完成 // 等待主题变化完成
await new Promise((resolve) => setTimeout(resolve, 100)) await new Promise((resolve) => setTimeout(resolve, 100))
}) })
@@ -83,12 +68,12 @@
// 视图过渡准备就绪,开始动画 // 视图过渡准备就绪,开始动画
document.documentElement.animate( document.documentElement.animate(
{ {
clipPath: isDark ? [...clipPath].reverse() : clipPath, clipPath: isNewDark ? [...clipPath].reverse() : clipPath,
}, },
{ {
duration: 500, duration: 500,
easing: 'ease-in', easing: 'ease-in',
pseudoElement: isDark ? '::view-transition-old(root)' : '::view-transition-new(root)', pseudoElement: isNewDark ? '::view-transition-old(root)' : '::view-transition-new(root)',
} }
) )
}) })
@@ -97,8 +82,7 @@
) )
}) })
// 初始化主题状态类 // 初始化主题状态类
const currentPalette = __md_get('__palette') const currentScheme = document.body.getAttribute('data-md-color-scheme')
const currentScheme = currentPalette?.color?.scheme || ''
const isDark = currentScheme.includes('slate') const isDark = currentScheme.includes('slate')
document.documentElement.classList.add(isDark ? 'dark' : 'light') document.documentElement.classList.add(isDark ? 'dark' : 'light')
}) })

View File

@@ -9,19 +9,23 @@
</ul> </ul>
<div class="md-content" data-md-component="content"> <div class="md-content" data-md-component="content">
<div class="md-nav__sponsor-bottom"> <div class="sponsor sponsor-toc">
<div class="sponsor-label"> <div class="sponsor-label">
<strong>赞助商</strong> <strong>赞助商</strong>
</div> </div>
<div class="sponsor-wrapper"> <div class="sponsor-wrapper">
<a class="sponsor-item" target="_blank" href="https://1panel.cn" title="1Panel · 新一代的 Linux 服务器运维管理面板"> <a class="sponsor-item" target="_blank" href="https://1panel.cn" title="新一代的 Linux 服务器运维管理面板">
<img src="/assets/images/sponsor/1panel.png" alt="1Panel" style="width: 60%" /> <img src="/assets/images/sponsor/1panel.png" alt="1Panel" style="width: 60%" />
</a> </a>
<a class="sponsor-item" target="_blank" href="https://www.dkdun.cn/aff/VAWGETUL" title="林枫云 · 专注独立IP高频VPSR9/i9系列定制"> <a class="sponsor-item" target="_blank" href="https://www.dkdun.cn/aff/VAWGETUL" title="林枫云 · 专注独立IP高频VPSR9/i9系列定制">
<img src="/assets/images/sponsor/linfengyun-light.png#only-light" alt="林枫云" style="width: 60%" /> <img src="/assets/images/sponsor/linfengyun-light.png#only-light" alt="林枫云" style="width: 60%" />
<img src="/assets/images/sponsor/linfengyun-dark.png#only-dark" alt="林枫云" style="width: 60%" /> <img src="/assets/images/sponsor/linfengyun-dark.png#only-dark" alt="林枫云" style="width: 60%" />
</a> </a>
<a class="sponsor-item" target="_blank" href="https://arcadia.cool" title="Arcadia 一站式代码运维平台"> <a class="sponsor-item" target="_blank" href="https://www.qiaoxh.com/?from=linuxmirrors.cn" title="乔星欢 · 香港4核4G服务器28元起_香港500Mbps大带宽">
<img src="/assets/images/sponsor/qiaoxh-light.svg#only-light" alt="乔星欢" style="width: 66%; margin-bottom: 6px" />
<img src="/assets/images/sponsor/qiaoxh-dark.svg#only-dark" alt="乔星欢" style="width: 66%; margin-bottom: 6px" />
</a>
<a class="sponsor-item" target="_blank" href="https://arcadia.cool" title="一站式代码运维平台">
<img src="/assets/images/sponsor/arcadia-light.png#only-light" alt="Arcadia" style="width: 60%" /> <img src="/assets/images/sponsor/arcadia-light.png#only-light" alt="Arcadia" style="width: 60%" />
<img src="/assets/images/sponsor/arcadia-dark.png#only-dark" alt="Arcadia" style="width: 60%" /> <img src="/assets/images/sponsor/arcadia-dark.png#only-dark" alt="Arcadia" style="width: 60%" />
</a> </a>

View File

@@ -110,7 +110,9 @@ hide:
选项卡分别代表脚本内置软件源类型和获取脚本途径,请在使用前检查目标镜像站是否支持您所使用的操作系统,可以在[软件源列表](../mirrors/index.md)中查看具体有哪些软件源。 选项卡分别代表脚本内置软件源类型和获取脚本途径,请在使用前检查目标镜像站是否支持您所使用的操作系统,可以在[软件源列表](../mirrors/index.md)中查看具体有哪些软件源。
!!! tip "默认自动备份原有软件源内容,如需了解更多请翻阅下方文档" !!! tip "默认自动备份原有软件源内容,如需了解更多请翻阅下方文档。若使用过程中的某些选项令你疑惑不解,那么在选择软件源后一路回车即是最佳实践。"
</br>
<div class="grid cards" markdown> <div class="grid cards" markdown>
@@ -140,246 +142,245 @@ hide:
</div> </div>
- ### 常见问题 ### 常见问题
- #### 关于报错 Command not found - #### 关于报错 Command not found
!!! quote "" !!! quote ""
此报错是因为系统没有安装 `curl` 软件包,下面是安装命令 此报错是因为系统没有安装 `curl` 软件包,下面是安装命令
=== "Debian 系 / openKylin" === "Debian 系 / openKylin"
``` bash
apt-get install -y curl
```
> `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Linux Mint` &nbsp; `Deepin` &nbsp; `Zorin OS` &nbsp; `Armbian` &nbsp; `Proxmox VE` &nbsp; `Raspberry Pi OS` &nbsp; `openKylin`
新装系统需要先执行一遍更新 `apt-get update`
=== "RedHat 系 / openEuler / OpenCloudOS / Anolis OS"
``` bash
dnf install -y curl || yum install -y curl
```
> `Red Hat Enterprise Linux` &nbsp; `CentOS` &nbsp; `Rocky Linux` &nbsp; `AlmaLinux` &nbsp; `Fedora` &nbsp; `openEuler` &nbsp; `OpenCloudOS` &nbsp; `Anolis OS`
=== "openSUSE"
``` bash
zypper install curl
```
=== "Arch Linux"
``` bash
pacman -S curl
```
=== "Alpine Linux"
``` bash
apk --no-cache add -f curl bash ncurses
```
=== "Gentoo"
``` bash
emerge --ask curl
```
=== "NixOS"
``` bash
nix-env -iA nixos.curl
```
??? tip "安装不上?(点击展开查看其它解决方法)"
假如系统原有软件源是无效的导致安装不上 `curl` 软件包,那么对于 Linux 初学者来说可能会比较麻烦,这里提供几个在线获取脚本的应急方法
=== "使用 Python 下载脚本"
适用于大部分操作系统(`Alpine Linux` 除外),`python3` 要是不存在那就再试试 `python` 指令
``` bash ``` bash
apt-get install -y curl python3 -c "import urllib.request; urllib.request.urlretrieve('https://linuxmirrors.cn/main.sh', 'main.sh')"
``` ```
> `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Linux Mint` &nbsp; `Deepin` &nbsp; `Zorin OS` &nbsp; `Armbian` &nbsp; `Proxmox VE` &nbsp; `Raspberry Pi OS` &nbsp; `openKylin` === "使用 wget 下载脚本"
新装系统需要先执行一遍更新 `apt-get update`
=== "RedHat 系 / openEuler / OpenCloudOS / Anolis OS"
一般没有预装 `curl` 软件包的系统也不会预装 `wget` 软件包,所以大概率这个方法应该是不行的
``` bash ``` bash
dnf install -y curl || yum install -y curl wget https://linuxmirrors.cn/main.sh
``` ```
> `Red Hat Enterprise Linux` &nbsp; `CentOS` &nbsp; `Rocky Linux` &nbsp; `AlmaLinux` &nbsp; `Fedora` &nbsp; `openEuler` &nbsp; `OpenCloudOS` &nbsp; `Anolis OS` === "使用浏览器下载"
=== "openSUSE" 如果可以访问系统 GUI 图像界面和桌面的话那可以直接在浏览器中打开链接下载脚本,很多系统都会预装 Firefox 火狐浏览器
之后再执行脚本即可
=== ":material-home-city: 中国大陆"
``` bash ``` bash
zypper install curl bash main.sh
``` ```
=== "Arch Linux" === ":material-earth: 境外以及海外地区"
``` bash ``` bash
pacman -S curl bash main.sh --abroad
``` ```
=== "Alpine Linux" === ":material-library: 中国大陆教育网"
``` bash ``` bash
apk --no-cache add -f curl bash ncurses bash main.sh --edu
``` ```
=== "Gentoo" 如果以上方法试了都不行,那就复制[源码](https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh)至本地新建任意名称的 `.sh` 脚本,粘贴源码内容后通过 `bash` 指令手动执行。
``` bash - #### 备份原有软件源
emerge --ask curl
```
=== "NixOS" !!! quote ""
``` bash 脚本会自动备份原有软件源内容,备份路径为原有文件或目录的绝对路径加上 `.bak` 后缀,例如 `/etc/apt/sources.list => /etc/apt/sources.list.bak`,当检查到已存在备份内容时会询问是否覆盖备份。
nix-env -iA nixos.curl
```
??? tip "安装不上?(点击展开查看其它解决方法)" - #### 还原已备份的软件源
假如系统原有软件源是无效的导致安装不上 `curl` 软件包,那么对于 Linux 初学者来说可能会比较麻烦,这里提供几个在线获取脚本的应急方法 !!! quote ""
=== "使用 Python 下载脚本" === "Debian 系 / openKylin"
适用于大部分操作系统(`Alpine Linux` 除外),`python3` 要是不存在那就再试试 `python` 指令 ``` bash
``` bash cp -rf /etc/apt/sources.list.bak /etc/apt/sources.list
python3 -c "import urllib.request; urllib.request.urlretrieve('https://linuxmirrors.cn/main.sh', 'main.sh')" apt-get update
``` ```
=== "使用 wget 下载脚本" > `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Linux Mint` &nbsp; `Deepin` &nbsp; `Zorin OS` &nbsp; `Armbian` &nbsp; `Proxmox VE` &nbsp; `Raspberry Pi OS` &nbsp; `openKylin`
一般没有预装 `curl` 软件包的系统也不会预装 `wget` 软件包,所以大概率这个方法应该是不行的 === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS"
``` bash
wget https://linuxmirrors.cn/main.sh
```
=== "使用浏览器下载" ``` bash
cp -rf /etc/yum.repos.d.bak /etc/yum.repos.d
yum makecache
```
如果可以访问系统 GUI 图像界面和桌面的话那可以直接在浏览器中打开链接下载脚本,很多系统都会预装 Firefox 火狐浏览器 > `Red Hat Enterprise Linux` &nbsp; `CentOS` &nbsp; `Rocky Linux` &nbsp; `AlmaLinux` &nbsp; `Fedora` &nbsp; `openEuler` &nbsp; `OpenCloudOS` &nbsp; `Anolis OS`
之后再执行脚本即可 === "openSUSE"
=== ":material-home-city: 中国大陆" ``` bash
cp -rf /etc/zypp/repos.d.bak /etc/zypp/repos.d
zypper ref
```
``` bash === "Arch Linux"
bash main.sh
```
=== ":material-earth: 境外以及海外地区" ``` bash
cp -rf /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist
pacman -Sy
```
``` bash === "Alpine Linux"
bash main.sh --abroad
```
=== ":material-library: 中国大陆教育网" ``` bash
cp -rf /etc/apk/repositories.bak /etc/apk/repositories
apk update -f
```
``` bash === "Gentoo"
bash main.sh --edu
```
如果以上方法试了都不行,那就复制[源码](https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh)至本地新建任意名称的 `.sh` 脚本,粘贴源码内容后通过 `bash` 指令手动执行。 ``` bash
cp -rf /etc/portage/make.conf.bak /etc/portage/make.conf
[ -d /etc/portage/repos.conf ] && cp -rf /etc/portage/repos.conf/gentoo.conf.bak /etc/portage/repos.conf/gentoo.conf
emerge --sync --quiet
```
- #### 备份原有软件源 === "NixOS"
!!! quote "" ``` bash
cp -rf /etc/nix/nix.conf.bak /etc/nix/nix.conf
```
脚本会自动备份原有软件源内容,备份路径为原有文件或目录的绝对路径加上 `.bak` 后缀,例如 `/etc/apt/sources.list => /etc/apt/sources.list.bak`,当检查到已存在备份内容时会询问是否覆盖备份。 - #### 关于开启 SSH 远程登录的方法
- #### 还原已备份的软件源 !!! quote ""
!!! quote "" - 验证是否已安装 `SSH` 服务
=== "Debian 系 / openKylin" ``` bash
ls /etc | grep ssh
```
> 如果没有这个文件夹说明系统未安装 `SSH` 服务,你需要通过包管理工具安装 `openssh` 软件包
``` bash - 设置允许 Root 用户登录
cp -rf /etc/apt/sources.list.bak /etc/apt/sources.list
apt-get update
```
> `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Linux Mint` &nbsp; `Deepin` &nbsp; `Zorin OS` &nbsp; `Armbian` &nbsp; `Proxmox VE` &nbsp; `Raspberry Pi OS` &nbsp; `openKylin` ``` bash
cat /etc/ssh/sshd_config | grep -Eq "^[# ]?PermitRootLogin " ; [ $? -eq 0 ] && sed -i 's/^[# ]\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || echo -e "\nPermitRootLogin yes" >> /etc/ssh/sshd_config
```
=== "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" - 设置密码认证
``` bash ``` bash
cp -rf /etc/yum.repos.d.bak /etc/yum.repos.d cat /etc/ssh/sshd_config | grep -Eq "^[# ]?PasswordAuthentication " ; [ $? -eq 0 ] && sed -i 's/^[# ]\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || echo -e "\nPasswordAuthentication yes" >> /etc/ssh/sshd_config
yum makecache ```
```
> `Red Hat Enterprise Linux` &nbsp; `CentOS` &nbsp; `Rocky Linux` &nbsp; `AlmaLinux` &nbsp; `Fedora` &nbsp; `openEuler` &nbsp; `OpenCloudOS` &nbsp; `Anolis OS` - 启动/重启 `SSH` 服务
=== "openSUSE" ``` bash
ps -ef | grep -q ssh ; [ $? -eq 0 ] && systemctl restart sshd || systemctl enable --now sshd
```
``` bash > 命令以及配置步骤仅供参考,只适配了部分常见发行版
cp -rf /etc/zypp/repos.d.bak /etc/zypp/repos.d
zypper ref
```
=== "Arch Linux" - #### 关于未显示方向键交互控制界面
``` bash !!! quote ""
cp -rf /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist
pacman -Sy
```
=== "Alpine Linux" 如果发现交互界面是输入而不是新式的方向键控制,那么请自行安装 `ncurses` 或 `nano` 软件包,新式的按键交互依赖 `tput` 指令实现。
``` bash - #### 关于调用脚本的互联网位置
cp -rf /etc/apk/repositories.bak /etc/apk/repositories
apk update -f
```
=== "Gentoo" !!! quote ""
``` bash 项目利用 [GitHub Action](https://github.com/SuperManito/LinuxMirrors/blob/main/.github/workflows/build-docs.yml#L29) 在每次提交后自动拷贝源码到文档目录作为网站资源发布,网站托管于 :netlify: [Netlify](https://www.netlify.com),几乎没有被劫持的风险请放心使用。
cp -rf /etc/portage/make.conf.bak /etc/portage/make.conf
[ -d /etc/portage/repos.conf ] && cp -rf /etc/portage/repos.conf/gentoo.conf.bak /etc/portage/repos.conf/gentoo.conf
emerge --sync --quiet
```
=== "NixOS" 当然你也可以使用代码托管仓库的原始地址来调用,这里只是想告诉你为什么会有几个不同的地址,默认的官网地址更易于记忆和访问。
``` bash - #### 关于软件源下载速度相关问题
cp -rf /etc/nix/nix.conf.bak /etc/nix/nix.conf
```
- #### 关于开启 SSH 远程登录的方法 !!! quote ""
!!! quote "" 首先,在[软件源列表](../mirrors/index.md)的使用帮助处有写使用推荐,这是根据以往经验总结出来的,但总有用户在纠结软件源速度的问题。
- 验证是否已安装 `SSH` 服务 软件源(镜像站)的网络延迟即 `Ping` 与下载速度没有太大的关联,双方地理位置间隔的远近不代表实际体验,有些镜像站下行带宽很高但实际测速却并不理想,因为这与镜像站的并发性能和负载策略有关。
``` bash 网上也有很多基于 C、Python 编写的镜像站测速开源脚本,而本项目脚本基于 Bash Shell 编写且不依赖任何第三方库Bash 是 Linux 运维中最常用的脚本语言并且绝大部分发行版都会预装,这意味着用户不需要安装任何环境就能直接运行,这种便利性是其它高级语言无法替代的,不过目前来看 Bash 脚本可能无法实现精准测速的功能,使用其它高级语言编写测速功能无疑是造轮子的行为。
ls /etc | grep ssh
```
> 如果没有这个文件夹说明系统未安装 `SSH` 服务,你需要通过包管理工具安装 `openssh` 软件包
- 设置允许 Root 用户登录 - #### 关于未启用的软件源仓库
``` bash !!! quote ""
cat /etc/ssh/sshd_config | grep -Eq "^[# ]?PermitRootLogin " ; [ $? -eq 0 ] && sed -i 's/^[# ]\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || echo -e "\nPermitRootLogin yes" >> /etc/ssh/sshd_config
```
- 设置密码认证 很多系统的软件源会启用多个仓库,脚本遵循系统默认设置,默认不启用的软件源(仓库)不会在运行完本脚本后被启用,但是它们也随脚本更换了目标软件源地址,具体启用方法如下:
``` bash === "Debian 系 / openKylin"
cat /etc/ssh/sshd_config | grep -Eq "^[# ]?PasswordAuthentication " ; [ $? -eq 0 ] && sed -i 's/^[# ]\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || echo -e "\nPasswordAuthentication yes" >> /etc/ssh/sshd_config
```
- 启动/重启 `SSH` 服务 默认禁用了`deb-src`源码仓库和`proposed`预发布软件源,若需启用请将 `/etc/apt/sources.list` 文件中相关内容的所在行取消注释
``` bash > `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Linux Mint` &nbsp; `Deepin` &nbsp; `Zorin OS` &nbsp; `Armbian` &nbsp; `Proxmox VE` &nbsp; `Raspberry Pi OS` &nbsp; `openKylin`
ps -ef | grep -q ssh ; [ $? -eq 0 ] && systemctl restart sshd || systemctl enable --now sshd
```
> 命令以及配置步骤仅供参考,只适配了部分常见发行版 === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS"
- #### 关于调用脚本的互联网位置 部分仓库默认没有启用,若需启用请将 `/etc/yum.repos.d` 目录下相关 repo 文件中的 `enabled` 值修改为 `1`
!!! quote "" > `Red Hat Enterprise Linux` &nbsp; `CentOS` &nbsp; `Rocky Linux` &nbsp; `AlmaLinux` &nbsp; `Fedora` &nbsp; `openEuler` &nbsp; `OpenCloudOS` &nbsp; `Anolis OS`
项目利用 [GitHub Action](https://github.com/SuperManito/LinuxMirrors/blob/main/.github/workflows/build-docs.yml#L29) 在每次提交后自动拷贝源码到文档目录作为网站资源发布,网站托管于 :netlify: [Netlify](https://www.netlify.com),几乎没有被劫持的风险请放心使用。 === "openSUSE"
当然你也可以使用代码托管仓库的原始地址来调用,这里只是想告诉你为什么会有几个不同的地址,默认的官网地址更易于记忆和访问。 部分仓库默认没有启用,若需启用请将 `/etc/zypp/repos.d` 目录下相关 repo 文件中的 `enabled` 值修改为 `1`
- #### 关于软件源下载速度相关问题
!!! quote ""
首先,在[软件源列表](../mirrors/index.md)的使用帮助处有写使用推荐,这是根据以往经验总结出来的,但总有用户在纠结软件源速度的问题。
软件源(镜像站)的网络延迟即 `Ping` 与下载速度没有太大的关联,双方地理位置间隔的远近不代表实际体验,有些镜像站下行带宽很高但实际测速却并不理想,因为这与镜像站的并发性能和负载策略有关。
网上也有很多基于 C、Python 编写的镜像站测速开源脚本,而本项目脚本基于 Bash Shell 编写且不依赖任何第三方库Bash 是 Linux 运维中最常用的脚本语言并且绝大部分发行版都会预装,这意味着用户不需要安装任何环境就能直接运行,这种便利性是其它高级语言无法替代的,不过目前来看 Bash 脚本可能无法实现精准测速的功能,使用其它高级语言编写测速功能无疑是造轮子的行为。
- #### 关于未启用的软件源仓库
!!! quote ""
很多系统的软件源会启用多个仓库,脚本遵循系统默认设置,默认不启用的软件源(仓库)不会在运行完本脚本后被启用,但是它们也随脚本更换了目标软件源地址,具体启用方法如下:
=== "Debian 系 / openKylin"
默认禁用了`deb-src`源码仓库和`proposed`预发布软件源,若需启用请将 `/etc/apt/sources.list` 文件中相关内容的所在行取消注释
> `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Linux Mint` &nbsp; `Deepin` &nbsp; `Zorin OS` &nbsp; `Armbian` &nbsp; `Proxmox VE` &nbsp; `Raspberry Pi OS` &nbsp; `openKylin`
=== "RedHat 系 / openEuler / OpenCloudOS / Anolis OS"
部分仓库默认没有启用,若需启用请将 `/etc/yum.repos.d` 目录下相关 repo 文件中的 `enabled` 值修改为 `1`
> `Red Hat Enterprise Linux` &nbsp; `CentOS` &nbsp; `Rocky Linux` &nbsp; `AlmaLinux` &nbsp; `Fedora` &nbsp; `openEuler` &nbsp; `OpenCloudOS` &nbsp; `Anolis OS`
=== "openSUSE"
部分仓库默认没有启用,若需启用请将 `/etc/zypp/repos.d` 目录下相关 repo 文件中的 `enabled` 值修改为 `1`
- #### 其它
!!! quote ""
- 如果提示 `bash: /proc/self/fd/11: No such file or directory`,请切换至 `Root` 用户执行,切换命令为 `sudo -i` 或 `su root`
- 如果交互打印界面发现是输入而不是新式的方向键交互,那么请自行安装 `ncurses` 或 `nano` 软件包,新式的方向键交互依赖 `tput` 指令实现。
--- ---

View File

@@ -48,12 +48,14 @@ theme:
- media: "(prefers-color-scheme: light)" - media: "(prefers-color-scheme: light)"
scheme: default scheme: default
primary: white primary: white
accent: blue
toggle: toggle:
icon: octicons/sun-16 icon: octicons/sun-16
name: 亮色模式 name: 亮色模式
- media: "(prefers-color-scheme: dark)" - media: "(prefers-color-scheme: dark)"
scheme: slate scheme: slate
primary: black primary: black
accent: blue
toggle: toggle:
icon: octicons/moon-16 icon: octicons/moon-16
name: 暗黑模式 name: 暗黑模式
@@ -146,11 +148,19 @@ plugins:
- search: - search:
lang: en lang: en
separator: '[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;' separator: '[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;'
- exclude-search:
exclude:
- mirrors.md
- tags - tags
- termynal - termynal
- minify:
minify_js: true
minify_css: true
htmlmin_opts:
remove_comments: true
cache_safe: true
js_files:
- assets/js/common.js
- assets/js/component.js
- assets/js/components/mirrors-table/data.js
- assets/js/components/mirrors-table/index.js
nav: nav:
- "介绍": index.md - "介绍": index.md
- "使用方法": use/index.md - "使用方法": use/index.md

View File

@@ -1,4 +1,5 @@
mkdocs-material==9.6.11 mkdocs-material==9.6.11
mkdocs-glightbox==0.4.0 mkdocs-glightbox==0.4.0
mkdocs-exclude-search==0.6.6 mkdocs-exclude-search==0.6.6
mkdocs-minify-plugin==0.8.0
termynal==0.13.0 termynal==0.13.0