CentOS 7 and packaged at source compiler grafana
All operations are performed under administrator privileges
#su //后输入密码
1.node installation
New directory to store downloaded files I store in usr / download in:
#cd /usr
#mkdir download
Acquiring compressed node: (version> = 12 <13) may be selected to release the mirror Taobao
#wget https://npm.taobao.org/mirrors/node/v12.4.0/node-v12.4.0-linux-x64.tar.gz
unzip files
#tar vxzf node-v12.4.0-linux-x64.tar.gz
The unpacked file directory to the global links (available to / usr / local / bin in the bin and see if npm exists and points to the original file after decompression)
#ln -s /usr/download/node-v12.4.0-linux-x64/bin/ /usr/local/bin/
#ln -s /usr/download/node-v12.4.0-linux-x64/bin/npm /usr/local/bin/
Configuration environment variable
#vim /etc/profile //进入后 i 编辑 :wq 保存退出 需要管理员权限su
//在最后添加
export PATH=/usr/download/node-v12.4.0-linux-x64/bin/:$PATH
//使配置生效
#source /etc/profile
#node -v
View version
2.git installation
Should CentOS comes with yum, yum install else
#yum -y install git
3.golang installation
Get the compressed package (that I created in usr / download in)
#wget https://studygolang.com/dl/golang/go1.13.3.linux-amd64.tar.gz
Decompression
#tar -xf go1.13.3.linux-amd64.tar.gz
To /home
install the files in the directory of the new go
#mkdir -p /home/goProject
Configuration environment variable
#vim /etc/profile
//粘贴到最后
export GOROOT=/usr/download/go //go解压后的文件目录
export GOPATH=/home/guanghuiying/goProject //新建的go安装目录
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
export PATH=$PATH:$GOPATH/bin
//使配置生效
#source /etc/profile
View version
#go version
4.grafana source download
First, the need to cd to GOPATH
#cd /home/goProject
Use git to download the source code (go get github.com/grafana/grafana not get)
#git clone https://github.com/grafana/grafana
After downloading can be to / home / goProject / src view
After validate the configuration
#source /etc/profile
The compiler front end source
//前后台编译都需要在这个目录下
#cd /home/goProject/src/github.com/grafana/grafana
First, the back-end compiler
#go run build.go setup
#go run build.go build
There may pop up missing gcc plug-in, if missed, please install
#yum install gcc gcc-c++
After compilation, the in / bin / linux-amd64 directory of files to / bin
#mv
Run background
#./bin/server-grafana
Then, the compiler front-end
Download yarn
#npm install -g yarn
yarn download package
#yarn install --pure-lockfile
If the download fails:
1. No installation bzip2, resulting in some file can not be decompressed
#yum install bzip2
2.phantomjs needs of the domestic image download
#PHANTOMJS_CDNURL=http://npm.taobao.org/mirrors/phantomjs yarn install
3.node-sass needs of the domestic image download
#yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass
4. agency problem? ?
#npm config rm proxy
#npm config rm https-proxy
Start the front desk (there are requirements for system memory, 2G has not previously set to 4G)
#yarn start
After allowed to enterlocalhost:3000
6. packaged as deb, rpm
You need to install fpm
#yum -y install ruby rubygems ruby-devel
#gem sources -a http://gems.ruby-china.com/ //原 http://ruby.taobao.org/ 已停止维护
#gem sources --remove http://rubygems.org/
#gem install fpm
after that
#go run build.go build package
When finished, under dist file, executable file (deb, rpm, tar.gz) after you pack