1、Golang的官网下载。
https://go.dev/
2、go语言中文网
https://studygolang.com/dl
二、安装
使用wget 下载安装包
wget -c https://go.dev/dl/go1.17.5.linux-amd64.tar.gz
┌──(root💀kali)-[~]
└─# wget -c https://go.dev/dl/go1.17.5.linux-amd64.tar.gz
--2022-01-02 12:24:07-- https://go.dev/dl/go1.17.5.linux-amd64.tar.gz
Resolving go.dev (go.dev)... 216.239.32.21, 216.239.34.21, 216.239.36.21, ...
Connecting to go.dev (go.dev)|216.239.32.21|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://dl.google.com/go/go1.17.5.linux-amd64.tar.gz [following]
--2022-01-02 12:24:07-- https://dl.google.com/go/go1.17.5.linux-amd64.tar.gz
Resolving dl.google.com (dl.google.com)... 203.208.50.65
Connecting to dl.google.com (dl.google.com)|203.208.50.65|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 134808667 (129M) [application/x-gzip]
Saving to: ‘go1.17.5.linux-amd64.tar.gz’
go1.17.5.linu 100% 128.56M 12.4MB/s in 10s
2022-01-02 12:24:18 (12.9 MB/s) - ‘go1.17.5.linux-amd64.tar.gz’ saved [134808667/134808667]
下载完后,解压到 /usr/local目录下
tar -C /usr/local -xzf go1.17.5.linux-amd64.tar.gz
配置环境
vim打开文件.profile
vim ~/.profile
在内容末加上export PATH=$PATH:/usr/local/go/bin
┌──(root💀kali)-[~]
└─# cat ~/.profile
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
mesg n || true
export PATH=$PATH:/usr/local/go/bin
使环境变量立即生效
┌──(root💀kali)-[~]
└─# source ~/.profile
测试
go -version
三、使用
编译
go build test.go
指定输出文件
go build -o mygameserver
修改权限命令
chmod 777 程序名称
后台运行的命令
nohup ./程序名 &
不输出错误信息
nohup ./程序名 >/dev/null 2>&1 &
如果要关闭程序,可以使用命令”ps” 查看后台程序的pid,然后使用“kill 程序pid”命令,关闭程序比如程序名为test,可以用如下命令查询
ps aux|grep test
参考链接:
渗透测试kali下安装go环境 - Adminxe - 博客园
kali下安装go环境_Soda_199的博客-CSDN博客_kali安装go
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)