Skip to content

Instantly share code, notes, and snippets.

@stefanoric
Forked from GregMefford/setup-statsd-centos.sh
Created July 25, 2013 14:24
Show Gist options
  • Save stefanoric/6080186 to your computer and use it in GitHub Desktop.
Save stefanoric/6080186 to your computer and use it in GitHub Desktop.
# First do a fresh install of CentOS 5.4 x86_64, server configuration (no GUI)
# This script should be run as root since it's going to be installing a bunch of stuff
# --- Update things to make sure we have the latest patches ---
yum update # This takes quite a while for a fresh install
# --- Install git ---
yum install -y gcc zlib-devel curl curl-devel openssl
wget http://kernel.org/pub/software/scm/git/git-1.7.4.2.tar.bz2
tar xvjf git-1.7.4.2.tar.bz2
pushd git-1.7.4.2
./configure && make && make install
popd
rm -rf git*
# --- Install NodeJS ---
yum install -y gcc-c++
git clone https://github.com/joyent/node.git
pushd node
./configure && make && make install
popd
rm -rf node
# --- Install the Node Package Manager ---
curl http://npmjs.org/install.sh | sh
npm install express
# --- Download Graphite files ---
mkdir graphite
pushd graphite/
wget "http://launchpad.net/graphite/trunk/0.9.7/+download/graphite-web-0.9.7c.tar.gz"
wget "http://launchpad.net/graphite/trunk/0.9.7/+download/carbon-0.9.7.tar.gz"
wget "http://launchpad.net/graphite/trunk/0.9.7/+download/whisper-0.9.7.tar.gz"
tar xzvf graphite-web-0.9.7c.tar.gz
tar xzvf carbon-0.9.7.tar.gz
tar xzvf whisper-0.9.7.tar.gz
# --- Install Whisper - Graphite's DB system ---
pushd whisper-0.9.7
python setup.py install
popd
# -- Install Carbon - the Graphite back-end ---
pushd carbon-0.9.7
# Workaround: the current version of the AMQP support requires Python 2.5
rm -f lib/carbon/amqp_publisher.py lib/carbon/amqp_listener.py
python setup.py install
cp /opt/graphite/conf/carbon.conf.example /opt/graphite/conf/carbon.conf
# Schema should be configured by the user.
# see: http://graphite.wikidot.com/getting-your-data-into-graphite
cp /opt/graphite/conf/storage-schemas.conf.example /opt/graphite/conf/storage-schemas.conf
popd
# --- Install Graphite dependencies ---
rpm -Uvh "http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm"
yum install -y pycairo mod_python Django python-ldap python-memcached python-sqlite2 bitmap bitmap-fonts
## VV Ubuntu stuff still to be translated VV ##
cd ~/graphite/graphite-web-0.9.6
python setup.py install
# copy the graphite vhost example to available sites, edit it to you satisfaction, then link it from sites-enabled
cp example-graphite-vhost.conf /etc/apache2/sites-available/graphite.conf
ln -s /etc/apache2/sites-available/graphite.conf /etc/apache2/sites-enabled/graphite.conf
apache2ctl restart
# I had to create these log files manually
/opt/graphite/storage/log/webapp
touch info.log
chmod 777 info.log
touch exception.log
chmod 777 exception.log
# make sure to change ownership of the storage folder to the Apache user/group - mine was www-data
sudo chown -R www-data:www-data /opt/graphite/storage/
cd /opt/graphite/webapp/graphite
# copy the local_settings example file to creating the app's settings
# this is where both carbon federation and authentication is configured
cp local_settings.py.example local_settings.py
# run syncdb to setup the db and prime the authentication model (if you're using the DB model)
sudo python manage.py syncdb
# start the carbon cache
/opt/graphite/bin/carbon-cache.py start
# copy the the statsd config example to create the config file
# unless you used non-default ports for some other feature of the system, the defaults in the config file are fine
# clone the statsd project
git clone https://github.com/etsy/statsd.git
cd ~/statsd
cp exampleConfig.js local.js
# start statsd
node stats.js local.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment