go环境及bee工具安装
一、go环境安装
-
1.解压go安装包:tar -xvf go1.11.1.linux-amd64.tar.gz -C /usr/local/
- 2.设置go环境变量
export GOROOT=/usr/local/go
export GOPATH=/app/apps
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GOBIN:$GOPATH/bin
- 3 go环境验证
go version
go version go1.11.1 linux/amd64
二、bee工具安装
- 第一种方式 go get github.com/beego/bee 会把编译好的bee可执行文件放到$GOPATH/bin,所以需要提前设置好PATH环境变量
- 第二种方式 手动上传并编译bee
- 打开github网页,克隆并下载bee源码
- 上传bee源码到/app/apps/src/github.com/beego/
- cd /app/apps/src/github.com/beego/;gu build
- 将可执行文件bee 转移到$GOPATH/bin
- 执行 bee测试安装是否成功
-
bee环境验证
bee version
______
| ___ \
| |_/ / ___ ___
| ___ \ / _ \ / _ \
| |_/ /| __/| __/
\____/ \___| \___| v1.10.0
?..? Beego : Beego is not installed. Please do consider installing it first: https://github.com/astaxie/beego
?..? GoVersion : go1.11.1
?..? GOOS : linux
?..? GOARCH : amd64
?..? NumCPU : 4
?..? GOPATH : /app/apps
?..? GOROOT : /usr/local/go
?..? Compiler : gc
?..? Date : Wednesday, 5 Dec 2018
三、新建一个bee工程
]# bee new webad
______
| ___ \
| |_/ / ___ ___
| ___ \ / _ \ / _ \
| |_/ /| __/| __/
\____/ \___| \___| v1.10.0
2018/12/05 11:02:27 INFO ??0001 Creating application...
create /app/apps/src/webad/
create /app/apps/src/webad/conf/
create /app/apps/src/webad/controllers/
create /app/apps/src/webad/models/
create /app/apps/src/webad/routers/
create /app/apps/src/webad/tests/
create /app/apps/src/webad/static/
create /app/apps/src/webad/static/js/
create /app/apps/src/webad/static/css/
create /app/apps/src/webad/static/img/
create /app/apps/src/webad/views/
create /app/apps/src/webad/conf/app.conf
create /app/apps/src/webad/controllers/default.go
create /app/apps/src/webad/views/index.tpl
create /app/apps/src/webad/routers/router.go
create /app/apps/src/webad/tests/default_test.go
create /app/apps/src/webad/main.go
2018/12/05 11:02:27 SUCCESS ??0002 New application successfully created!
四、下载beego并运行beego
- 访问页面
