/sing-box-easy

Compared with v2ray-core and clash, sing-box has more features and performed better in benchmark tests. These steps will help you install sing-box in a noob-friendly manner. There are also multiple working config.json files to help you stay anonymous. Sing-box has more features than v2ray-core and clash. Official Page -> sing-box.sagernet.org

Installing Sing-Box: The Swiss Army Knife of Proxy Services

Take a look at gzxhwq/sing-box if you prefer docker. Use our configurations in combination.

  1. Installing gcc is the first step:

sudo su
apt update && apt install -y build-essential
  1. Let's install the latest version of go (golang):

curl -fsL https://raw.githubusercontent.com/jetsung/golang-install/main/install.sh | bash
source /root/.bashrc
  1. Run the following command to install the latest dev version of sing-box:

go install -v -tags "with_acme with_ech with_quic with_utls with_v2ray_api with_clash_api with_gvisor with_lwip with_grpc with_quic with_wireguard with_ech with_utls with_gvisor with_shadowsocksr" github.com/sagernet/sing-box/cmd/sing-box@dev-next
  1. Allow a normal user to run sing-box:

cp ~/go/bin/sing-box /usr/local/bin/
  1. Next, create a sing-box directory to store assets and configurations:

mkdir /etc/sing-box/ && cd $_
  1. Download GeoIP, and GeoSite:

wget -c -P /etc/sing-box "https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db"
wget -c -P /etc/sing-box "https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db"
  1. Config.json: Select a protocol from the list below:

  1. Once you have downloaded the correct config.json file, you can now run the sing-box server:

cd /etc/sing-box && sing-box run
  1. Check the client connection:

You can now connect your client. When the connection is unsuccessful, press ctrl + c to stop the server.

Change log>disabled = false at line 3 of config.json. You can find a possible solution by starting the server again and reading the server log.

In production, logs should always be turned off. I suggest the following clients:

Android: Matsuri, Sagernet Windows: Qv2ray iPhone: FairVPN, ShadowLink

  1. Creating sing-box systemd service:

After running sing-box and successfully connecting your client, it's time to install it as a service:

cat <<EOF  > /etc/systemd/system/sing-box.service
[Unit]
Description=sing-box Service
Documentation=https://sing-box.sagernet.org/
After=network.target nss-lookup.target
Wants=network.target
[Service]
Type=simple
ExecStart=sing-box run -c /etc/sing-box/config.json
Restart=always
RestartSec=3s
RestartPreventExitStatus=23
LimitNPROC=10000
LimitNOFILE=1000000
[Install]
WantedBy=multi-user.target
EOF
  1. Starting sing-box service:

systemctl daemon-reload && systemctl enable sing-box && systemctl start sing-box
systemctl status sing-box

If you need to check the logs in service mode you can always run:

journalctl -xefu sing-box