天天看點

[FRP]源碼編譯1.下載下傳GO工具2.設定環境變量3.檢視環境變量4.設定代理5.下載下傳源碼6.編譯源碼

1.下載下傳GO工具

wget https://dl.google.com/go/go1.16.linux-amd64.tar.gz

2.設定環境變量

sudo vim /etc/profile
export GOROOT=/usr/local/go
export GOPATH=${GOROOT}/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:${GOROOT}/bin:${GOBIN}
source /etc/profile  
           

3.檢視環境變量

GO111MODULE=""
GOARCH="amd64"
GOBIN="/usr/local/go/go/bin"
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/usr/local/go/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/local/go/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/usr/local/msavskit/extern/src/frp-0.36.2/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build106672214=/tmp/go-build -gno-record-gcc-switches"
           

4.設定代理

若不設定,下載下傳依賴包會因為網絡連接配接問題報錯

go env -w GOPROXY=https://goproxy.cn

5.下載下傳源碼

git clone github.com/fatedier/frp

6.編譯源碼

make -f Makefile.cross-compiles 或者 make

frp