2015-03-10 00:12:59 +08:00
---
2015-03-10 15:51:26 +08:00
page_title: Building from source
page_description: Building from source Grafana.
page_keywords: grafana, build, contribute, documentation
2015-03-10 00:12:59 +08:00
---
2015-03-10 16:03:05 +08:00
# Building Grafana from source
2015-03-10 00:12:59 +08:00
2015-08-11 05:44:08 +08:00
This guide will help you create packages from source and get grafana up and running in
dev environment. Grafana ships with its own required backend server; also completely open-source. It's written in [Go ](http://golang.org ) and has a full [HTTP API ](/v2.1/reference/http_api/ ).
2015-03-10 00:12:59 +08:00
2015-03-10 16:03:05 +08:00
## Dependencies
2015-03-10 00:12:59 +08:00
2015-08-11 05:44:08 +08:00
- [Go 1.4 ](https://golang.org/dl/ )
- [NodeJS ](https://nodejs.org/download/ )
2015-03-10 00:12:59 +08:00
2015-03-10 16:03:05 +08:00
## Get Code
2015-08-11 05:44:08 +08:00
Create a directory for the project and set your path accordingly. Then download and install Grafana into your $GOPATH directory
2015-03-10 16:03:05 +08:00
```
2015-07-10 04:49:27 +08:00
export GOPATH=`pwd`
2015-03-10 16:03:05 +08:00
go get github.com/grafana/grafana
```
2015-03-10 00:12:59 +08:00
2015-08-11 05:44:08 +08:00
## Build the Backend
2015-03-10 16:03:05 +08:00
```
cd $GOPATH/src/github.com/grafana/grafana
go run build.go setup (only needed once to install godep)
2015-08-11 05:44:08 +08:00
$GOPATH/bin/godep restore (will pull down all golang lib dependecies in your current GOPATH)
2015-03-10 16:03:05 +08:00
go build .
```
2015-03-10 00:12:59 +08:00
2015-08-11 05:44:08 +08:00
#### Building on Windows
2015-04-19 15:44:14 +08:00
The Grafana backend includes Sqlite3 which requires GCC to compile. So in order to compile Grafana on windows you need
to install GCC. We recommend [TDM-GCC ](http://tdm-gcc.tdragon.net/download ).
2015-08-11 05:44:08 +08:00
## Build the Front-end Assets
2015-03-10 00:12:59 +08:00
2015-03-10 16:03:05 +08:00
To build less to css for the frontend you will need a recent version of of node (v0.12.0),
npm (v2.5.0) and grunt (v0.4.5). Run the following:
```
npm install
npm install -g grunt-cli
grunt
```
2015-08-11 05:44:08 +08:00
## Running Grafana Locally
You can run a local instance of Grafana by running:
2015-03-10 16:03:05 +08:00
```
2015-08-11 05:44:08 +08:00
./grafana-server
2015-03-10 16:03:05 +08:00
```
2015-08-11 05:44:08 +08:00
Open grafana in your browser (default [http://localhost:3000 ](http://localhost:3000 )) and login with user/pass = admin/admin.
## Developing for Grafana
To add features, customize your config, etc, you'll need to rebuild on source change (requires that you executed [godep restore ](#build-the-backend ), as outlined above).
2015-03-10 16:03:05 +08:00
```
2015-08-11 05:44:08 +08:00
go get github.com/Unknwon/bra
bra run
2015-03-10 16:03:05 +08:00
```
2015-08-11 05:44:08 +08:00
You'll also need to run `grunt watch` to watch for changes to the front-end.
2015-03-10 16:03:05 +08:00
2015-03-30 17:08:46 +08:00
## Creating optimized release packages
2015-06-11 13:59:57 +08:00
This step builds linux packages and requires that fpm is installed. Install fpm via `gem install fpm` .
2015-03-30 17:08:46 +08:00
```
go run build.go build package
```
2015-03-10 16:03:05 +08:00
## Dev config
Create a custom.ini in the conf directory to override default configuration options.
You only need to add the options you want to override. Config files are applied in the order of:
1. grafana.ini
2015-04-13 13:34:55 +08:00
2. custom.ini
2015-03-10 00:12:59 +08:00
## Create a pull requests
2015-08-11 05:44:08 +08:00
Please contribute to the Grafana project and submit a pull request! Build new features, write or update documentation, fix bugs and generally make Grafana even more awesome.
2015-03-10 00:12:59 +08:00
2015-08-11 05:44:08 +08:00
Before or after you create a pull request, sign the [contributor license agreement ](/project/cla.html ).
Together we can build amazing software faster.