github.com/sagernet/sing-box@v1.9.0-rc.20/docs/installation/package-manager.zh.md (about) 1 --- 2 icon: material/package 3 --- 4 5 # 包管理器 6 7 ## :material-tram: 仓库安装 8 9 === ":material-debian: Debian / APT" 10 11 ```bash 12 sudo curl -fsSL https://sing-box.app/gpg.key -o /etc/apt/keyrings/sagernet.asc 13 sudo chmod a+r /etc/apt/keyrings/sagernet.asc 14 echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/sagernet.asc] https://deb.sagernet.org/ * *" | \ 15 sudo tee /etc/apt/sources.list.d/sagernet.list > /dev/null 16 sudo apt-get update 17 sudo apt-get install sing-box # or sing-box-beta 18 ``` 19 20 === ":material-redhat: Redhat / DNF" 21 22 ```bash 23 sudo dnf -y install dnf-plugins-core 24 sudo dnf config-manager --add-repo https://sing-box.app/sing-box.repo 25 sudo dnf install sing-box # or sing-box-beta 26 ``` 27 28 === ":material-redhat: CentOS / YUM" 29 30 ```bash 31 sudo yum install -y yum-utils 32 sudo yum-config-manager --add-repo https://sing-box.app/sing-box.repo 33 sudo yum install sing-box # or sing-box-beta 34 ``` 35 36 ## :material-download-box: 手动安装 37 38 === ":material-debian: Debian / DEB" 39 40 ```bash 41 bash <(curl -fsSL https://sing-box.app/deb-install.sh) 42 ``` 43 44 === ":material-redhat: Redhat / RPM" 45 46 ```bash 47 bash <(curl -fsSL https://sing-box.app/rpm-install.sh) 48 ``` 49 50 === ":simple-archlinux: Archlinux / PKG" 51 52 ```bash 53 bash <(curl -fsSL https://sing-box.app/arch-install.sh) 54 ``` 55 56 ## :material-book-lock-open: 托管安装 57 58 === ":material-linux: Linux" 59 60 | 类型 | 平台 | 链接 | 命令 | 61 |----------|---------------|------------------------------|---------------------------------------------------------------------------------------------------------------| 62 | AUR | Arch Linux | `? -S sing-box` | [![AUR package](https://repology.org/badge/version-for-repo/aur/sing-box.svg)][aur] | 63 | nixpkgs | NixOS | `nix-env -iA nixos.sing-box` | [![nixpkgs unstable package](https://repology.org/badge/version-for-repo/nix_unstable/sing-box.svg)][nixpkgs] | 64 | Homebrew | macOS / Linux | `brew install sing-box` | [![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/sing-box.svg)][brew] | 65 | APK | Alpine | `apk add sing-box` | [![Alpine Linux Edge package](https://repology.org/badge/version-for-repo/alpine_edge/sing-box.svg)][alpine] | 66 67 === ":material-apple: macOS" 68 69 | 类型 | 平台 | 链接 | 命令 | 70 |----------|-------|-------------------------|------------------------------------------------------------------------------------------------| 71 | Homebrew | macOS | `brew install sing-box` | [![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/sing-box.svg)][brew] | 72 73 === ":material-microsoft-windows: Windows" 74 75 | 类型 | 平台 | 链接 | 命令 | 76 |------------|---------|---------------------------|-----------------------------------------------------------------------------------------------------| 77 | Scoop | Windows | `scoop install sing-box` | [![Scoop package](https://repology.org/badge/version-for-repo/scoop/sing-box.svg)][scoop] | 78 | Chocolatey | Windows | `choco install sing-box` | [![Chocolatey package](https://repology.org/badge/version-for-repo/chocolatey/sing-box.svg)][choco] | 79 | winget | Windows | `winget install sing-box` | [![winget package](https://repology.org/badge/version-for-repo/winget/sing-box.svg)][winget] | 80 81 === ":material-android: Android" 82 83 | 类型 | 平台 | 链接 | 命令 | 84 |--------|---------|--------------------|----------------------------------------------------------------------------------------------| 85 | Termux | Android | `pkg add sing-box` | [![Termux package](https://repology.org/badge/version-for-repo/termux/sing-box.svg)][termux] | 86 87 === ":material-freebsd: FreeBSD" 88 89 | 类型 | 平台 | 链接 | 命令 | 90 |------------|---------|------------------------|--------------------------------------------------------------------------------------------| 91 | FreshPorts | FreeBSD | `pkg install sing-box` | [![FreeBSD port](https://repology.org/badge/version-for-repo/freebsd/sing-box.svg)][ports] | 92 93 ## :material-book-multiple: 服务管理 94 95 对于带有 [systemd][systemd] 的 Linux 系统,通常安装已经包含 sing-box 服务, 96 您可以使用以下命令管理服务: 97 98 | 行动 | 命令 | 99 |------|-----------------------------------------------| 100 | 启用 | `sudo systemctl enable sing-box` | 101 | 禁用 | `sudo systemctl disable sing-box` | 102 | 启动 | `sudo systemctl start sing-box` | 103 | 停止 | `sudo systemctl stop sing-box` | 104 | 强行停止 | `sudo systemctl kill sing-box` | 105 | 重新启动 | `sudo systemctl restart sing-box` | 106 | 查看日志 | `sudo journalctl -u sing-box --output cat -e` | 107 | 实时日志 | `sudo journalctl -u sing-box --output cat -f` | 108 109 [alpine]: https://pkgs.alpinelinux.org/packages?name=sing-box 110 111 [aur]: https://aur.archlinux.org/packages/sing-box 112 113 [nixpkgs]: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/tools/networking/sing-box/default.nix 114 115 [brew]: https://formulae.brew.sh/formula/sing-box 116 117 [choco]: https://chocolatey.org/packages/sing-box 118 119 [scoop]: https://github.com/ScoopInstaller/Main/blob/master/bucket/sing-box.json 120 121 [winget]: https://github.com/microsoft/winget-pkgs/tree/master/manifests/s/SagerNet/sing-box 122 123 [termux]: https://github.com/termux/termux-packages/tree/master/packages/sing-box 124 125 [ports]: https://www.freshports.org/net/sing-box 126 127 [systemd]: https://systemd.io/