diff --git a/docs/examples/linux-server-installation.md b/docs/examples/linux-server-installation.md index b72a9d19..a3bdefb9 100644 --- a/docs/examples/linux-server-installation.md +++ b/docs/examples/linux-server-installation.md @@ -2,7 +2,6 @@ * Linux & Systemd * Git -* Go 1.18.5+ * C compiler environment #### Install @@ -10,6 +9,7 @@ ```shell git clone https://github.com/SagerNet/sing-box cd sing-box +./release/local/install_go.sh # skip if you have go1.19 already installed ./release/local/install.sh ``` diff --git a/docs/examples/linux-server-installation.zh.md b/docs/examples/linux-server-installation.zh.md index 176f589d..02cf402f 100644 --- a/docs/examples/linux-server-installation.zh.md +++ b/docs/examples/linux-server-installation.zh.md @@ -2,7 +2,6 @@ * Linux & Systemd * Git -* Go 1.18.5+ * C 编译器环境 #### 安装 @@ -10,10 +9,11 @@ ```shell git clone https://github.com/SagerNet/sing-box cd sing-box +./release/local/install_go.sh # 如果已安装 go1.19 则跳过 ./release/local/install.sh ``` -Edit configuration file in `/usr/local/etc/sing-box/config.json` +编辑配置文件 `/usr/local/etc/sing-box/config.json` ```shell ./release/local/enable.sh diff --git a/release/local/debug.sh b/release/local/debug.sh index dc4336c2..664d7926 100755 --- a/release/local/debug.sh +++ b/release/local/debug.sh @@ -2,6 +2,10 @@ set -e -o pipefail +if [ -d /usr/local/go ]; then + export PATH="$PATH:/usr/local/go/bin" +fi + DIR=$(dirname "$0") PROJECT=$DIR/../.. diff --git a/release/local/install.sh b/release/local/install.sh index 17db8a9d..ba590eba 100755 --- a/release/local/install.sh +++ b/release/local/install.sh @@ -2,6 +2,10 @@ set -e -o pipefail +if [ -d /usr/local/go ]; then + export PATH="$PATH:/usr/local/go/bin" +fi + DIR=$(dirname "$0") PROJECT=$DIR/../.. diff --git a/release/local/install_go.sh b/release/local/install_go.sh new file mode 100755 index 00000000..8138597d --- /dev/null +++ b/release/local/install_go.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -e -o pipefail +curl -o go.tar.gz https://go.dev/dl/go1.19.linux-amd64.tar.gz +sudo rm -rf /usr/local/go +sudo tar -C /usr/local -xzf go.tar.gz +rm go.tar.gz \ No newline at end of file diff --git a/release/local/reinstall.sh b/release/local/reinstall.sh index 9f6e3969..c810fcf1 100755 --- a/release/local/reinstall.sh +++ b/release/local/reinstall.sh @@ -2,6 +2,10 @@ set -e -o pipefail +if [ -d /usr/local/go ]; then + export PATH="$PATH:/usr/local/go/bin" +fi + DIR=$(dirname "$0") PROJECT=$DIR/../..