1、下载go环境
wget https://dl.google.com/go/go1.20.1.linux-amd64.tar.gz
2、将下载的解压包解压到/usr/local目录下
tar -C /usr/local/ -zxvf go1.20.1.linux-amd64.tar.gz
#解压成功可以在/usr/local文件夹下看到go文件夹。
3、更改系统的配置文件/etc/profile,在末尾插入以下内容。
└─# vim /etc/profile export
GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
└─# source /etc/profile #使配置文件生效。
4、查看版本号
─# go version
go version go1.20.1 linux/amd64
#如果没有没有出现版本号或之前版本号,输入:cp -f $GOROOT/bin/go* /usr/bin/ #退出之后,如果go version没有出现版本号,再次输入source /etc/profile即可。
5、下载fscan git clone https://github.com/shadow1ng/fscan.git
#下载完成后进入fscan目录进行,使用root权限进行编译。
└─# cd /fscan go build -ldflags="-s -w " -trimpath
#最终结果是fscan文件夹下出现绿色的fscan可执行文件。
#👉如果执行编译时出现连接被拒绝情况,如:connection refused,执行:export GOPROXY=https://goproxy.io
#在执行go build -ldflags="-s -w " -trimpath即可。
6、全局使用
ln -s /fscan/fscan /usr/bin/fscan