How do I install Graphite on CentOS?


What is Graphite?

Graphite is a free metrics collection and plotting tool for Linux/UNIX systems.


The Graphite suite is composed of three main components:

Carbon – this is the daemon process that listens on TCP/2003 for clients to deliver metrics to it. The metrics are stored in a Whisper database.
Diamond – client-side daemon to collect system statistics and deliver them to Carbon. Any tool written in any language can collect data and deliver it to Carbon on TCP/2003.
Graphite – the Python tool to do the actual plotting of the Whisper-stored data.


Install Python dependencies:

# mkdir -p /opt
# mkdir -p /data
# yum -y install python-pip
# yum -y install gcc
# yum -y install python-devel
# pip install carbon
# pip install whisper
# pip install graphite-web
# pip install -Iv ''
# pip install daemonize
# pip install 'Twisted<12.0'
# pip install tagging
# pip install django-tagging

Change SECRET_KEY in /opt/graphite/webapp/graphite/

SECRET_KEY = 'ReallyHardPassword'

Move /opt/graphite/storage to /data and set up a symlink:

# mkdir /data/graphite
# mv /opt/graphite/storage/ /data/graphite/
# ln -s /data/graphite/storage/ /opt/graphite/

Install Apache:

# yum -y install httpd
# chown apache:apache /opt/graphite/storage/log/webapp/
# yum -y install mod_wsgi
# yum -y install cairo
# yum -y install cairo-devel
# yum -y install pycairo
# yum -y install pycairo-devel


Configure Carbon

# cp /opt/graphite/examples/example-graphite-vhost.conf  /etc/httpd/conf.d/graphite.conf
# cp /opt/graphite/conf/carbon.conf.example /opt/graphite/conf/carbon.conf
# cp /opt/graphite/conf/storage-schemas.conf.example /opt/graphite/conf/storage-schemas.conf

Change retention policy in storage-schemas.conf. Delete the "default_1min_for_1day" section and replace it with:

priority = 100
pattern = .*
retentions = 1m:730d

Configure Graphite

# cp /opt/graphite/webapp/graphite/ /opt/graphite/webapp/graphite/
# cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi

Configure Time Zone. Set the time zone in /opt/graphite/webapp/graphite/ Add:

TIME_ZONE = 'America/Los_Angeles'

Change SECRET_KEY in /opt/graphite/webapp/graphite/ and set:


Set up the Graphite database and create an admin user

# cd /opt/graphite/
# python ./webapp/graphite/ syncdb

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'): admin
Email address:
Password: ReallyHardPassword
Password (again): ReallyHardPassword
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Make sure the webserver user owns the Graphite database:
# chown apache:apache /opt/graphite/storage/graphite.db
# chown apache:apache /opt/graphite/storage/

Set up Apache. Comment out "WSGISocketPrefix" and add "WSGISocketPrefix /var/run/httpd/wsgi" in /etc/httpd/conf.d/graphite.conf, and set ServerName:

#WSGISocketPrefix run/wsgi
WSGISocketPrefix /var/run/httpd/wsgi

<VirtualHost *:80>
        ServerName graphite


Start up Carbon and Graphite (Apache):

# /opt/graphite/bin/ start

# service httpd start

Set it up to start automatically at boot:

# cd /usr/src
# wget ''

# mv /etc/init.d/carbon
Edit /etc/init.d/carbon and change:
... to: ...
Configure for auto-start at boot:
# chmod 755 /etc/init.d/carbon
# /sbin/chkconfig httpd on
# /sbin/chkconfig --add carbon

Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Twitter
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Reddit
  • StumbleUpon


  1. i could not syncdb myself a new database. it kept complaining that module could not be loaded.
    so i poked at
    vim /usr/lib/python2.6/site-packages/django/db/backends/sqlite3/
    and edited the header to try the “new” following…

    from sqlite3 import dbapi2 as Database
    except ImportError as exc:
    from django.core.exceptions import ImproperlyConfigured
    raise ImproperlyConfigured(“Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s” % exc)

    —- apart from that, i loved the documentation and explanation.
    many thanks!

  2. I faced an issue after setting it up where the graphs didn’t get rendered, digging further it was found to be due to missing fonts. Installing bitmap-fonts fixed that problem.

    yum install bitmap-fonts

    Which installed all these packages

    bitmap-fonts-compat.noarch 0:0.3-15.el6

    Dependency Installed:
    bitmap-console-fonts.noarch 0:0.3-15.el6 bitmap-fangsongti-fonts.noarch 0:0.3-15.el6
    bitmap-fixed-fonts.noarch 0:0.3-15.el6 bitmap-lucida-typewriter-fonts.noarch 0:0.3-15.el6
    bitmap-miscfixed-fonts.noarch 0:0.3-15.el6 fontpackages-filesystem.noarch 0:1.41-1.1.el6

    Thanks again! :)

  3. Great article! Many thanks!

    Since I used a minimal CentOS installation, I had to install the bitmap-fonts.
    Also, I had to configure the database name in /opt/graphite/webapp/graphite/ — would run into a database locked exception otherwise.

    Cheers — Robin

Leave a Reply

Your email address will not be published. Required fields are marked *