linux 安装beego

0 下载git

yum install git

1.下载go

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

2.解压go

tar zxvf go1.13.7.linux-amd64.tar.gz

3 将/usr/local/go/bin添加到环境变量中

vim /etc/profile
# 在最后一行添加
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
source /etc/profile

4. 配置 go源

打开你的终端并执行

$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.cn

或者

$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
$ source ~/.profile

5.vim ~/.bashrc

export GOPATH=/root/workspace/beego/ # beego的项目路径(工作目录)
export GOROOT=/usr/local/go # go的安装路径

source ~/.bashrc

 

6.用go get安装 

go get github.com/astaxie/beego

go get github.com/beego/bee


7.如果还是 bee bash: bee: command not found 请你把GOPATH/bin下的bee.exe 拷贝到 GOROOT/bin里面,也就是你的go语言环境变量的bin里面,然后运行 bee

 

8. 创建项目

bee new demo1

9.go: cannot find main module; see 'go help modules' 2022/07/26 19:54:17 ERROR    ▶ 0003 Failed to bui

这个错误 在 项目目录下 执行  

go mod init

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章