主要参考:官方文档
1、Build(构建)
1、配置依赖环境:sudo apt-get install gcc cmake build-essential
2、安装了JDK和Apache Maven:
作用(来自官方文档):To compile and package the JDBC driver source code,
you should have a Java jdk-8 or higher and Apache Maven 2.7 or higher installed.
sudo apt-get install -y openjdk-8-jdk
sudo apt-get install -y maven
3、安装taosTool(作用:To build the taosTools on Ubuntu/Debian, the following packages need to be installed.):
sudo apt install build-essential libjansson-dev libsnappy-dev liblzma-dev libz-dev pkg-config
4、go语言环境配置:
1、下载go的源码包,我是用的是:go1.15.6.linux-amd64.tar.gz
2、解压缩在/usr/local目录下
3、配置环境变量:
sudo vim /etc/profile 进入配置文件
在文件最后添加以下内容:
export GOROOT=/usr/local/go
export GOPATH=/tufei/code/go
export GOBIN=$GOPATH/bin
export PATH=$GOPATH:$GOBIN:$GOROOT/bin:$PATH
保存退出。
4、source /etc/profile 使配置生效
5、验证查看 go 版本:go version
显示:go version go1.15.6 linux/amd64
6、终端输入:go env -w GO111MODULE=on ; go env -w GOPROXY=https://goproxy.cn.direct
作用:Note TDengine 2.3.x.0 and later use a component named 'taosAdapter' to play http daemon role by default instead of the http daemon embedded in the early version of TDengine. The taosAdapter is programmed by go language. If you pull TDengine source code to the latest from an existing codebase, please execute 'git submodule update --init --recursive' to pull taosAdapter source code.
/*
git环境配置:
1、安装:sudo apt-get install git
2、设置用户名和邮箱:
sudo git config --global user.name "username"
sudo git config --global user.email "email"
3、可使用命令查看结果:sudo git config --list
4、进入~/.ssh目录下,输入:sudo ssh-keygen -t rsa -C "xxxxxxxxx@qq.com"后一直回车
5、目录下会生成两个文件,将id_rsa.pub文件的内容复制,打开github->个人头像->setting->SSH and GPG Keys->Add SSH Key
将复制的内容粘贴进去,title题目随便取,自己能和以后的SSH Key区分开来就好。
6、测试:ssh -T git@github.com,之后直接输入yes回车,如果出现:
Hi 'username'! You've successfully authenticated, but GitHub does not provide shell access.
则代表成功!!
注:配置ssh主要是因为,HTTPS的方式太慢。
*/
7、获取TDengine源码:git clone https://github.com/taosdata/TDengine.git;cd TDengine
8、具体查看第6步:The connectors for go & Grafana and some tools have been moved to separated repositories, so you should run this command in the TDengine directory to install them:(来自官方文档)
git submodule update --init --recursive(配置ssh就是为了这里快一点)
9、Build(构建):在TDengine目录下执行 ./build.sh 脚本,等价于:
git submodule update --init --recursive
mkdir debug
cd debug
cmake .. -DBUILD_TOOLS=true
make
等待构建完成。
2、安装
1、进入TDengine目录下的debug目录,有一个Makefile文件,直接执行:sudo make install
2、sudo systemctl start taosd
3、终端直接输入 taos ,出现 taos>。成功!!