centos下go语言编译bettercap

1.设置go环境变量 vi /etc/profile

export GOROOT=/opt/go

export GOPATH=/opt/gopath

# Enable the go modules feature

export GO111MODULE=on

# Set the GOPROXY environment variable

export GOPROXY=https://mirrors.aliyun.com/goproxy/

export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

source /etc/profile后注销重新登陆生效

2.vscode安装gotests等模块

在GOPATH下安装模块,必须保证GOPATH路径有当前用户的读写权限,否则报错

可设置GOPATH=/home/用户名/gopath

3.安装libpcap,libusb

build-essential yum install make automake gcc gcc-c++ kernel-devel或

yum groupinstall "Development Tools" "Development Libraries"

libpcap yum -y install libpcap

libudev on centos and ubuntu - 龙行天下,畅通无阻 - 博客园

            yum install systemd-devel

libusb 

On CentOS7, libusb-1.0 needs the libusbx-devel yum package I believe

yum install libusbx-devel
and you will obviously need the regular libusb package as well

yum install libusb-devel

libnetfilter_queue-devel安装

yum install libnetfilter_queue-devel

 4.编译

go get github.com/bettercap/bettercap

cd $GOPATH/src/github.com/bettercap/bettercap

make build

报错 unrecognized relocation (0x2a)

go 编译出现unrecognized relocation (0x2a) in section `.text` - 知乎

sudo make install

你可能感兴趣的:(go,centos,golang,linux)