[FRP]源码编译

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,linux,git,运维)