go环境及bee工具安装

栏目: Go · 发布时间: 6年前

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

  • go get github.com/astaxie/beego或者手动下载上传(参考bee工具手动安装)
  • 运行beego
    webad]# bee run 
    ______
    | ___ \
    | |_/ /  ___   ___
    | ___ \ / _ \ / _ \
    | |_/ /|  __/|  __/
    \____/  \___| \___| v1.10.0
    2018/12/05 11:10:00 INFO     ??0001 Using 'webad' as 'appname'
    2018/12/05 11:10:00 INFO     ??0002 Initializing watcher...
    github.com/astaxie/beego/config
    github.com/astaxie/beego/utils
    github.com/astaxie/beego/vendor/gopkg.in/yaml.v2
    github.com/astaxie/beego/logs
    github.com/astaxie/beego/session
    github.com/astaxie/beego/grace
    github.com/astaxie/beego/toolbox
    github.com/astaxie/beego/vendor/golang.org/x/crypto/acme
    github.com/astaxie/beego/vendor/golang.org/x/crypto/acme/autocert
    github.com/astaxie/beego/context
    github.com/astaxie/beego/context/param
    github.com/astaxie/beego
    webad/controllers
    webad/routers
    webad
    2018/12/05 11:10:03 SUCCESS  ??0003 Built Successfully!
    2018/12/05 11:10:03 INFO     ??0004 Restarting 'webad'...
    2018/12/05 11:10:03 SUCCESS  ??0005 './webad' is running...
    2018/12/05 11:10:03.937 [I] [asm_amd64.s:1333]  http server Running on http://:6789
- 访问页面

![](http://i2.51cto.com/images/blog/201812/05/28e0ce8fe16b20be860f19b42f4c0008.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

大话设计模式

大话设计模式

程杰 / 清华大学出版社 / 2007-12-1 / 45.00元

本书通篇都是以情景对话的形式,用多个小故事或编程示例来组织讲解GOF(设计模式的经典名著——Design Patterns:Elements of Reusable Object-Oriented Software,中译本名为《设计模式——可复用面向对象软件的基础》的四位作者EIich Gamma、Richard Helm、Ralph Johnson,以及John Vlissides,这四人常被称......一起来看看 《大话设计模式》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具