mirror of
https://gitee.com/SuperManito/LinuxMirrors
synced 2025-11-04 00:10:27 +08:00
更新文档
This commit is contained in:
1
docs/assets/images/sponsor/qiaoxh-dark.svg
Normal file
1
docs/assets/images/sponsor/qiaoxh-dark.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.0 KiB |
1
docs/assets/images/sponsor/qiaoxh-light.svg
Normal file
1
docs/assets/images/sponsor/qiaoxh-light.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.0 KiB |
@@ -125,21 +125,4 @@ hide:
|
||||
|
||||
[开 始 使 用](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">
|
||||
<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高频VPS|R9/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>
|
||||
--8<-- "docs/sponsor/main.html"
|
||||
|
||||
@@ -4,6 +4,8 @@ hide:
|
||||
- toc
|
||||
- feedback
|
||||
- footer
|
||||
search:
|
||||
exclude: true
|
||||
---
|
||||
|
||||
## 中国大陆 :flag-CN:
|
||||
|
||||
@@ -6,29 +6,16 @@ hide:
|
||||
- footer
|
||||
---
|
||||
|
||||
<div class="md-nav__sponsor-bottom" 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="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高频VPS|R9/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>
|
||||
--8<-- "docs/sponsor/main.html"
|
||||
|
||||
# 成为赞助商
|
||||
#
|
||||
|
||||
<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')">
|
||||
{ width="120" }
|
||||
</button>
|
||||
|
||||
> 点击按钮前往查看爱发电主页上的说明并与作者取得联系
|
||||
<figure style="margin: 0 auto" markdown>
|
||||
<figcaption><h3 style="font-style: normal !important"><strong>成为赞助商</strong></h3></figcaption>
|
||||
<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
22
docs/sponsor/main.html
Normal 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高频VPS|R9/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>
|
||||
@@ -6,6 +6,21 @@
|
||||
--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 {
|
||||
background-color: hsla(240, 9%, 75%, 0.33);
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
@@ -85,25 +100,25 @@
|
||||
vertical-align: -0.35em !important;
|
||||
}
|
||||
|
||||
.md-nav__sponsor-bottom {
|
||||
.sponsor {
|
||||
margin-top: 2rem;
|
||||
padding-top: 1rem;
|
||||
border-top: 1px solid var(--md-default-fg-color--lightest);
|
||||
}
|
||||
|
||||
.md-nav__sponsor-bottom .sponsor-label {
|
||||
.sponsor .sponsor-label {
|
||||
font-size: 0.8rem;
|
||||
text-align: center;
|
||||
margin-bottom: 0.2rem;
|
||||
color: var(--md-default-fg-color);
|
||||
}
|
||||
|
||||
.md-nav__sponsor-bottom .sponsor-wrapper {
|
||||
.sponsor .sponsor-wrapper {
|
||||
width: 100%;
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
|
||||
.md-nav__sponsor-bottom .sponsor-item {
|
||||
.sponsor .sponsor-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -116,11 +131,11 @@
|
||||
max-height: 80px;
|
||||
}
|
||||
|
||||
.md-nav__sponsor-bottom .sponsor-item:hover {
|
||||
.sponsor .sponsor-item:hover {
|
||||
background-color: var(--md-code-bg-color);
|
||||
}
|
||||
|
||||
.md-nav__sponsor-bottom .sponsor-item img {
|
||||
.sponsor .sponsor-item img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
vertical-align: middle;
|
||||
@@ -139,14 +154,23 @@
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 960px) {
|
||||
@media screen and (max-width: 768px) {
|
||||
.sponsor-flex-item {
|
||||
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) {
|
||||
.md-nav__sponsor-bottom {
|
||||
.sponsor-toc {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
44
docs/theme/partials/palette.html
vendored
44
docs/theme/partials/palette.html
vendored
@@ -23,8 +23,9 @@
|
||||
if (typeof document.startViewTransition !== 'function') {
|
||||
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) => {
|
||||
toggle.addEventListener(
|
||||
'click',
|
||||
@@ -36,28 +37,12 @@
|
||||
const targetId = this.getAttribute('for')
|
||||
const targetInput = document.getElementById(targetId)
|
||||
if (!targetInput) return
|
||||
// 获取当前存储的主题信息和即将切换到的主题信息
|
||||
const currentPalette = __md_get('__palette')
|
||||
const currentScheme = currentPalette?.color?.scheme || ''
|
||||
const currentMedia = currentPalette?.color?.media || ''
|
||||
// 获取新主题信息
|
||||
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
|
||||
}
|
||||
// 如果当前主题和目标主题相同,则不需要动画
|
||||
// 获取当前主题状态
|
||||
const currentScheme = document.body.getAttribute('data-md-color-scheme')
|
||||
const isCurrentDark = currentScheme.includes('slate')
|
||||
// 点击后会切换到相反的主题
|
||||
const isNewDark = !isCurrentDark
|
||||
// 当前主题和目标主题相同则不触发动画
|
||||
if (isCurrentDark === isNewDark) {
|
||||
targetInput.click()
|
||||
return
|
||||
@@ -74,8 +59,8 @@
|
||||
// 切换主题
|
||||
targetInput.click()
|
||||
// 添加暗/亮模式类,用于动画控制
|
||||
document.documentElement.classList.remove(isDark ? 'light' : 'dark')
|
||||
document.documentElement.classList.add(isDark ? 'dark' : 'light')
|
||||
document.documentElement.classList.remove(isNewDark ? 'light' : 'dark')
|
||||
document.documentElement.classList.add(isNewDark ? 'dark' : 'light')
|
||||
// 等待主题变化完成
|
||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||
})
|
||||
@@ -83,12 +68,12 @@
|
||||
// 视图过渡准备就绪,开始动画
|
||||
document.documentElement.animate(
|
||||
{
|
||||
clipPath: isDark ? [...clipPath].reverse() : clipPath,
|
||||
clipPath: isNewDark ? [...clipPath].reverse() : clipPath,
|
||||
},
|
||||
{
|
||||
duration: 500,
|
||||
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 = currentPalette?.color?.scheme || ''
|
||||
const currentScheme = document.body.getAttribute('data-md-color-scheme')
|
||||
const isDark = currentScheme.includes('slate')
|
||||
document.documentElement.classList.add(isDark ? 'dark' : 'light')
|
||||
})
|
||||
|
||||
10
docs/theme/partials/toc.html
vendored
10
docs/theme/partials/toc.html
vendored
@@ -9,19 +9,23 @@
|
||||
</ul>
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
<div class="md-nav__sponsor-bottom">
|
||||
<div class="sponsor sponsor-toc">
|
||||
<div class="sponsor-label">
|
||||
<strong>赞助商</strong>
|
||||
</div>
|
||||
<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%" />
|
||||
</a>
|
||||
<a class="sponsor-item" target="_blank" href="https://www.dkdun.cn/aff/VAWGETUL" title="林枫云 · 专注独立IP高频VPS|R9/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" 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-dark.png#only-dark" alt="Arcadia" style="width: 60%" />
|
||||
</a>
|
||||
|
||||
@@ -110,7 +110,9 @@ hide:
|
||||
|
||||
选项卡分别代表脚本内置软件源类型和获取脚本途径,请在使用前检查目标镜像站是否支持您所使用的操作系统,可以在[软件源列表](../mirrors/index.md)中查看具体有哪些软件源。
|
||||
|
||||
!!! tip "默认自动备份原有软件源内容,如需了解更多请翻阅下方文档"
|
||||
!!! tip "默认自动备份原有软件源内容,如需了解更多请翻阅下方文档。若使用过程中的某些选项令你疑惑不解,那么在选择软件源后一路回车即是最佳实践。"
|
||||
|
||||
</br>
|
||||
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
@@ -140,246 +142,245 @@ hide:
|
||||
|
||||
</div>
|
||||
|
||||
- ### 常见问题
|
||||
### 常见问题
|
||||
|
||||
- #### 关于报错 Command not found
|
||||
- #### 关于报错 Command not found
|
||||
|
||||
!!! quote ""
|
||||
!!! quote ""
|
||||
|
||||
此报错是因为系统没有安装 `curl` 软件包,下面是安装命令
|
||||
此报错是因为系统没有安装 `curl` 软件包,下面是安装命令
|
||||
|
||||
=== "Debian 系 / openKylin"
|
||||
=== "Debian 系 / openKylin"
|
||||
|
||||
``` bash
|
||||
apt-get install -y curl
|
||||
```
|
||||
|
||||
> `Debian` `Ubuntu` `Kali` `Linux Mint` `Deepin` `Zorin OS` `Armbian` `Proxmox VE` `Raspberry Pi OS` `openKylin`
|
||||
|
||||
新装系统需要先执行一遍更新 `apt-get update`
|
||||
|
||||
=== "RedHat 系 / openEuler / OpenCloudOS / Anolis OS"
|
||||
|
||||
``` bash
|
||||
dnf install -y curl || yum install -y curl
|
||||
```
|
||||
|
||||
> `Red Hat Enterprise Linux` `CentOS` `Rocky Linux` `AlmaLinux` `Fedora` `openEuler` `OpenCloudOS` `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
|
||||
apt-get install -y curl
|
||||
python3 -c "import urllib.request; urllib.request.urlretrieve('https://linuxmirrors.cn/main.sh', 'main.sh')"
|
||||
```
|
||||
|
||||
> `Debian` `Ubuntu` `Kali` `Linux Mint` `Deepin` `Zorin OS` `Armbian` `Proxmox VE` `Raspberry Pi OS` `openKylin`
|
||||
|
||||
新装系统需要先执行一遍更新 `apt-get update`
|
||||
|
||||
=== "RedHat 系 / openEuler / OpenCloudOS / Anolis OS"
|
||||
=== "使用 wget 下载脚本"
|
||||
|
||||
一般没有预装 `curl` 软件包的系统也不会预装 `wget` 软件包,所以大概率这个方法应该是不行的
|
||||
``` bash
|
||||
dnf install -y curl || yum install -y curl
|
||||
wget https://linuxmirrors.cn/main.sh
|
||||
```
|
||||
|
||||
> `Red Hat Enterprise Linux` `CentOS` `Rocky Linux` `AlmaLinux` `Fedora` `openEuler` `OpenCloudOS` `Anolis OS`
|
||||
=== "使用浏览器下载"
|
||||
|
||||
=== "openSUSE"
|
||||
如果可以访问系统 GUI 图像界面和桌面的话那可以直接在浏览器中打开链接下载脚本,很多系统都会预装 Firefox 火狐浏览器
|
||||
|
||||
之后再执行脚本即可
|
||||
|
||||
=== ":material-home-city: 中国大陆"
|
||||
|
||||
``` bash
|
||||
zypper install curl
|
||||
bash main.sh
|
||||
```
|
||||
|
||||
=== "Arch Linux"
|
||||
=== ":material-earth: 境外以及海外地区"
|
||||
|
||||
``` bash
|
||||
pacman -S curl
|
||||
bash main.sh --abroad
|
||||
```
|
||||
|
||||
=== "Alpine Linux"
|
||||
=== ":material-library: 中国大陆教育网"
|
||||
|
||||
``` 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
|
||||
nix-env -iA nixos.curl
|
||||
```
|
||||
脚本会自动备份原有软件源内容,备份路径为原有文件或目录的绝对路径加上 `.bak` 后缀,例如 `/etc/apt/sources.list => /etc/apt/sources.list.bak`,当检查到已存在备份内容时会询问是否覆盖备份。
|
||||
|
||||
??? tip "安装不上?(点击展开查看其它解决方法)"
|
||||
- #### 还原已备份的软件源
|
||||
|
||||
假如系统原有软件源是无效的导致安装不上 `curl` 软件包,那么对于 Linux 初学者来说可能会比较麻烦,这里提供几个在线获取脚本的应急方法
|
||||
!!! quote ""
|
||||
|
||||
=== "使用 Python 下载脚本"
|
||||
=== "Debian 系 / openKylin"
|
||||
|
||||
适用于大部分操作系统(`Alpine Linux` 除外),`python3` 要是不存在那就再试试 `python` 指令
|
||||
``` bash
|
||||
python3 -c "import urllib.request; urllib.request.urlretrieve('https://linuxmirrors.cn/main.sh', 'main.sh')"
|
||||
```
|
||||
``` bash
|
||||
cp -rf /etc/apt/sources.list.bak /etc/apt/sources.list
|
||||
apt-get update
|
||||
```
|
||||
|
||||
=== "使用 wget 下载脚本"
|
||||
> `Debian` `Ubuntu` `Kali` `Linux Mint` `Deepin` `Zorin OS` `Armbian` `Proxmox VE` `Raspberry Pi OS` `openKylin`
|
||||
|
||||
一般没有预装 `curl` 软件包的系统也不会预装 `wget` 软件包,所以大概率这个方法应该是不行的
|
||||
``` bash
|
||||
wget https://linuxmirrors.cn/main.sh
|
||||
```
|
||||
=== "RedHat 系 / openEuler / OpenCloudOS / Anolis OS"
|
||||
|
||||
=== "使用浏览器下载"
|
||||
``` bash
|
||||
cp -rf /etc/yum.repos.d.bak /etc/yum.repos.d
|
||||
yum makecache
|
||||
```
|
||||
|
||||
如果可以访问系统 GUI 图像界面和桌面的话那可以直接在浏览器中打开链接下载脚本,很多系统都会预装 Firefox 火狐浏览器
|
||||
> `Red Hat Enterprise Linux` `CentOS` `Rocky Linux` `AlmaLinux` `Fedora` `openEuler` `OpenCloudOS` `Anolis OS`
|
||||
|
||||
之后再执行脚本即可
|
||||
=== "openSUSE"
|
||||
|
||||
=== ":material-home-city: 中国大陆"
|
||||
``` bash
|
||||
cp -rf /etc/zypp/repos.d.bak /etc/zypp/repos.d
|
||||
zypper ref
|
||||
```
|
||||
|
||||
``` bash
|
||||
bash main.sh
|
||||
```
|
||||
=== "Arch Linux"
|
||||
|
||||
=== ":material-earth: 境外以及海外地区"
|
||||
``` bash
|
||||
cp -rf /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist
|
||||
pacman -Sy
|
||||
```
|
||||
|
||||
``` bash
|
||||
bash main.sh --abroad
|
||||
```
|
||||
=== "Alpine Linux"
|
||||
|
||||
=== ":material-library: 中国大陆教育网"
|
||||
``` bash
|
||||
cp -rf /etc/apk/repositories.bak /etc/apk/repositories
|
||||
apk update -f
|
||||
```
|
||||
|
||||
``` bash
|
||||
bash main.sh --edu
|
||||
```
|
||||
=== "Gentoo"
|
||||
|
||||
如果以上方法试了都不行,那就复制[源码](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
|
||||
cp -rf /etc/apt/sources.list.bak /etc/apt/sources.list
|
||||
apt-get update
|
||||
```
|
||||
- 设置允许 Root 用户登录
|
||||
|
||||
> `Debian` `Ubuntu` `Kali` `Linux Mint` `Deepin` `Zorin OS` `Armbian` `Proxmox VE` `Raspberry Pi OS` `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
|
||||
cp -rf /etc/yum.repos.d.bak /etc/yum.repos.d
|
||||
yum makecache
|
||||
```
|
||||
``` bash
|
||||
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
|
||||
```
|
||||
|
||||
> `Red Hat Enterprise Linux` `CentOS` `Rocky Linux` `AlmaLinux` `Fedora` `openEuler` `OpenCloudOS` `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
|
||||
cp -rf /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist
|
||||
pacman -Sy
|
||||
```
|
||||
!!! quote ""
|
||||
|
||||
=== "Alpine Linux"
|
||||
如果发现交互界面是输入而不是新式的方向键控制,那么请自行安装 `ncurses` 或 `nano` 软件包,新式的按键交互依赖 `tput` 指令实现。
|
||||
|
||||
``` bash
|
||||
cp -rf /etc/apk/repositories.bak /etc/apk/repositories
|
||||
apk update -f
|
||||
```
|
||||
- #### 关于调用脚本的互联网位置
|
||||
|
||||
=== "Gentoo"
|
||||
!!! quote ""
|
||||
|
||||
``` 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
|
||||
```
|
||||
项目利用 [GitHub Action](https://github.com/SuperManito/LinuxMirrors/blob/main/.github/workflows/build-docs.yml#L29) 在每次提交后自动拷贝源码到文档目录作为网站资源发布,网站托管于 :netlify: [Netlify](https://www.netlify.com),几乎没有被劫持的风险请放心使用。
|
||||
|
||||
=== "NixOS"
|
||||
当然你也可以使用代码托管仓库的原始地址来调用,这里只是想告诉你为什么会有几个不同的地址,默认的官网地址更易于记忆和访问。
|
||||
|
||||
``` bash
|
||||
cp -rf /etc/nix/nix.conf.bak /etc/nix/nix.conf
|
||||
```
|
||||
- #### 关于软件源下载速度相关问题
|
||||
|
||||
- #### 关于开启 SSH 远程登录的方法
|
||||
!!! quote ""
|
||||
|
||||
!!! quote ""
|
||||
首先,在[软件源列表](../mirrors/index.md)的使用帮助处有写使用推荐,这是根据以往经验总结出来的,但总有用户在纠结软件源速度的问题。
|
||||
|
||||
- 验证是否已安装 `SSH` 服务
|
||||
软件源(镜像站)的网络延迟即 `Ping` 与下载速度没有太大的关联,双方地理位置间隔的远近不代表实际体验,有些镜像站下行带宽很高但实际测速却并不理想,因为这与镜像站的并发性能和负载策略有关。
|
||||
|
||||
``` bash
|
||||
ls /etc | grep ssh
|
||||
```
|
||||
> 如果没有这个文件夹说明系统未安装 `SSH` 服务,你需要通过包管理工具安装 `openssh` 软件包
|
||||
网上也有很多基于 C、Python 编写的镜像站测速开源脚本,而本项目脚本基于 Bash Shell 编写且不依赖任何第三方库,Bash 是 Linux 运维中最常用的脚本语言并且绝大部分发行版都会预装,这意味着用户不需要安装任何环境就能直接运行,这种便利性是其它高级语言无法替代的,不过目前来看 Bash 脚本可能无法实现精准测速的功能,使用其它高级语言编写测速功能无疑是造轮子的行为。
|
||||
|
||||
- 设置允许 Root 用户登录
|
||||
- #### 关于未启用的软件源仓库
|
||||
|
||||
``` 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
|
||||
```
|
||||
!!! quote ""
|
||||
|
||||
- 设置密码认证
|
||||
很多系统的软件源会启用多个仓库,脚本遵循系统默认设置,默认不启用的软件源(仓库)不会在运行完本脚本后被启用,但是它们也随脚本更换了目标软件源地址,具体启用方法如下:
|
||||
|
||||
``` bash
|
||||
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
|
||||
```
|
||||
=== "Debian 系 / openKylin"
|
||||
|
||||
- 启动/重启 `SSH` 服务
|
||||
默认禁用了`deb-src`源码仓库和`proposed`预发布软件源,若需启用请将 `/etc/apt/sources.list` 文件中相关内容的所在行取消注释
|
||||
|
||||
``` bash
|
||||
ps -ef | grep -q ssh ; [ $? -eq 0 ] && systemctl restart sshd || systemctl enable --now sshd
|
||||
```
|
||||
> `Debian` `Ubuntu` `Kali` `Linux Mint` `Deepin` `Zorin OS` `Armbian` `Proxmox VE` `Raspberry Pi OS` `openKylin`
|
||||
|
||||
> 命令以及配置步骤仅供参考,只适配了部分常见发行版
|
||||
=== "RedHat 系 / openEuler / OpenCloudOS / Anolis OS"
|
||||
|
||||
- #### 关于调用脚本的互联网位置
|
||||
部分仓库默认没有启用,若需启用请将 `/etc/yum.repos.d` 目录下相关 repo 文件中的 `enabled` 值修改为 `1`
|
||||
|
||||
!!! quote ""
|
||||
> `Red Hat Enterprise Linux` `CentOS` `Rocky Linux` `AlmaLinux` `Fedora` `openEuler` `OpenCloudOS` `Anolis OS`
|
||||
|
||||
项目利用 [GitHub Action](https://github.com/SuperManito/LinuxMirrors/blob/main/.github/workflows/build-docs.yml#L29) 在每次提交后自动拷贝源码到文档目录作为网站资源发布,网站托管于 :netlify: [Netlify](https://www.netlify.com),几乎没有被劫持的风险请放心使用。
|
||||
=== "openSUSE"
|
||||
|
||||
当然你也可以使用代码托管仓库的原始地址来调用,这里只是想告诉你为什么会有几个不同的地址,默认的官网地址更易于记忆和访问。
|
||||
|
||||
- #### 关于软件源下载速度相关问题
|
||||
|
||||
!!! quote ""
|
||||
|
||||
首先,在[软件源列表](../mirrors/index.md)的使用帮助处有写使用推荐,这是根据以往经验总结出来的,但总有用户在纠结软件源速度的问题。
|
||||
|
||||
软件源(镜像站)的网络延迟即 `Ping` 与下载速度没有太大的关联,双方地理位置间隔的远近不代表实际体验,有些镜像站下行带宽很高但实际测速却并不理想,因为这与镜像站的并发性能和负载策略有关。
|
||||
|
||||
网上也有很多基于 C、Python 编写的镜像站测速开源脚本,而本项目脚本基于 Bash Shell 编写且不依赖任何第三方库,Bash 是 Linux 运维中最常用的脚本语言并且绝大部分发行版都会预装,这意味着用户不需要安装任何环境就能直接运行,这种便利性是其它高级语言无法替代的,不过目前来看 Bash 脚本可能无法实现精准测速的功能,使用其它高级语言编写测速功能无疑是造轮子的行为。
|
||||
|
||||
- #### 关于未启用的软件源仓库
|
||||
|
||||
!!! quote ""
|
||||
|
||||
很多系统的软件源会启用多个仓库,脚本遵循系统默认设置,默认不启用的软件源(仓库)不会在运行完本脚本后被启用,但是它们也随脚本更换了目标软件源地址,具体启用方法如下:
|
||||
|
||||
=== "Debian 系 / openKylin"
|
||||
|
||||
默认禁用了`deb-src`源码仓库和`proposed`预发布软件源,若需启用请将 `/etc/apt/sources.list` 文件中相关内容的所在行取消注释
|
||||
|
||||
> `Debian` `Ubuntu` `Kali` `Linux Mint` `Deepin` `Zorin OS` `Armbian` `Proxmox VE` `Raspberry Pi OS` `openKylin`
|
||||
|
||||
=== "RedHat 系 / openEuler / OpenCloudOS / Anolis OS"
|
||||
|
||||
部分仓库默认没有启用,若需启用请将 `/etc/yum.repos.d` 目录下相关 repo 文件中的 `enabled` 值修改为 `1`
|
||||
|
||||
> `Red Hat Enterprise Linux` `CentOS` `Rocky Linux` `AlmaLinux` `Fedora` `openEuler` `OpenCloudOS` `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` 指令实现。
|
||||
部分仓库默认没有启用,若需启用请将 `/etc/zypp/repos.d` 目录下相关 repo 文件中的 `enabled` 值修改为 `1`
|
||||
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user