# update packages sudo apt-get update # install python and graphite dependencies sudo apt-get install -y python python-dev python-virtualenv libevent-dev python-pip python-cairo python-django-tagging python-twisted python-memcache python-pysqlite2 # install web server sudo apt-get install -y nginx uwsgi uwsgi-plugin-python # install postgresql and dependencies sudo apt-get install -y postgresql libpq-dev python-psycopg2 # edit the file sudo vi /etc/nginx/sites-available/default # add the following server block server { listen 8080 ; access_log /var/log/nginx/example.access.log; error_log /var/log/nginx/example.error.log; location / { include uwsgi_params; uwsgi_pass 127.0.0.1:3031; } } # create a new file sudo vi /etc/uwsgi/apps-available/graphite.ini # add the following contents [uwsgi] processes = 2 socket = 127.0.0.1:3031 gid = www-data uid = www-data virtualenv = /opt/graphite chdir = /opt/graphite/conf module = wsgi:application sudo ln -s /etc/uwsgi/apps-available/graphite.ini /etc/uwsgi/apps-enabled/ # database sudo -u postgres psql CREATE USER graphite WITH PASSWORD 'password'; CREATE DATABASE graphite WITH OWNER graphite; \q # create a new user sudo adduser graphite # add user to sudoers su - root visudo # add an entry for the graphite user # User privilege specification root ALL=(ALL:ALL) ALL graphite ALL=(ALL:ALL) ALL # log in as graphite user su graphite cd /opt sudo mkdir graphite sudo chown graphite graphite sudo chgrp graphite graphite virtualenv graphite source graphite/bin/activate # install graphite and dependencies pip install carbon graphite-web whisper 'Twisted<12.0' django==1.5 simplejson psycopg2 django-tagging cd /opt/graphite/conf/ sudo mkdir examples sudo mv *.example examples sudo cp examples/storage-schemas.conf.example storage-schemas.conf sudo cp examples/storage-aggregation.conf.example storage-aggregation.conf sudo cp examples/carbon.conf.example carbon.conf sudo cp examples/graphite.wsgi.example wsgi.py # copy the local_settings.py file and edit sudo cp /opt/graphite/webapp/graphite/{local_settings.py.example,local_settings.py} sudo vi /opt/graphite/webapp/graphite/local_settings.py # uncomment the following lines SECRET_KEY = 'replace_with_string_from_any_secret_key_generator' TIME_ZONE = 'America/New_York' USE_REMOTE_USER_AUTHENTICATION = True DEBUG = True DATABASES = { 'default': { 'NAME': 'graphite', 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'USER': 'graphite', 'PASSWORD': 'password', 'HOST': '127.0.0.1', 'PORT': '' } } # type ‘yes’ when prompted to create a user sudo /opt/graphite/bin/python /opt/graphite/webapp/graphite/manage.py syncdb sudo chown -R www-data:www-data /opt/graphite/webapp/ /opt/graphite/storage/ # link sudo vi /opt/graphite/lib/python2.7/site-packages/dist-packages.pth # add this line to the file /usr/lib/python2.7/dist-packages sudo /opt/graphite/bin/python /opt/graphite/bin/carbon-cache.py start sudo service nginx restart sudo service uwsgi restart