This is a creation in Article, where the information may have evolved or changed.
Grafana requires the following environments for normal development:
Install node. js
Download the latest version of the MSI installation package from the node. JS website based on your development environment
Follow the steps to complete the installation, basically no pits, skip.
Installing the Golang development environment
Download the installation package from Golang official website
Next, using the default installation, the installation will automatically create a new environment variable named Goroot in the system environment variable.
The value of this variable is the same as the installation path of your go.
The go code must be in the working space. A workspace is a directory that contains three subdirectories:
src
Inside each subdirectory, is a package. Baone is the go source file
pkg
The target file of the package that is generated after compilation
bin
The resulting executable file.
After installation we need to manually add an environment variable named Gopath, which is the path to the workspace.
You can create a new folder as a workspace for go, for example, I've created a new D:\code\go
folder as a working space.
Then add the Bin folder under the Go workspace to the system environment variable
Enter in CMD or PowerShell $ go version
and a similar prompt should appear if the installation succeeds.
The Go compilation environment is now installed
Installing GCC
GCC is required for go compiling Grafana
Installing GCC under windows, we recommend using the Win-builds tool
Run after the download is complete, wait for the following window to appear
Here choose native Windows and x86_64, and then select or create a new one 空文件夹
as the installation directory, I have a random one here D:\wingw-w64
.
Directly click on the upper right corner of process to start the installation. (This will install some additional tools that can be removed as needed)
After installation, create a new entry in the path of the system variable, with the value of the installation directory you selected in the Win-buildsbin
For example I have just installed D:\wingw-w64
under, then the system variable path should beD:\wingw-w64\bin
Enter in CMD or PowerShell $ gcc -v
and a similar prompt should appear if the installation succeeds.
Now that GCC is installed, the configuration is complete
Configure Grafana
Run the following command directly in CMD or PowerShell (you will need to install git if you do not have Git installed, please Baidu yourself)
$ go get github.com/grafana/grafana
A similar prompt appears for Get success
Next, create the following directory in your Go workspacesrc/golang.org/x/
For example, mine is.D:\code\go\src\golang.org\x
And then run$ git clone git@github.com:golang/sync.git --depth 1
Wait for git clone to complete
Run again $ go get github.com/Unknwon/bra
, (this package does not prompt, after the command is completed to the corresponding directory to confirm the file)
Enter the bra directory ($GOPATH \src\github.com\unknwon\bra) and run the following command to compile the bra
$ go run bra.go run
Go to the Grafana directory and run the following command in turn
Build back-end
$ go run build.go setup$ go run build.go build
Build Front End
$ npm install -g yarn$ yarn install --pure-lockfile$ npm run build
Start Grafana
$ bra run
Open http://localhost:3000
, with 用户名/密码 = admin/admin
login
If Grafana is working properly, the basic development environment has been built.
Grafana Development Documentation Reference