Skip to content

Instantly share code, notes, and snippets.

  • Star 62 You must be signed in to star a gist
  • Fork 47 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bhang/2703599 to your computer and use it in GitHub Desktop.
Install Graphite and statsd on Ubuntu 12.04 LTS (Precise Pangolin)
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
# System level dependencies for Graphite
sudo apt-get install memcached python-dev python-pip sqlite3 libcairo2 \
libcairo2-dev python-cairo pkg-config
# Get latest pip
sudo pip install --upgrade pip
# Install carbon and graphite deps
cat >> /tmp/graphite_reqs.txt << EOF
sudo pip install -r /tmp/graphite_reqs.txt
# Configure carbon
cd /opt/graphite/conf/
sudo cp carbon.conf.example carbon.conf
# Create storage schema and copy it over
# Using the sample as provided in the statsd README
cat >> /tmp/storage-schemas.conf << EOF
# Schema definitions for Whisper files. Entries are scanned in order,
# and first match wins. This file is scanned for changes every 60 seconds.
# [name]
# pattern = regex
# retentions = timePerPoint:timeToStore, timePerPoint:timeToStore, ...
priority = 110
pattern = ^stats\..*
retentions = 10s:6h,1m:7d,10m:1y
sudo cp /tmp/storage-schemas.conf storage-schemas.conf
# Make sure log dir exists for webapp
sudo mkdir -p /opt/graphite/storage/log/webapp
# Copy over the local settings file and initialize database
cd /opt/graphite/webapp/graphite/
sudo cp
sudo python syncdb # Follow the prompts, creating a superuser is optional
# statsd
cd /opt && sudo git clone git://
# StatsD configuration
cat >> /tmp/localConfig.js << EOF
graphitePort: 2003
, graphiteHost: ""
, port: 8125
sudo cp /tmp/localConfig.js /opt/statsd/localConfig.js
Copy link

An possible improvement - add the --yes-flag to all apt-get-operations, so the user won't get prompted as much.

Copy link

bartek commented Sep 25, 2012

Thank you for this, this was the key to getting statsd + graphite setup.

Copy link

ghost commented Jan 10, 2013

Thank you very much for this, made my day easier :)

Copy link

dochong commented Jan 29, 2013

thank you very much.

Copy link

Awesome, thank you! Worked perfectly!

Copy link

ronikb commented Feb 18, 2013

Installed it successfully. How to start statsd and graphite?

Copy link

Just run:

sudo /opt/graphite/bin/

Copy link

urog commented Apr 29, 2013

You could also add a </dev/null at the end of the apt-add-repository command:

sudo apt-add-repository ppa:chris-lea/node.js </dev/null

Copy link

Just a heads up: when running the script above from a stock install of Ubuntu 12.04, make sure to run sudo apt-get update before sudo apt-get install python-software-properties, otherwise the latter will fail.

Also, "As of Node.js v0.10.0, the nodejs package from Chris Lea's repo includes both npm and nodejs-dev," so no need to apt-get install npm.

Copy link

Gmagella commented Jul 3, 2013

Hey! Thanks for the script... a newbie question: How can I put that in init? I want it to start with the system.

Copy link

@Gmagella use Ubuntu upstart

Copy link

agentgt commented Dec 9, 2013

Copy link

czaban commented Feb 23, 2014

ubuntu-12.04.4-server-amd64 - fresh installation:

Traceback (most recent call last):
File "", line 11, in
File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 438, in execute_manager
[... a lot of...]

ImportError: cannot import name python_2_unicode_compatible

Any suggestions?

Copy link

@czaban change /tmp/graphite_reqs.txt to be django-tagging==0.3.1

Copy link

ionutzp commented Apr 4, 2014

@czaban thanks! i had to reinstall with the django-tagging version but it worked

Copy link

So far, on Ubuntu 14.04:

  • Installed Django 1.5 (clears cannot import name python_2_unicode_compatible error)
  • sudo vim /opt/graphite/webapp/graphite/ - set the SECRET_KEY to something.

Set a database in

Error received during sudo python syncdb:

ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

Anyone know of an example of 14.04? I'm running out of time to track all the various dependencies :D

Edit: This might be the ticket - on 14.04, there appears to be an apt package.

Copy link

grekpg commented May 18, 2015

I try install on this vagrant - and have error

vagrant@precise64:/opt/graphite/webapp/graphite$ sudo python syncdb
Traceback (most recent call last):
File "", line 11, in
File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 438, in execute_manager
File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 379, in execute
File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 191, in run_from_argv
self.execute(_args, *_options.dict)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 219, in execute
File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 36, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/", line 146, in get_app_errors
File "/usr/local/lib/python2.7/dist-packages/django/db/models/", line 64, in _populate
File "/usr/local/lib/python2.7/dist-packages/django/db/models/", line 78, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/", line 35, in import_module
File "/opt/graphite/webapp/graphite/events/", line 10, in
from tagging.fields import TagField
File "/usr/local/lib/python2.7/dist-packages/tagging/", line 9, in
from .models import Tag
File "/usr/local/lib/python2.7/dist-packages/tagging/", line 6, in
from django.utils.encoding import smart_text
ImportError: cannot import name smart_text

Copy link

I got the exact same error as the commenter above. Anybody got a solution?

Trying to install on Ubuntu 14.04 X64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment