mirror of
https://gitee.com/SuperManito/LinuxMirrors
synced 2025-11-22 17:30:26 +08:00
优化版本号判断并适配 LMDE 7
This commit is contained in:
@@ -151,17 +151,17 @@ hide:
|
||||
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
- :material-numeric-1:{style="color: #5b84f5" .lg} __Run the script as `ROOT` user__
|
||||
- :material-numeric-1:{style="color: #5b84f5" .lg} __`ROOT` privileges required__
|
||||
|
||||
---
|
||||
|
||||
Switch command: `sudo -i` or `su root`. Different systems use different commands because some systems do not set a password for the ROOT account during initial installation (such as Ubuntu) or the system disables ROOT login by default.
|
||||
Please run this script using the `root` account. Switch commands are `sudo -i` or `su root`. Different systems use different commands because some systems do not set a password for the root account during initial installation (e.g., Ubuntu) or disable `root` account login by default.
|
||||
|
||||
- :material-numeric-2:{style="color: #5b84f5" .lg} __It is recommended to use a modern `SSH` client__
|
||||
|
||||
---
|
||||
|
||||
If your terminal displays garbled Chinese, you will not be able to see the interactive content. Some GUI terminal apps may have unpredictable display issues. Some systems automatically enable SSH service; otherwise, see [how to enable SSH](#how-to-enable-ssh-remote-login).
|
||||
The system's GUI graphical interface terminal application may experience some unpredictable display issues. Some systems will automatically enable the SSH service; otherwise, please refer to [how to enable SSH](#how-to-enable-ssh-remote-login).
|
||||
|
||||
- :material-numeric-3:{style="color: #5b84f5" .lg} __If running the script for the first time on a new system__
|
||||
|
||||
@@ -285,7 +285,7 @@ hide:
|
||||
|
||||
- #### Restore backed up mirrors
|
||||
|
||||
!!! quote ""
|
||||
??? quote "Click to expand and view"
|
||||
|
||||
=== "Debian-based / openKylin"
|
||||
|
||||
@@ -352,36 +352,79 @@ hide:
|
||||
|
||||
- #### How to enable SSH remote login
|
||||
|
||||
!!! quote ""
|
||||
??? quote "Click to expand and view"
|
||||
|
||||
The commands and steps are for reference only and only cover some common distributions.
|
||||
The commands and configuration steps are for reference only; please be flexible and adapt them accordingly.
|
||||
|
||||
- Check if `SSH` service is installed
|
||||
|
||||
``` bash
|
||||
ls /etc | grep ssh
|
||||
```
|
||||
> If this folder does not exist, SSH is not installed. Install the `openssh` package with your package manager.
|
||||
> Note that package names may differ; you can use `openssh*` as a wildcard.
|
||||
|
||||
- Allow Root login
|
||||
If this folder does not exist, SSH is not installed. Install the `openssh-server` package with your package manager. The installation command is as follows:
|
||||
|
||||
``` bash
|
||||
=== "Debian-based / openKylin"
|
||||
|
||||
``` bash
|
||||
apt-get install -y openssh-server
|
||||
```
|
||||
|
||||
> `Debian` `Ubuntu` `Kali` `Linux Mint` `Deepin` `Zorin OS` `Armbian` `Proxmox VE` `Raspberry Pi OS` `openKylin`
|
||||
|
||||
For new systems, run `apt-get update` first.
|
||||
|
||||
=== "RedHat-based / openEuler / OpenCloudOS / Anolis OS"
|
||||
|
||||
``` bash
|
||||
dnf install -y openssh-server || yum install -y openssh-server
|
||||
```
|
||||
|
||||
> `Red Hat Enterprise Linux` `CentOS` `Rocky Linux` `AlmaLinux` `Fedora` `openEuler` `OpenCloudOS` `Anolis OS`
|
||||
|
||||
=== "openSUSE"
|
||||
|
||||
``` bash
|
||||
zypper install openssh-server
|
||||
```
|
||||
|
||||
=== "Arch Linux / Manjaro"
|
||||
|
||||
``` bash
|
||||
pacman -S openssh
|
||||
```
|
||||
|
||||
=== "Alpine Linux"
|
||||
|
||||
``` bash
|
||||
apk --no-cache add -f openssh
|
||||
```
|
||||
|
||||
=== "Gentoo"
|
||||
|
||||
``` bash
|
||||
emerge --ask --changed-use --oneshot net-misc/openssh
|
||||
```
|
||||
|
||||
> Package names may vary across different systems. If you encounter a "package not found" error, try using wildcards `openssh*` to install it.
|
||||
|
||||
- Configure `SSH` service
|
||||
|
||||
``` { .bash .no-copy title="Allow root account login" }
|
||||
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
|
||||
```
|
||||
|
||||
- Enable password authentication
|
||||
|
||||
``` bash
|
||||
``` { .bash .no-copy title="Enable password authentication" }
|
||||
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
|
||||
```
|
||||
|
||||
- Start/restart `SSH` service
|
||||
|
||||
``` bash
|
||||
ps -ef | grep -q ssh ; [ $? -eq 0 ] && systemctl restart sshd || systemctl enable --now sshd
|
||||
for ssh_svc in sshd ssh openssh; do systemctl restart "${ssh_svc}" 2>/dev/null && break ; systemctl enable --now "${ssh_svc}" 2>/dev/null && break ; done
|
||||
```
|
||||
> Service names may differ; if not `sshd`, try `ssh`.
|
||||
|
||||
!!! tip "Friendly reminder: If you are using a public server, it is recommended to disable SSH password authentication and set up key-based login."
|
||||
|
||||
- #### No arrow key interactive UI
|
||||
|
||||
@@ -543,31 +586,31 @@ Below are some advanced usage examples
|
||||
|
||||
| OS Name | Names Involved |
|
||||
| --- | :---: |
|
||||
| <a href="https://www.debian.org" title="https://www.debian.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/debian.svg" width="16" height="16" style="vertical-align: -0.35em"></a> **Debian** | `debian` `debian-archive` |
|
||||
| <a href="https://ubuntu.com" title="https://ubuntu.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/ubuntu.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **Ubuntu** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.kali.org" title="https://www.kali.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/kali-linux.png" width="16" height="16"></a> **Kali Linux** | `kali` |
|
||||
| <a href="https://linuxmint.com" title="https://linuxmint.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/linux-mint.ico" width="16" height="16" style="vertical-align: -0.2em"></a> **Linux Mint** | `linuxmint` `ubuntu` `ubuntu-ports` `debian` |
|
||||
| <a href="https://www.deepin.org" title="https://www.deepin.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/deepin.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Deepin(深度)** | `deepin` |
|
||||
| <a href="https://zorin.com/os" title="https://zorin.com/os" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/zorin-os.png" width="16" height="16" style="vertical-align: -0.15em"></a> **Zorin OS** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.armbian.com" title="https://www.armbian.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/armbian.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Armbian** | `armbian` |
|
||||
| <a href="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" title="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/proxmox.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Proxmox VE** | `proxmox` |
|
||||
| <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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.openeuler.org/zh" title="https://www.openeuler.org/zh" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openeuler.ico" width="16" height="16" style="vertical-align: -0.2em"></a> **openEuler** | `openeuler` |
|
||||
| <a href="https://www.opencloudos.org" title="https://www.opencloudos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opencloudos.png" width="16" height="16" style="vertical-align: -0.25em"></a> **OpenCloudOS** | `opencloudos` |
|
||||
| <a href="https://www.openkylin.top" title="https://www.openkylin.top" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openkylin.ico" width="16" height="16" style="vertical-align: -0.25em"></a> **openKylin** | `openkylin` |
|
||||
| <a href="https://openanolis.cn" title="https://openanolis.cn" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/anolis.png" width="16" height="16" style="vertical-align: -0.1em"></a> **Anolis OS** | `anolis` |
|
||||
| <a href="https://www.opensuse.org" title="https://www.opensuse.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opensuse.svg" width="16" height="16"></a> **openSUSE** | `opensuse` |
|
||||
| <a href="https://archlinux.org" title="https://archlinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/arch-linux.ico" width="16" height="16" style="vertical-align: -0.15em"></a> **Arch Linux** | `archlinux` `archlinuxarm` |
|
||||
| <a href="https://manjaro.org" title="https://manjaro.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/manjaro.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Manjaro** | `manjaro` |
|
||||
| <a href="https://www.alpinelinux.org" title="https://www.alpinelinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/alpine.png" width="16" height="16" style="vertical-align: -0.15em"></a> **Alpine Linux** | `alpine` |
|
||||
| <a href="https://www.gentoo.org" title="https://www.gentoo.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/gentoo.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Gentoo** | `gentoo` `gentoo-portage` |
|
||||
| <a href="https://nixos.org" title="https://nixos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/nixos.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **NixOS** | `nix-channels` |
|
||||
| <a href="https://www.debian.org" title="https://www.debian.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/debian.svg" alt="Debian" width="16" height="16" style="vertical-align: -0.35em"></a> **Debian** | `debian` `debian-archive` |
|
||||
| <a href="https://ubuntu.com" title="https://ubuntu.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/ubuntu.svg" alt="Ubuntu" width="16" height="16" style="vertical-align: -0.15em"></a> **Ubuntu** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.kali.org" title="https://www.kali.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/kali-linux.png" alt="Kali Linux" width="16" height="16"></a> **Kali Linux** | `kali` |
|
||||
| <a href="https://linuxmint.com" title="https://linuxmint.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/linux-mint.svg" alt="Linux Mint" width="16" height="16" style="vertical-align: -0.2em"></a> **Linux Mint** | `linuxmint` `ubuntu` `ubuntu-ports` `debian` |
|
||||
| <a href="https://www.deepin.org" title="https://www.deepin.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/deepin.png" alt="Deepin" width="16" height="16" style="vertical-align: -0.2em"></a> **Deepin(深度)** | `deepin` |
|
||||
| <a href="https://zorin.com/os" title="https://zorin.com/os" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/zorin-os.png" alt="Zorin OS" width="16" height="16" style="vertical-align: -0.15em"></a> **Zorin OS** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.armbian.com" title="https://www.armbian.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/armbian.png" alt="Armbian" width="16" height="16" style="vertical-align: -0.2em"></a> **Armbian** | `armbian` |
|
||||
| <a href="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" title="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/proxmox.svg" alt="Proxmox VE" width="16" height="16" style="vertical-align: -0.2em"></a> **Proxmox VE** | `proxmox` |
|
||||
| <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/raspberry-pi.png" alt="Raspberry Pi OS" 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" rel="noopener noreferrer"><img src="/assets/images/icon/redhat.svg" alt="Red Hat Enterprise Linux" 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" rel="noopener noreferrer"><img src="/assets/images/icon/fedora.ico" alt="Fedora" 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" rel="noopener noreferrer"><img src="/assets/images/icon/centos.svg" alt="CentOS" 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" rel="noopener noreferrer"><img src="/assets/images/icon/rocky-linux.svg" alt="Rocky Linux" width="16" height="16" style="vertical-align: -0.2em"></a> **Rocky Linux** | `rocky` |
|
||||
| <a href="https://almalinux.org" title="https://almalinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/almalinux.svg" alt="AlmaLinux" 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" rel="noopener noreferrer"><img src="/assets/images/icon/oracle-linux.png" alt="Oracle Linux" width="16" height="16" style="vertical-align: -0.25em"></a> **Oracle Linux** | `centos-stream` |
|
||||
| <a href="https://www.openeuler.org" title="https://www.openeuler.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openeuler.ico" alt="openEuler" width="16" height="16" style="vertical-align: -0.2em"></a> **openEuler** | `openeuler` |
|
||||
| <a href="https://www.opencloudos.org" title="https://www.opencloudos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opencloudos.png" alt="OpenCloudOS" width="16" height="16" style="vertical-align: -0.25em"></a> **OpenCloudOS** | `opencloudos` |
|
||||
| <a href="https://www.openkylin.top" title="https://www.openkylin.top" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openkylin.ico" alt="openKylin" width="16" height="16" style="vertical-align: -0.25em"></a> **openKylin** | `openkylin` |
|
||||
| <a href="https://openanolis.cn" title="https://openanolis.cn" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/anolis.png" alt="Anolis OS" width="16" height="16" style="vertical-align: -0.1em"></a> **Anolis OS** | `anolis` |
|
||||
| <a href="https://www.opensuse.org" title="https://www.opensuse.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opensuse.svg" alt="openSUSE" width="16" height="16"></a> **openSUSE** | `opensuse` |
|
||||
| <a href="https://archlinux.org" title="https://archlinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/arch-linux.ico" alt="Arch Linux" width="16" height="16" style="vertical-align: -0.15em"></a> **Arch Linux** | `archlinux` `archlinuxarm` |
|
||||
| <a href="https://manjaro.org" title="https://manjaro.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/manjaro.svg" alt="Manjaro" width="16" height="16" style="vertical-align: -0.2em"></a> **Manjaro** | `manjaro` |
|
||||
| <a href="https://www.alpinelinux.org" title="https://www.alpinelinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/alpine.png" alt="Alpine Linux" width="16" height="16" style="vertical-align: -0.15em"></a> **Alpine Linux** | `alpine` |
|
||||
| <a href="https://www.gentoo.org" title="https://www.gentoo.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/gentoo.svg" alt="Gentoo" width="16" height="16" style="vertical-align: -0.2em"></a> **Gentoo** | `gentoo` `gentoo-portage` |
|
||||
| <a href="https://nixos.org" title="https://nixos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/nixos.svg" alt="NixOS" width="16" height="16" style="vertical-align: -0.15em"></a> **NixOS** | `nix-channels` |
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
@@ -153,29 +153,29 @@ hide:
|
||||
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
- :material-numeric-1:{style="color: #5b84f5" .lg} __需使用 `ROOT` 用户执行脚本__
|
||||
- :material-numeric-1:{style="color: #5b84f5" .lg} __需要 `ROOT` 权限__
|
||||
|
||||
---
|
||||
|
||||
切换命令为 `sudo -i` 或 `su root`。不同系统使用的命令不同,因为部分系统没有在初始安装时为 ROOT 账户设置密码(例如 Ubuntu)或系统默认禁止 ROOT 用户登录。
|
||||
请使用 `root` 账户运行本脚本,切换命令为 `sudo -i` 或 `su root`。不同系统使用的命令不同,因为部分系统没有在初始安装时为 root 账户设置密码(例如 Ubuntu)或系统默认禁止 `root` 账户登录。
|
||||
|
||||
- :material-numeric-2:{style="color: #5b84f5" .lg} __建议使用现代化的 `SSH` 客户端应用__
|
||||
|
||||
---
|
||||
|
||||
如果你系统命令行界面的中文显示乱码那么将导致无法查看交互内容,此外部分系统 GUI 图形界面的终端应用可能存在一些无法预料的显示问题。部分系统会自动开启 SSH 服务,否则请参考[开启方法](#关于开启-ssh-远程登录的方法)。
|
||||
如果系统命令行界面的中文显示乱码,将导致无法查看交互内容,此外部分系统 GUI 图形界面的终端应用可能存在一些无法预料的显示问题。部分系统会自动开启 SSH 服务,否则请参考[开启方法](#关于开启-ssh-远程登录的方法)。
|
||||
|
||||
- :material-numeric-3:{style="color: #5b84f5" .lg} __如果是在新装系统上首次执行脚本__
|
||||
|
||||
---
|
||||
|
||||
当前依赖 `curl` 指令获取脚本内容,但部分操作系统没有预装此软件包,届时则会报错 `Command not found`,安装方法详见下方 [_关于报错 Command not found_](#关于报错-command-not-found)。脚本本身与 `curl` `wget` 指令无关,更不会下载任何内容。
|
||||
当前依赖 `curl` 指令获取脚本内容,但部分操作系统未预装此软件包,将会报错 `Command not found`,安装方法详见下方 [_关于报错 Command not found_](#关于报错-command-not-found)。脚本本身与 `curl` `wget` 指令无关,不会下载任何内容。
|
||||
|
||||
- :material-numeric-4:{style="color: #5b84f5" .lg} __脚本运行期间需要交互选择配置__
|
||||
|
||||
---
|
||||
|
||||
请通过方向键 ++arrow-up++++arrow-down++++arrow-left++++arrow-right++ 或 ++w++++a++++s++++d++ 控制选项并按 ++enter++ 回车键确认。如果发现交互异常那么请改变终端软件的窗口大小后重试,另外窗口不要铺满全屏。
|
||||
请通过方向键 ++arrow-up++++arrow-down++++arrow-left++++arrow-right++ 或 ++w++++a++++s++++d++ 控制选项并按 ++enter++ 回车键确认。如果发现交互异常请改变终端软件的窗口大小后重试,避免窗口铺满全屏。
|
||||
|
||||
</div>
|
||||
|
||||
@@ -287,7 +287,7 @@ hide:
|
||||
|
||||
- #### 还原已备份的软件源
|
||||
|
||||
!!! quote ""
|
||||
??? quote "点击展开查看"
|
||||
|
||||
=== "Debian 系 / openKylin"
|
||||
|
||||
@@ -354,36 +354,79 @@ hide:
|
||||
|
||||
- #### 关于开启 SSH 远程登录的方法
|
||||
|
||||
!!! quote ""
|
||||
??? quote "点击展开查看"
|
||||
|
||||
命令以及配置步骤仅供参考,只适配了部分常见发行版
|
||||
命令以及配置步骤仅供参考,注意灵活变通
|
||||
|
||||
- 验证是否已安装 `SSH` 服务
|
||||
|
||||
``` bash
|
||||
ls /etc | grep ssh
|
||||
```
|
||||
> 如果没有这个文件夹说明系统未安装 `SSH` 服务,你需要通过包管理工具安装 `openssh` 软件包
|
||||
> 需要注意的是不同系统上的软件包名称有所差异,可直接使用 `openssh*` 通配符进行安装
|
||||
|
||||
- 设置允许 Root 用户登录
|
||||
如果没有这个文件夹说明系统未安装 `SSH` 服务,你需要通过包管理工具安装 `openssh-server` 软件包,安装命令如下:
|
||||
|
||||
``` bash
|
||||
=== "Debian 系 / openKylin"
|
||||
|
||||
``` bash
|
||||
apt-get install -y openssh-server
|
||||
```
|
||||
|
||||
> `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 openssh-server || yum install -y openssh-server
|
||||
```
|
||||
|
||||
> `Red Hat Enterprise Linux` `CentOS` `Rocky Linux` `AlmaLinux` `Fedora` `openEuler` `OpenCloudOS` `Anolis OS`
|
||||
|
||||
=== "openSUSE"
|
||||
|
||||
``` bash
|
||||
zypper install openssh-server
|
||||
```
|
||||
|
||||
=== "Arch Linux / Manjaro"
|
||||
|
||||
``` bash
|
||||
pacman -S openssh
|
||||
```
|
||||
|
||||
=== "Alpine Linux"
|
||||
|
||||
``` bash
|
||||
apk --no-cache add -f openssh
|
||||
```
|
||||
|
||||
=== "Gentoo"
|
||||
|
||||
``` bash
|
||||
emerge --ask --changed-use --oneshot net-misc/openssh
|
||||
```
|
||||
|
||||
> 不同系统上的软件包名称有所差异,如果提示找不到该软件包可尝试使用通配符 `openssh*` 进行安装
|
||||
|
||||
- 配置 `SSH` 服务
|
||||
|
||||
``` { .bash .no-copy title="允许 root 账户登录" }
|
||||
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
|
||||
``` { .bash .no-copy title="启用密码认证" }
|
||||
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` 服务
|
||||
|
||||
``` bash
|
||||
ps -ef | grep -q ssh ; [ $? -eq 0 ] && systemctl restart sshd || systemctl enable --now sshd
|
||||
for ssh_svc in sshd ssh; do systemctl restart "${ssh_svc}" 2>/dev/null && break ; systemctl enable --now "${ssh_svc}" 2>/dev/null && break ; done
|
||||
```
|
||||
> 不同系统上的服务名称有所差异,如果不是 `sshd` 那就试试 `ssh`
|
||||
|
||||
!!! tip "友情提示:如果你正在使用公网服务器,建议关闭 SSH 密码认证方式并设置密钥登录。"
|
||||
|
||||
- #### 关于未显示方向键交互控制界面
|
||||
|
||||
@@ -545,31 +588,31 @@ $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --help
|
||||
|
||||
| 系统名称 | 涉及的名称 |
|
||||
| --- | :---: |
|
||||
| <a href="https://www.debian.org" title="https://www.debian.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/debian.svg" width="16" height="16" style="vertical-align: -0.35em"></a> **Debian** | `debian` `debian-archive` |
|
||||
| <a href="https://ubuntu.com" title="https://ubuntu.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/ubuntu.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **Ubuntu** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.kali.org" title="https://www.kali.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/kali-linux.png" width="16" height="16"></a> **Kali Linux** | `kali` |
|
||||
| <a href="https://linuxmint.com" title="https://linuxmint.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/linux-mint.ico" width="16" height="16" style="vertical-align: -0.2em"></a> **Linux Mint** | `linuxmint` `ubuntu` `ubuntu-ports` `debian` |
|
||||
| <a href="https://www.deepin.org" title="https://www.deepin.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/deepin.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Deepin(深度)** | `deepin` |
|
||||
| <a href="https://zorin.com/os" title="https://zorin.com/os" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/zorin-os.png" width="16" height="16" style="vertical-align: -0.15em"></a> **Zorin OS** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.armbian.com" title="https://www.armbian.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/armbian.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Armbian** | `armbian` |
|
||||
| <a href="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" title="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/proxmox.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Proxmox VE** | `proxmox` |
|
||||
| <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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.openeuler.org/zh" title="https://www.openeuler.org/zh" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openeuler.ico" width="16" height="16" style="vertical-align: -0.2em"></a> **openEuler(开源欧拉)** | `openeuler` |
|
||||
| <a href="https://www.opencloudos.org" title="https://www.opencloudos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opencloudos.png" width="16" height="16" style="vertical-align: -0.25em"></a> **OpenCloudOS(鸥栖)** | `opencloudos` |
|
||||
| <a href="https://www.openkylin.top" title="https://www.openkylin.top" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openkylin.ico" width="16" height="16" style="vertical-align: -0.25em"></a> **openKylin(开放麒麟)** | `openkylin` |
|
||||
| <a href="https://openanolis.cn" title="https://openanolis.cn" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/anolis.png" width="16" height="16" style="vertical-align: -0.1em"></a> **Anolis OS(龙蜥)** | `anolis` |
|
||||
| <a href="https://www.opensuse.org" title="https://www.opensuse.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opensuse.svg" width="16" height="16"></a> **openSUSE** | `opensuse` |
|
||||
| <a href="https://archlinux.org" title="https://archlinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/arch-linux.ico" width="16" height="16" style="vertical-align: -0.15em"></a> **Arch Linux** | `archlinux` `archlinuxarm` |
|
||||
| <a href="https://manjaro.org" title="https://manjaro.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/manjaro.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Manjaro** | `manjaro` |
|
||||
| <a href="https://www.alpinelinux.org" title="https://www.alpinelinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/alpine.png" width="16" height="16" style="vertical-align: -0.15em"></a> **Alpine Linux** | `alpine` |
|
||||
| <a href="https://www.gentoo.org" title="https://www.gentoo.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/gentoo.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Gentoo** | `gentoo` `gentoo-portage` |
|
||||
| <a href="https://nixos.org" title="https://nixos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/nixos.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **NixOS** | `nix-channels` |
|
||||
| <a href="https://www.debian.org" title="https://www.debian.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/debian.svg" alt="Debian" width="16" height="16" style="vertical-align: -0.35em"></a> **Debian** | `debian` `debian-archive` |
|
||||
| <a href="https://ubuntu.com" title="https://ubuntu.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/ubuntu.svg" alt="Ubuntu" width="16" height="16" style="vertical-align: -0.15em"></a> **Ubuntu** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.kali.org" title="https://www.kali.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/kali-linux.png" alt="Kali Linux" width="16" height="16"></a> **Kali Linux** | `kali` |
|
||||
| <a href="https://linuxmint.com" title="https://linuxmint.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/linux-mint.svg" alt="Linux Mint" width="16" height="16" style="vertical-align: -0.2em"></a> **Linux Mint** | `linuxmint` `ubuntu` `ubuntu-ports` `debian` |
|
||||
| <a href="https://www.deepin.org" title="https://www.deepin.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/deepin.png" alt="Deepin" width="16" height="16" style="vertical-align: -0.2em"></a> **Deepin(深度)** | `deepin` |
|
||||
| <a href="https://zorin.com/os" title="https://zorin.com/os" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/zorin-os.png" alt="Zorin OS" width="16" height="16" style="vertical-align: -0.15em"></a> **Zorin OS** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.armbian.com" title="https://www.armbian.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/armbian.png" alt="Armbian" width="16" height="16" style="vertical-align: -0.2em"></a> **Armbian** | `armbian` |
|
||||
| <a href="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" title="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/proxmox.svg" alt="Proxmox VE" width="16" height="16" style="vertical-align: -0.2em"></a> **Proxmox VE** | `proxmox` |
|
||||
| <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/raspberry-pi.png" alt="Raspberry Pi OS" 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" rel="noopener noreferrer"><img src="/assets/images/icon/redhat.svg" alt="Red Hat Enterprise Linux" 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" rel="noopener noreferrer"><img src="/assets/images/icon/fedora.ico" alt="Fedora" 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" rel="noopener noreferrer"><img src="/assets/images/icon/centos.svg" alt="CentOS" 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" rel="noopener noreferrer"><img src="/assets/images/icon/rocky-linux.svg" alt="Rocky Linux" width="16" height="16" style="vertical-align: -0.2em"></a> **Rocky Linux** | `rocky` |
|
||||
| <a href="https://almalinux.org" title="https://almalinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/almalinux.svg" alt="AlmaLinux" 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" rel="noopener noreferrer"><img src="/assets/images/icon/oracle-linux.png" alt="Oracle Linux" width="16" height="16" style="vertical-align: -0.25em"></a> **Oracle Linux** | `centos-stream` |
|
||||
| <a href="https://www.openeuler.org" title="https://www.openeuler.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openeuler.ico" alt="openEuler" width="16" height="16" style="vertical-align: -0.2em"></a> **openEuler(开源欧拉)** | `openeuler` |
|
||||
| <a href="https://www.opencloudos.org" title="https://www.opencloudos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opencloudos.png" alt="OpenCloudOS" width="16" height="16" style="vertical-align: -0.25em"></a> **OpenCloudOS(鸥栖)** | `opencloudos` |
|
||||
| <a href="https://www.openkylin.top" title="https://www.openkylin.top" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openkylin.ico" alt="openKylin" width="16" height="16" style="vertical-align: -0.25em"></a> **openKylin(开放麒麟)** | `openkylin` |
|
||||
| <a href="https://openanolis.cn" title="https://openanolis.cn" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/anolis.png" alt="Anolis OS" width="16" height="16" style="vertical-align: -0.1em"></a> **Anolis OS(龙蜥)** | `anolis` |
|
||||
| <a href="https://www.opensuse.org" title="https://www.opensuse.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opensuse.svg" alt="openSUSE" width="16" height="16"></a> **openSUSE** | `opensuse` |
|
||||
| <a href="https://archlinux.org" title="https://archlinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/arch-linux.ico" alt="Arch Linux" width="16" height="16" style="vertical-align: -0.15em"></a> **Arch Linux** | `archlinux` `archlinuxarm` |
|
||||
| <a href="https://manjaro.org" title="https://manjaro.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/manjaro.svg" alt="Manjaro" width="16" height="16" style="vertical-align: -0.2em"></a> **Manjaro** | `manjaro` |
|
||||
| <a href="https://www.alpinelinux.org" title="https://www.alpinelinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/alpine.png" alt="Alpine Linux" width="16" height="16" style="vertical-align: -0.15em"></a> **Alpine Linux** | `alpine` |
|
||||
| <a href="https://www.gentoo.org" title="https://www.gentoo.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/gentoo.svg" alt="Gentoo" width="16" height="16" style="vertical-align: -0.2em"></a> **Gentoo** | `gentoo` `gentoo-portage` |
|
||||
| <a href="https://nixos.org" title="https://nixos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/nixos.svg" alt="NixOS" width="16" height="16" style="vertical-align: -0.15em"></a> **NixOS** | `nix-channels` |
|
||||
|
||||
请看下面的例子
|
||||
|
||||
|
||||
@@ -153,29 +153,29 @@ hide:
|
||||
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
- :material-numeric-1:{style="color: #5b84f5" .lg} __需使用 `ROOT` 執行腳本__
|
||||
- :material-numeric-1:{style="color: #5b84f5" .lg} __需要 `ROOT` 權限__
|
||||
|
||||
---
|
||||
|
||||
切換指令為 `sudo -i` 或 `su root`。不同系統使用的命令不同,因為部分系統沒有在初始安裝時為 ROOT 帳戶設定密碼(例如 Ubuntu)或系統預設禁止 ROOT 登入。
|
||||
請使用 `root` 帳戶執行本腳本,切換指令為 `sudo -i` 或 `su root`。不同系統使用的指令不同,因為部分系統沒有在初始安裝時為 root 帳戶設定密碼(例如 Ubuntu)或系統預設禁止 `root` 帳戶登入。
|
||||
|
||||
- :material-numeric-2:{style="color: #5b84f5" .lg} __建議使用現代化的 `SSH` 用戶端應用__
|
||||
|
||||
---
|
||||
|
||||
如果你系統命令列介面的中文顯示亂碼那麼將導致無法查看互動內容,此外部分系統 GUI 圖形介面的終端應用可能存在一些無法預料的顯示問題。部分系統會自動開啟 SSH 服務,否則請參考[開啟方法](#關於開啟-ssh-遠端登入的方法)。
|
||||
如果系統命令列介面的中文顯示亂碼,將導致無法查看互動內容,此外部分系統 GUI 圖形介面的終端應用可能存在一些無法預料的顯示問題。部分系統會自動開啟 SSH 服務,否則請參考[開啟方法](#關於開啟-ssh-遠端登入的方法)。
|
||||
|
||||
- :material-numeric-3:{style="color: #5b84f5" .lg} __如果是在新裝系統上首次執行腳本__
|
||||
|
||||
---
|
||||
|
||||
目前依賴 `curl` 指令取得腳本內容,但部分作業系統沒有預先安裝此軟體包,屆時則會報錯 `Command not found`,安裝方法詳見下方 [_關於報錯 Command not found_](#關於報錯-command-not-found)。腳本本身與 `curl` `wget` 指令無關,更不會下載任何內容。
|
||||
目前依賴 `curl` 指令取得腳本內容,但部分作業系統未預先安裝此軟體包,將會報錯 `Command not found`,安裝方法詳見下方 [_關於報錯 Command not found_](#關於報錯-command-not-found)。腳本本身與 `curl` `wget` 指令無關,不會下載任何內容。
|
||||
|
||||
- :material-numeric-4:{style="color: #5b84f5" .lg} __腳本運行期間需要互動選擇配置__
|
||||
|
||||
---
|
||||
|
||||
請透過方向鍵 ++arrow-up++++arrow-down++++arrow-left++++arrow-right++ 或 ++w++++a++++s++++d++ 控制選項並按 ++enter++ 回車鍵確認。如果發現互動異常那麼請改變終端軟體的視窗大小後重試,另外視窗不要鋪滿全螢幕。
|
||||
請透過方向鍵 ++arrow-up++++arrow-down++++arrow-left++++arrow-right++ 或 ++w++++a++++s++++d++ 控制選項並按 ++enter++ 回車鍵確認。如果發現互動異常請改變終端軟體的視窗大小後重試,避免視窗鋪滿全螢幕。
|
||||
|
||||
</div>
|
||||
|
||||
@@ -287,7 +287,7 @@ hide:
|
||||
|
||||
- #### 還原已備份的軟體源
|
||||
|
||||
!!! quote ""
|
||||
??? quote "點擊展開查看"
|
||||
|
||||
=== "Debian 系 / openKylin"
|
||||
|
||||
@@ -354,36 +354,79 @@ hide:
|
||||
|
||||
- #### 關於開啟 SSH 遠端登入的方法
|
||||
|
||||
!!! quote ""
|
||||
??? quote "點擊展開查看"
|
||||
|
||||
命令以及設定步驟僅供參考,只適配了部分常見發行版
|
||||
指令以及設定步驟僅供參考,注意靈活變通
|
||||
|
||||
- 驗證是否已安裝 `SSH` 服務
|
||||
|
||||
``` bash
|
||||
ls /etc | grep ssh
|
||||
```
|
||||
> 如果沒有這個資料夾說明系統未安裝 `SSH` 服務,你需要透過套件管理工具安裝 `openssh` 軟體包
|
||||
> 要注意的是不同系統上的軟體包名稱有所差異,可直接使用 `openssh*` 通配符進行安裝
|
||||
|
||||
- 設定允許 Root 登入
|
||||
如果沒有這個資料夾說明系統未安裝 `SSH` 服務,你需要透過套件管理工具安裝 `openssh-server` 軟體包,安裝指令如下:
|
||||
|
||||
``` bash
|
||||
=== "Debian 系 / openKylin"
|
||||
|
||||
``` bash
|
||||
apt-get install -y openssh-server
|
||||
```
|
||||
|
||||
> `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 openssh-server || yum install -y openssh-server
|
||||
```
|
||||
|
||||
> `Red Hat Enterprise Linux` `CentOS` `Rocky Linux` `AlmaLinux` `Fedora` `openEuler` `OpenCloudOS` `Anolis OS`
|
||||
|
||||
=== "openSUSE"
|
||||
|
||||
``` bash
|
||||
zypper install openssh-server
|
||||
```
|
||||
|
||||
=== "Arch Linux / Manjaro"
|
||||
|
||||
``` bash
|
||||
pacman -S openssh
|
||||
```
|
||||
|
||||
=== "Alpine Linux"
|
||||
|
||||
``` bash
|
||||
apk --no-cache add -f openssh
|
||||
```
|
||||
|
||||
=== "Gentoo"
|
||||
|
||||
``` bash
|
||||
emerge --ask --changed-use --oneshot net-misc/openssh
|
||||
```
|
||||
|
||||
> 不同系統上的軟體包名稱有所差異,如果提示找不到該軟體包可嘗試使用通配符 `openssh*` 進行安裝
|
||||
|
||||
- 設定 `SSH` 服務
|
||||
|
||||
``` { .bash .no-copy title="允許 root 帳戶登入" }
|
||||
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
|
||||
``` { .bash .no-copy title="啟用密碼認證" }
|
||||
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` 服務
|
||||
|
||||
``` bash
|
||||
ps -ef | grep -q ssh ; [ $? -eq 0 ] && systemctl restart sshd || systemctl enable --now sshd
|
||||
for ssh_svc in sshd ssh openssh; do systemctl restart "${ssh_svc}" 2>/dev/null && break ; systemctl enable --now "${ssh_svc}" 2>/dev/null && break ; done
|
||||
```
|
||||
> 不同系統上的服務名稱有所差異,如果不是 `sshd` 那就試試 `ssh`
|
||||
|
||||
!!! tip "友情提示:如果你正在使用公網伺服器,建議關閉 SSH 密碼認證方式並設定金鑰登入。"
|
||||
|
||||
- #### 關於未顯示方向鍵交互控制介面
|
||||
|
||||
@@ -545,31 +588,31 @@ $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant --help
|
||||
|
||||
| 系統名稱 | 涉及的名稱 |
|
||||
| --- | :---: |
|
||||
| <a href="https://www.debian.org" title="https://www.debian.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/debian.svg" width="16" height="16" style="vertical-align: -0.35em"></a> **Debian** | `debian` `debian-archive` |
|
||||
| <a href="https://ubuntu.com" title="https://ubuntu.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/ubuntu.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **Ubuntu** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.kali.org" title="https://www.kali.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/kali-linux.png" width="16" height="16"></a> **Kali Linux** | `kali` |
|
||||
| <a href="https://linuxmint.com" title="https://linuxmint.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/linux-mint.ico" width="16" height="16" style="vertical-align: -0.2em"></a> **Linux Mint** | `linuxmint` `ubuntu` `ubuntu-ports` `debian` |
|
||||
| <a href="https://www.deepin.org" title="https://www.deepin.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/deepin.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Deepin** | `deepin` |
|
||||
| <a href="https://zorin.com/os" title="https://zorin.com/os" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/zorin-os.png" width="16" height="16" style="vertical-align: -0.15em"></a> **Zorin OS** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.armbian.com" title="https://www.armbian.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/armbian.png" width="16" height="16" style="vertical-align: -0.2em"></a> **Armbian** | `armbian` |
|
||||
| <a href="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" title="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/proxmox.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Proxmox VE** | `proxmox` |
|
||||
| <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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" rel="noopener noreferrer"><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.openeuler.org/zh" title="https://www.openeuler.org/zh" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openeuler.ico" width="16" height="16" style="vertical-align: -0.2em"></a> **openEuler** | `openeuler` |
|
||||
| <a href="https://www.opencloudos.org" title="https://www.opencloudos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opencloudos.png" width="16" height="16" style="vertical-align: -0.25em"></a> **OpenCloudOS** | `opencloudos` |
|
||||
| <a href="https://www.openkylin.top" title="https://www.openkylin.top" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openkylin.ico" width="16" height="16" style="vertical-align: -0.25em"></a> **openKylin** | `openkylin` |
|
||||
| <a href="https://openanolis.cn" title="https://openanolis.cn" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/anolis.png" width="16" height="16" style="vertical-align: -0.1em"></a> **Anolis OS** | `anolis` |
|
||||
| <a href="https://www.opensuse.org" title="https://www.opensuse.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opensuse.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **openSUSE** | `opensuse` |
|
||||
| <a href="https://archlinux.org" title="https://archlinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/arch-linux.ico" width="16" height="16" style="vertical-align: -0.15em"></a> **Arch Linux** | `archlinux` `archlinuxarm` |
|
||||
| <a href="https://manjaro.org" title="https://manjaro.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/manjaro.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Manjaro** | `manjaro` |
|
||||
| <a href="https://www.alpinelinux.org" title="https://www.alpinelinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/alpine.png" width="16" height="16" style="vertical-align: -0.15em"></a> **Alpine Linux** | `alpine` |
|
||||
| <a href="https://www.gentoo.org" title="https://www.gentoo.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/gentoo.svg" width="16" height="16" style="vertical-align: -0.2em"></a> **Gentoo** | `gentoo` `gentoo-portage` |
|
||||
| <a href="https://nixos.org" title="https://nixos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/nixos.svg" width="16" height="16" style="vertical-align: -0.15em"></a> **NixOS** | `nix-channels` |
|
||||
| <a href="https://www.debian.org" title="https://www.debian.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/debian.svg" alt="Debian" width="16" height="16" style="vertical-align: -0.35em"></a> **Debian** | `debian` `debian-archive` |
|
||||
| <a href="https://ubuntu.com" title="https://ubuntu.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/ubuntu.svg" alt="Ubuntu" width="16" height="16" style="vertical-align: -0.15em"></a> **Ubuntu** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.kali.org" title="https://www.kali.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/kali-linux.png" alt="Kali Linux" width="16" height="16"></a> **Kali Linux** | `kali` |
|
||||
| <a href="https://linuxmint.com" title="https://linuxmint.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/linux-mint.svg" alt="Linux Mint" width="16" height="16" style="vertical-align: -0.2em"></a> **Linux Mint** | `linuxmint` `ubuntu` `ubuntu-ports` `debian` |
|
||||
| <a href="https://www.deepin.org" title="https://www.deepin.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/deepin.png" alt="Deepin" width="16" height="16" style="vertical-align: -0.2em"></a> **Deepin** | `deepin` |
|
||||
| <a href="https://zorin.com/os" title="https://zorin.com/os" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/zorin-os.png" alt="Zorin OS" width="16" height="16" style="vertical-align: -0.15em"></a> **Zorin OS** | `ubuntu` `ubuntu-ports` |
|
||||
| <a href="https://www.armbian.com" title="https://www.armbian.com" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/armbian.png" alt="Armbian" width="16" height="16" style="vertical-align: -0.2em"></a> **Armbian** | `armbian` |
|
||||
| <a href="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" title="https://www.proxmox.com/en/products/proxmox-virtual-environment/overview" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/proxmox.svg" alt="Proxmox VE" width="16" height="16" style="vertical-align: -0.2em"></a> **Proxmox VE** | `proxmox` |
|
||||
| <a href="https://www.raspberrypi.com/software" title="https://www.raspberrypi.com/software" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/raspberry-pi.png" alt="Raspberry Pi OS" 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" rel="noopener noreferrer"><img src="/assets/images/icon/redhat.svg" alt="Red Hat Enterprise Linux" 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" rel="noopener noreferrer"><img src="/assets/images/icon/fedora.ico" alt="Fedora" 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" rel="noopener noreferrer"><img src="/assets/images/icon/centos.svg" alt="CentOS" 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" rel="noopener noreferrer"><img src="/assets/images/icon/rocky-linux.svg" alt="Rocky Linux" width="16" height="16" style="vertical-align: -0.2em"></a> **Rocky Linux** | `rocky` |
|
||||
| <a href="https://almalinux.org" title="https://almalinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/almalinux.svg" alt="AlmaLinux" 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" rel="noopener noreferrer"><img src="/assets/images/icon/oracle-linux.png" alt="Oracle Linux" width="16" height="16" style="vertical-align: -0.25em"></a> **Oracle Linux** | `centos-stream` |
|
||||
| <a href="https://www.openeuler.org" title="https://www.openeuler.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openeuler.ico" alt="openEuler" width="16" height="16" style="vertical-align: -0.2em"></a> **openEuler** | `openeuler` |
|
||||
| <a href="https://www.opencloudos.org" title="https://www.opencloudos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opencloudos.png" alt="OpenCloudOS" width="16" height="16" style="vertical-align: -0.25em"></a> **OpenCloudOS** | `opencloudos` |
|
||||
| <a href="https://www.openkylin.top" title="https://www.openkylin.top" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/openkylin.ico" alt="openKylin" width="16" height="16" style="vertical-align: -0.25em"></a> **openKylin** | `openkylin` |
|
||||
| <a href="https://openanolis.cn" title="https://openanolis.cn" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/anolis.png" alt="Anolis OS" width="16" height="16" style="vertical-align: -0.1em"></a> **Anolis OS** | `anolis` |
|
||||
| <a href="https://www.opensuse.org" title="https://www.opensuse.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/opensuse.svg" alt="openSUSE" width="16" height="16" style="vertical-align: -0.15em"></a> **openSUSE** | `opensuse` |
|
||||
| <a href="https://archlinux.org" title="https://archlinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/arch-linux.ico" alt="Arch Linux" width="16" height="16" style="vertical-align: -0.15em"></a> **Arch Linux** | `archlinux` `archlinuxarm` |
|
||||
| <a href="https://manjaro.org" title="https://manjaro.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/manjaro.svg" alt="Manjaro" width="16" height="16" style="vertical-align: -0.2em"></a> **Manjaro** | `manjaro` |
|
||||
| <a href="https://www.alpinelinux.org" title="https://www.alpinelinux.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/alpine.png" alt="Alpine Linux" width="16" height="16" style="vertical-align: -0.15em"></a> **Alpine Linux** | `alpine` |
|
||||
| <a href="https://www.gentoo.org" title="https://www.gentoo.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/gentoo.svg" alt="Gentoo" width="16" height="16" style="vertical-align: -0.2em"></a> **Gentoo** | `gentoo` `gentoo-portage` |
|
||||
| <a href="https://nixos.org" title="https://nixos.org" target="_blank" rel="noopener noreferrer"><img src="/assets/images/icon/nixos.svg" alt="NixOS" width="16" height="16" style="vertical-align: -0.15em"></a> **NixOS** | `nix-channels` |
|
||||
|
||||
請看下面的例子
|
||||
|
||||
|
||||
Reference in New Issue
Block a user