适配 Alpine Linux & 优化

This commit is contained in:
SuperManito
2024-01-17 17:14:51 +08:00
parent e04cac1f16
commit 3553c0803b
11 changed files with 262 additions and 201 deletions

View File

@@ -37,9 +37,9 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
### 指定软件源分支
使用场景:目标软件源有对应系统镜像但是不符合本脚本关于软件源分支设置的默认规则
使用场景:目标镜像站有对应系统镜像但是不符合本项目脚本关于软件源分支设置的默认规则
脚本为了适配大的环境不会针对某一镜像站独特的镜像分支名称而单独定制,最开始是为了更换国内软件源而设计适配,默认使用的分支名称如下
项目脚本为了适配大的环境不会针对某一镜像站独特的镜像分支名称而单独适配,默认使用的分支名称如下
<table>
<tr>
@@ -48,7 +48,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
</tr>
<tr>
<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>&nbsp;Ubuntu</td>
<td align="center">ubuntu/ubuntu-ports</td>
<td align="center">ubuntu / ubuntu-ports</td>
</tr>
<tr>
<td><a href="https://www.kali.org" target="_blank"><img src="/../assets/images/icon/kali-linux.svg" width="16" height="16"/></a>&nbsp;Kali Linux</td>
@@ -60,7 +60,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
</tr>
<tr>
<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>&nbsp;Red Hat Enterprise Linux</td>
<td align="center">centos/rocky</td>
<td align="center">centos / centos-altarch / rocky</td>
</tr>
<tr>
<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>&nbsp;Fedora</td>
@@ -68,7 +68,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
</tr>
<tr>
<td><a href="https://www.centos.org" target="_blank"><img src="/../assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;CentOS</td>
<td align="center">centos/centos-stream/centos-altarch/centos-vault</td>
<td align="center">centos / centos-stream / centos-altarch / centos-vault</td>
</tr>
<tr>
<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>&nbsp;Rocky Linux</td>
@@ -76,7 +76,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
</tr>
<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>&nbsp;AlmaLinux</td>
<td align="center">almalinux/almalinux-vault</td>
<td align="center">almalinux / almalinux-vault</td>
</tr>
<tr>
<td><a href="https://www.opencloudos.org" target="_blank"><img src="/assets/images/icon/opencloudos.png" width="16" height="16" style="vertical-align: -0.25em"/></a>&nbsp;OpenCloudOS</td>
@@ -92,7 +92,11 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
</tr>
<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>&nbsp;Arch Linux</td>
<td align="center">archlinux/archlinuxarm</td>
<td align="center">archlinux / archlinuxarm</td>
</tr>
<tr>
<td><a href="https://www.alpinelinux.org" target="_blank"><img src="/../assets/images/icon/alpine.png" width="16" height="16" style="vertical-align: -0.15em"/></a>&nbsp;Alpine Linux</td>
<td align="center">alpine</td>
</tr>
</table>
@@ -116,7 +120,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --only-epel
```
### 恢复官方源
### 恢复使用官方源
当你不小心删除了官方源的备份时可以使用此命令来恢复,使用此命令选项后将跳过选择软件源步骤
@@ -134,9 +138,9 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
--branch-security debian-security
```
### 指定 Debian 系操作系统的版本名称
### 指定 Debian 系 Linux 版本代号
你可以自定义该版本名称,大多数情况下用于升级系统版本,请看下面的例子
大多数情况下自定义版本代号用于升级系统版本,请看下面的例子
``` { .bash .no-copy title="升级 Debian 至最新 12 版本 Bookworm" }
bash <(curl -sSL https://linuxmirrors.cn/main.sh) \

View File

@@ -3,39 +3,43 @@
!!! quote ""
- 如果提示 `Command 'curl' not found` 则说明当前未安装 `curl` 软件包
=== "Debian 系"
=== "Debian 系 Linux"
``` sh
apt-get install -y curl
```
``` sh
apt-get install -y curl
```
> `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Deepin`
> `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Deepin`
新装系统需要先执行一遍更新 `apt-get update`
新装系统需要先执行一遍更新 `apt-get update`
=== "RedHat 系 / OpenCloudOS / openEuler"
=== "RedHat 系 Linux / OpenCloudOS / openEuler"
``` sh
yum install -y curl || dnf install -y curl
```
``` sh
yum install -y curl || dnf install -y curl
```
> `Red Hat Enterprise Linux` &nbsp; `CentOS` &nbsp; `Rocky Linux` &nbsp; `AlmaLinux` &nbsp; `Fedora` &nbsp; `OpenCloudOS` &nbsp; `openEuler`
> `Red Hat Enterprise Linux` &nbsp; `CentOS` &nbsp; `Rocky Linux` &nbsp; `AlmaLinux` &nbsp; `Fedora` &nbsp; `OpenCloudOS` &nbsp; `openEuler`
新装系统需要先执行一遍更新 `yum makecache`
新装系统需要先执行一遍更新 `yum makecache`
=== "openSUSE"
=== "openSUSE"
``` sh
zypper install curl
```
``` sh
zypper install curl
```
=== "Arch Linux"
=== "Arch Linux"
``` sh
pacman -S curl
```
``` sh
pacman -S curl
```
=== "Alpine Linux"
``` sh
apk --no-cache add -f curl bash
```
## 关于开启 SSH 远程登录的方法
@@ -70,7 +74,7 @@
!!! quote ""
=== "Debian 系 Linux"
=== "Debian 系"
``` sh
cp -rvf /etc/apt/sources.list.bak /etc/apt/sources.list
@@ -79,7 +83,7 @@
> `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Deepin`
=== "RedHat 系 Linux / OpenCloudOS / openEuler"
=== "RedHat 系 / OpenCloudOS / openEuler"
``` sh
cp -rvf /etc/yum.repos.d.bak /etc/yum.repos.d
@@ -102,6 +106,13 @@
pacman -Sy
```
=== "Alpine Linux"
``` sh
cp -rvf /etc/apk/repositories.bak /etc/apk/repositories
apk update -f
```
## 其它
!!! quote ""

View File

@@ -11,7 +11,7 @@ hide:
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
```
!!! question "请在使用前检查目标镜像站是否支持您正在使用的操作系统"
!!! question "请在使用前检查目标镜像站是否支持您使用的操作系统"
??? quote "原始执行命令"
@@ -37,7 +37,7 @@ hide:
1. 通过 `--edu` 命令选项来使用中国大陆教育单位软件源
!!! question "请在使用前检查目标镜像站是否支持您正在使用的操作系统"
!!! question "请在使用前检查目标镜像站是否支持您使用的操作系统"
??? quote "原始执行命令"
@@ -63,7 +63,7 @@ hide:
1. 通过 `--abroad` 命令选项来使用海外软件源
!!! question "请在使用前检查目标镜像站是否支持您正在使用的操作系统"
!!! question "请在使用前检查目标镜像站是否支持您使用的操作系统"
??? quote "原始执行命令"
@@ -109,13 +109,13 @@ hide:
遵循系统默认设置即没有启用的软件源不会在运行完本脚本后被启用,但是它们也随脚本更换了目标软件源地址,如果你有使用需求请阅读下面的启用方法
=== "Debian 系 Linux"
=== "Debian 系"
默认禁用了`deb-src`源码仓库和`proposed`预发布软件源,若需启用请将 `/etc/apt/sources.list` 文件中相关内容的所在行取消注释
> `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Deepin`
=== "RedHat 系 Linux / OpenCloudOS / openEuler"
=== "RedHat 系 / OpenCloudOS / openEuler"
部分仓库默认没有启用,若需启用请将 `/etc/yum.repos.d` 目录下相关 repo 文件中的 `enabled` 值修改为 `1`