From c08ef476dfbe1961b79d5404eafd788d7c2b1406 Mon Sep 17 00:00:00 2001 From: wangxd Date: Mon, 5 Aug 2019 16:52:38 +0800 Subject: [PATCH] add install.md --- doc/wiki-cn/install.md | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 doc/wiki-cn/install.md diff --git a/doc/wiki-cn/install.md b/doc/wiki-cn/install.md new file mode 100644 index 000000000..91b8c4655 --- /dev/null +++ b/doc/wiki-cn/install.md @@ -0,0 +1,69 @@ +# 安装 + +1.安装protoc二进制文件 + +``` +下载地址:https://github.com/google/protobuf/releases +mv bin/protoc /usr/local/bin/ +mv -r include/google /usr/local/include/ +``` + +2.安装protobuf库文件 + +``` +go get -u github.com/golang/protobuf/proto +``` + +3.安装goprotobuf插件 + +``` +go get github.com/golang/protobuf/protoc-gen-go +``` + +4.安装gogoprotobuf插件和依赖 + +``` +//gogo +go get github.com/gogo/protobuf/protoc-gen-gogo + +//gofast +go get github.com/gogo/protobuf/protoc-gen-gofast + +//依赖 +go get github.com/gogo/protobuf/proto +go get github.com/gogo/protobuf/gogoproto +``` + +5.安装框架依赖 + +``` +# grpc (或者git clone https://github.com/grpc/grpc-go 然后复制到google.golang.org/grpc) +go get -u google.golang.org/grpc + +# genproto (或者git clone https://github.com/google/go-genproto 然后复制到google.golang.org/genproto) +go get google.golang.org/genproto/... +``` + +6.安装kratos tool + +``` +go get -u github.com/bilibili/kratos/tool/kratos +cd $GOPATH/src +kratos new kratos-demo --proto +``` + +7.运行 + +``` +cd kratos-demo/cmd +go build +./cmd -conf ../configs +``` + +打开浏览器访问:[http://localhost:8000/kratos-demo/start](http://localhost:8000/kratos-demo/start),你会看到输出了`Golang 大法好 !!!` + +[kratos工具](kratos-tool.md) + +------------- + +[文档目录树](summary.md)