68 行
1.5 KiB
Markdown
68 行
1.5 KiB
Markdown
# singbox.sh
|
||
|
||
交互式管理脚本。下方仅记录安装与运行方式。
|
||
|
||
## 系统要求
|
||
|
||
- Linux x86_64 / ARMv7 / ARM64 / AMD64v3 / s390x
|
||
- 使用 systemd 的发行版(Debian 10+ / Ubuntu 20.04+ / CentOS 8+ / Rocky / AlmaLinux 等)
|
||
- root 权限
|
||
|
||
## 依赖安装
|
||
|
||
脚本运行依赖以下命令(多数发行版默认包含 `bash` `tar` `systemctl` `iptables` 等):
|
||
|
||
| 依赖 | 用途 |
|
||
| --- | --- |
|
||
| `curl` / `wget` | 下载与 API 调用 |
|
||
| `jq` | 解析 JSON |
|
||
| `openssl` | 生成密钥、自签证书 |
|
||
| `tar` | 解压 |
|
||
| `systemd` | 服务管理 |
|
||
| `cron` (`cronie` / `crontabs`) | 定时任务 |
|
||
|
||
### Debian / Ubuntu
|
||
|
||
```bash
|
||
apt update
|
||
apt install -y curl wget jq openssl tar cron
|
||
```
|
||
|
||
### CentOS / RHEL / Rocky / Alma
|
||
|
||
```bash
|
||
dnf install -y curl wget jq openssl tar cronie
|
||
systemctl enable --now crond
|
||
```
|
||
|
||
### Arch Linux
|
||
|
||
```bash
|
||
pacman -Sy --noconfirm curl wget jq openssl tar cronie
|
||
systemctl enable --now cronie
|
||
```
|
||
|
||
## 一键执行
|
||
|
||
```bash
|
||
bash <(curl -fsSL https://git.suhang.me/suhang/scripts/raw/branch/release/singbox/singbox.sh)
|
||
```
|
||
|
||
或使用 `wget`:
|
||
|
||
```bash
|
||
bash <(wget -qO- https://git.suhang.me/suhang/scripts/raw/branch/release/singbox/singbox.sh)
|
||
```
|
||
|
||
## 定时任务
|
||
|
||
脚本会自动写入 crontab,每周一凌晨 2 点执行 `18`(续签证书):
|
||
|
||
```cron
|
||
0 2 * * 1 /bin/bash /root/singbox.sh >> /usr/local/etc/certificate.log 2>&1
|
||
```
|
||
|
||
## 卸载
|
||
|
||
进入菜单后选择卸载选项即可移除二进制、配置目录与 systemd 服务。
|