From 4bc811fa8b5fde5f020f4b56a66cee686a7a0e79 Mon Sep 17 00:00:00 2001 From: starry <115192496+sky22333@users.noreply.github.com> Date: Sun, 20 Jul 2025 18:23:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 35 ++---------- dev/README.md | 18 +++++- dev/root.sh | 51 +++++++++++++++++ dev/vps.md | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++ web/README.md | 12 ++++ 5 files changed, 239 insertions(+), 32 deletions(-) create mode 100644 dev/root.sh create mode 100644 dev/vps.md diff --git a/README.md b/README.md index ab0cb26..5386793 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +### 各种自用脚本 + - [Github文件加速](https://yishijie.gitlab.io/ziyuan/) --- @@ -10,35 +12,6 @@ bash <(curl -sSL https://github.com/sky22333/shell/raw/main/dev/mirrors.sh) ``` bash <(curl -sSL https://github.com/sky22333/shell/raw/main/dev/mirrors.sh) --use-official-source true ``` +--- -- 一键安装Docker和配置镜像地址 -``` -bash <(curl -sSL https://github.com/sky22333/shell/raw/main/dev/docker.sh) -``` - - -- 一键自动部署异次元发卡 -> 适用于`Debian 11+` `Ubuntu 18.04+`系统 基于`Caddy` `php` `mariadb`环境 -``` -bash <(curl -sSL https://github.com/sky22333/shell/raw/main/web/acgfaka.sh) -``` - -- 一键自动安装WordPress -> 适用于`Debian 11+` `Ubuntu 18.04+`系统 基于`Caddy` `php` `mariadb`环境 -``` -bash <(curl -sSL https://github.com/sky22333/shell/raw/main/web/wp.sh) -``` - - -- acme.sh 证书一键申请脚本 - -``` -bash <(curl -sSL https://github.com/sky22333/shell/raw/main/dev/acme.sh) -``` - - -- sing-box一键脚本(多协议) -``` -bash <(curl -sSL https://cdn.jsdelivr.net/gh/admin8800/sing-box@main/install.sh) -``` -> **使用`sb`命令查看管理菜单** +- 更多脚本查看子目录 \ No newline at end of file diff --git a/dev/README.md b/dev/README.md index 42e5820..618790c 100644 --- a/dev/README.md +++ b/dev/README.md @@ -1,7 +1,12 @@ -### 一键安装ansible +#### 一键安装ansible 见 [ansible.md](./ansible.md) + +#### 一键重装系统 + +见 [vps.md](./vps.md) + --- ### 常用运维脚本 @@ -53,3 +58,14 @@ bash <(curl -sSL https://github.com/sky22333/shell/raw/main/dev/cf-tunnel.sh) ``` iwr -useb https://ghproxy.net/https://raw.githubusercontent.com/sky22333/shell/main/dev/cf-setup.ps1 | iex ``` + +- 一键修改root密码: +``` +bash <(curl -sSL https://github.com/sky22333/shell/raw/main/dev/root.sh) +``` +使用cdn链接 +``` +bash <(curl -sSL https://cdn.jsdelivr.net/gh/sky22333/shell@main/dev/root.sh) +``` +> 部分机器修改不生效,请打开查找`/etc/ssh/sshd_config.d/xxxx.conf`类似文件 +> 打开文件查找`PasswordAuthentication no`此代码将其注释,然后重启SSH服务。 diff --git a/dev/root.sh b/dev/root.sh new file mode 100644 index 0000000..f2d2ec7 --- /dev/null +++ b/dev/root.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +red() { + echo -e "\033[31m\033[01m$1\033[0m" +} + +green() { + echo -e "\033[32m\033[01m$1\033[0m" +} + +yellow() { + echo -e "\033[33m\033[01m$1\033[0m" +} + +# 检测是否为 root 用户 +if [ "$(id -u)" != "0" ]; then + red "错误:您必须以 root 用户执行此脚本!请执行 sudo -i 后再运行此脚本!" + exit 1 +fi + +hostnamectl set-hostname localhost + +# 读取用户输入的 SSH 端口,如果未输入则使用默认值 22 +read -p "输入设置的SSH端口(默认22):" sshport +sshport=${sshport:-22} + +# 读取用户输入的 root 密码 +read -p "输入设置的root密码:" password +while [[ -z $password ]]; do + red "密码未设置,请输入设置的root密码:" + read -p "输入设置的root密码:" password +done + +# 更新 root 密码 +echo root:$password | chpasswd + +# 更新 SSH 配置 +sed -i "s/^#\?Port .*/Port $sshport/" /etc/ssh/sshd_config +sed -i "s/^#\?PermitRootLogin .*/PermitRootLogin yes/" /etc/ssh/sshd_config +sed -i "s/^#\?PasswordAuthentication .*/PasswordAuthentication yes/" /etc/ssh/sshd_config + +# 重启 SSH 服务 +service ssh restart 2>/dev/null +service sshd restart 2>/dev/null + +# 显示结果 +yellow "SSH信息设置完成" +green "用户名:root" +green "端口:$sshport" +green "密码:$password" +yellow "请记录好新密码" \ No newline at end of file diff --git a/dev/vps.md b/dev/vps.md new file mode 100644 index 0000000..dda7e2e --- /dev/null +++ b/dev/vps.md @@ -0,0 +1,155 @@ +## VPS一键DD 重装系统 + + +# Tools版本 + +[脚本原地址](https://github.com/leitbogioro/Tools) + +#### 先下载 +``` +cd /root +``` + +``` +wget --no-check-certificate -qO InstallNET.sh 'https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh' && chmod a+x InstallNET.sh +``` + +#### 国内环境下载 +``` +wget --no-check-certificate -qO InstallNET.sh 'https://gitee.com/mb9e8j2/Tools/raw/master/Linux_reinstall/InstallNET.sh' && chmod a+x InstallNET.sh +``` + +### 运行 +``` +bash InstallNET.sh -debian 11 +``` + +### 运行结尾传递参数 + +选择越新的系统越需要较高的配置 + +`-debian 7-12` Debian 7 及更高版本 + + +`-kali Rolling/dev/experimental` Kali Rolling,开发和实验,推荐Kali Rolling + +`-centos 7-9` CentOS 7 及更高版本 + +`-alpine 3.16-3.18/edge` Alpine Linux 3.16 及更高版本,轻量级系统,为了保持更新到最新版本,推荐edge + +`-almalinux/alma 8/9` AlmaLinux 8 及更高版本 + + +`-ubuntu 20.04/22.04/24.04` 不稳定,可能失败 + + +`-windows 10/11/2012/2016/2019/2022` 需4H4G以上,且不支持回退 + +`-pwd "密码"` 指定密码 + +### 默认信息 + +默认用户名 + +对于 Linux:`root` + +对于 Windows:`Administrator` + +默认密码 + +对于 Linux:`LeitboGi0ro` + +对于 Windows:`Teddysun.com` + +默认端口 + +对于Linux:`与之前的系统相同` + +对于 Windows:`3389` + + +--- + + + +# reinstall版本 + +[项目地址](https://github.com/bin456789/reinstall) + + +国外服务器: + +``` +curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh +``` + +国内服务器: + +``` +curl -O https://cnb.cool/bin456789/reinstall/-/git/raw/main/reinstall.sh +``` + +## Linux使用示例 + +1. 安装Debian12 +``` +chmod +x reinstall.sh && ./reinstall.sh debian 12 +``` +2. 设置密码 +3. 重启开始安装 +``` +reboot +``` + +### 功能 : 安装Linux + +- 用户名 `root` 默认密码 `123@@@` +- 安装最新版可不输入版本号 +- 最大化利用磁盘空间:不含 boot 分区(Fedora 例外),不含 swap 分区 +- 自动根据机器类型选择不同的优化内核,例如 `Cloud`、`HWE` 内核 +- 安装 Red Hat 时需填写 得到的 `qcow2` 镜像链接,也可以安装其它类 RHEL 系统,例如 `Alibaba Cloud Linux` 和 `TencentOS Server` +- 重装后如需修改 SSH 端口或者改成密钥登录,注意还要修改 `/etc/ssh/sshd_config.d/` 里面的文件 + +```bash +bash reinstall.sh anolis 7|8|23 + opencloudos 8|9|23 + rocky 8|9 + redhat 8|9 --img="http://xxx.com/xxx.qcow2" + oracle 8|9 + almalinux 8|9 + centos 9|10 + fedora 40|41 + nixos 24.11 + debian 9|10|11|12 + opensuse 15.6|tumbleweed + alpine 3.18|3.19|3.20|3.21 + openeuler 20.03|22.03|24.03|24.09 + ubuntu 16.04|18.04|20.04|22.04|24.04|24.10 [--minimal] + kali + arch + gentoo + aosc + fnos +``` + +#### 可选参数 + +- `--password PASSWORD` 设置密码 +- `--ssh-key KEY` 设置 SSH 登录公钥,支持以下格式。当使用公钥时,密码为空 + - `--ssh-key "ssh-rsa ..."` + - `--ssh-key "ssh-ed25519 ..."` + - `--ssh-key "ecdsa-sha2-nistp256/384/521 ..."` + - `--ssh-key http://path/to/public_key` + - `--ssh-key github:your_username` + - `--ssh-key gitlab:your_username` + - `--ssh-key /path/to/public_key` + - `--ssh-key C:\path\to\public_key` +- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志用,也作用于新系统) +- `--web-port PORT` 修改 Web 端口(安装期间观察日志用) +- `--hold 2` 安装结束后不重启,此时可以 SSH 登录修改系统内容,系统挂载在 `/os` (此功能不支持 Debian/Kali) + +> [!TIP] +> 安装 Debian/Kali 时,x86 可通过后台 VNC 查看安装进度,ARM 可通过串行控制台查看安装进度。 +> +> 安装其它系统时,可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。 +>
即使安装过程出错,也能通过 SSH 运行 `/trans.sh alpine` 安装到 Alpine。 \ No newline at end of file diff --git a/web/README.md b/web/README.md index f48a5b7..57e18d9 100644 --- a/web/README.md +++ b/web/README.md @@ -1,3 +1,15 @@ +- 一键自动部署异次元发卡 +> 适用于`Debian 11+` `Ubuntu 18.04+`系统 基于`Caddy` `php` `mariadb`环境 +``` +bash <(curl -sSL https://github.com/sky22333/shell/raw/main/web/acgfaka.sh) +``` + +- 一键自动安装WordPress +> 适用于`Debian 11+` `Ubuntu 18.04+`系统 基于`Caddy` `php` `mariadb`环境 +``` +bash <(curl -sSL https://github.com/sky22333/shell/raw/main/web/wp.sh) +``` + ### 完全卸载删除站点及环境 - 删除站点文件 ```