腾讯蓝鲸 cmdb 源码编译

 

腾讯蓝鲸 cmdb 源码编译环境依赖

环境包参考:

  1. golang>= 1.8
  2. python>= 2.7.5
  3. Node.JS>= 4.0.0(编译过程中需要可以连公网下载依赖包)

Python 环境

  1. wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
  2. tar -xf Python-2.7.13.tgz mv Python-2.7.13 /usr/local/python
  3. cd /usr/local/python/

编译

  1. ./configure --prefix=/usr/local/python/
  2. make &&make install
  3. ln -s /usr/local/python/bin/python2.7 /usr/bin/python

GO 环境

  1. wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz --no-check-certificate
  2. tar -xf go1.8.3.Linux-amd64.tar.gz -C /usr/local/

1, 编辑环境变量

  1. vi /etc/profile
  2. export PATH=$PATH:/usr/local/go/bin
  3. export GOROOT=/usr/local/go
  4. source /etc/profile

2, 检测版本

go version

Node.JS 环境

  1. https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz
  2. tar -xf node-v10.9.0-Linux-x64.tar.xz -C /usr/local
  3. ln -s /usr/local/node/bin/NPM /usr/local/bin/
  4. ln -s /usr/local/node/bin/node /usr/local/bin/

cnpm 安装 (NPM 安装 cnpm )

1,NPM 安装 cnpm

  1. NPM install -g cnpm --registry=https://registry.npm.taobao.org
  2. ln -s /usr/local/node/bin/cnpm /usr/local/bin/

2, 安装 bower

  1. NPM install bower -g
  2. ln -s /usr/local/node/bin/bower /usr/local/bin/

3, 检测查看

ls /usr/local/node/bin

创建 GOPATH 编译工作目录

1, 创建工作编译根目录

mkdir -p /opt/work

2, 设置 GOPATH 地址

export GOPATH=/opt/work

3, 为 GOPATH 新建源代码存放路径

mkdir -p $GOPATH/src

编译测试:

方式一:

  1. cd $GOPATH/src
  2. Git clone https://github.com/Tencent/bk-cmdb configcenter

GOPATH 是使用 Golang 编写项目的根目录,

方式二:

也可以直接下载 3.5.20 源码包

  1. wget https://codeload.github.com/Tencent/bk-cmdb/tar.gz/release-v3.5.20
  2. tar -xf bk-cmdb-release-v3.5.20.tar.gz -C /opt/work/src
  3. mv bk-cmdb configcenter

编译示例:

1, 进入源码根目录进行编译:

cd $GOPATH/src/configcenter/src

2, 编译 (推荐使用 NPM 镜像 cnpm 进行前端编译)

make NPM=cnpm

3, 打包

make package

4, 归档包默认存放位置

$GOPATH/src/configcenter/src/bin/pub/cmdb.

来源: http://www.bubuko.com/infodetail-3328587.html

猜你喜欢

转载自www.cnblogs.com/b02330224/p/12932514.html
今日推荐