mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-08 03:34:13 +08:00
7.8 KiB
7.8 KiB
icon |
---|
material/package |
包管理器
:material-tram: 仓库安装
=== ":material-debian: Debian / APT"
```bash
sudo mkdir -p /etc/apt/keyrings &&
sudo curl -fsSL https://sing-box.app/gpg.key -o /etc/apt/keyrings/sagernet.asc &&
sudo chmod a+r /etc/apt/keyrings/sagernet.asc &&
echo '
Types: deb
URIs: https://deb.sagernet.org/
Suites: *
Components: *
Enabled: yes
Signed-By: /etc/apt/keyrings/sagernet.asc
' | sudo tee /etc/apt/sources.list.d/sagernet.sources &&
sudo apt-get update &&
sudo apt-get install sing-box # or sing-box-beta
```
=== ":material-redhat: Redhat / DNF 5"
```bash
sudo dnf config-manager addrepo --from-repofile=https://sing-box.app/sing-box.repo &&
sudo dnf install sing-box # or sing-box-beta
```
=== ":material-redhat: Redhat / DNF 4"
```bash
sudo dnf config-manager --add-repo https://sing-box.app/sing-box.repo &&
sudo dnf -y install dnf-plugins-core &&
sudo dnf install sing-box # or sing-box-beta
```
:material-download-box: 手动安装
该脚本从 GitHub 发布中下载并安装最新的软件包,适用于基于 deb 或 rpm 的 Linux 发行版、ArchLinux 和 OpenWrt。
curl -fsSL https://sing-box.app/install.sh | sh
或最新测试版:
curl -fsSL https://sing-box.app/install.sh | sh -s -- --beta
或指定版本:
curl -fsSL https://sing-box.app/install.sh | sh -s -- --version <version>
:material-book-lock-open: 托管安装
=== ":material-linux: Linux"
| 类型 | 平台 | 命令 | 链接 |
|----------|---------------|------------------------------|---------------------------------------------------------------------------------------------------------------|
| AUR | Arch Linux | `? -S sing-box` | [][aur] |
| nixpkgs | NixOS | `nix-env -iA nixos.sing-box` | [][nixpkgs] |
| Homebrew | macOS / Linux | `brew install sing-box` | [][brew] |
| APK | Alpine | `apk add sing-box` | [][alpine] |
| DEB | AOSC | `apt install sing-box` | [][aosc] |
=== ":material-apple: macOS"
| 类型 | 平台 | 命令 | 链接 |
|----------|-------|-------------------------|------------------------------------------------------------------------------------------------|
| Homebrew | macOS | `brew install sing-box` | [][brew] |
=== ":material-microsoft-windows: Windows"
| 类型 | 平台 | 命令 | 链接 |
|------------|---------|---------------------------|-----------------------------------------------------------------------------------------------------|
| Scoop | Windows | `scoop install sing-box` | [][scoop] |
| Chocolatey | Windows | `choco install sing-box` | [][choco] |
| winget | Windows | `winget install sing-box` | [][winget] |
=== ":material-android: Android"
| 类型 | 平台 | 命令 | 链接 |
|--------|---------|--------------------|----------------------------------------------------------------------------------------------|
| Termux | Android | `pkg add sing-box` | [][termux] |
=== ":material-freebsd: FreeBSD"
| 类型 | 平台 | 命令 | 链接 |
|------------|---------|------------------------|--------------------------------------------------------------------------------------------|
| FreshPorts | FreeBSD | `pkg install sing-box` | [][ports] |
:material-alert: 存在问题的源
类型 | 平台 | 链接 | 原因 |
---|---|---|---|
DEB | AOSC | aosc-os-abbs | 存在问题的构建标志列表修改 |
Homebrew | / | homebrew-core | 存在问题的构建标志列表修改 |
Termux | Android | termux-packages | 存在问题的构建标志列表修改 |
FreshPorts | FreeBSD | FreeBSD ports | 太旧的 Go (go1.20) |
如果您是其用户,请向他们报告问题:
- 在未完全了解相关功能的情况下,请勿修改发布版本标签:启用非默认标签可能会导致性能下降;缺少默认标签可能会引起用户混淆。
- sing-box 支持使用一些较旧的 Go 版本进行编译,但不推荐使用(特别是已不再受 Go 支持的版本)。
:material-book-multiple: 服务管理
对于带有 systemd 的 Linux 系统,通常安装已经包含 sing-box 服务, 您可以使用以下命令管理服务:
行动 | 命令 |
---|---|
启用 | sudo systemctl enable sing-box |
禁用 | sudo systemctl disable sing-box |
启动 | sudo systemctl start sing-box |
停止 | sudo systemctl stop sing-box |
强行停止 | sudo systemctl kill sing-box |
重新启动 | sudo systemctl restart sing-box |
查看日志 | sudo journalctl -u sing-box --output cat -e |
实时日志 | sudo journalctl -u sing-box --output cat -f |