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 ---
# Add EPEL so we can get reasonably recent packages
rpm -Uvh "http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm"
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 xjf git-1.7.4.2.tar.bz2
pushd git-1.7.4.2
./configure && make && make install
popd
rm -rf git*
# --- Install Whisper - Graphite's DB system ---
wget "http://launchpad.net/graphite/trunk/0.9.7/+download/whisper-0.9.7-1.noarch.rpm"
rpm -Uvh whisper-0.9.7-1.noarch.rpm
# -- Install Carbon - the Graphite back-end ---
wget "http://launchpad.net/graphite/trunk/0.9.7/+download/carbon-0.9.7-1.noarch.rpm"
rpm -Uvh carbon-0.9.7-1.noarch.rpm
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
# --- Install Graphite dependencies ---
yum install -y pycairo mod_python Django python-ldap python-memcached python-sqlite2 \
bitmap bitmap-fonts python-devel python-crypto pyOpenSSL zope
# --- Install Twisted ---
wget http://pypi.python.org/packages/source/T/Twisted/Twisted-10.2.0.tar.bz2
tar jxf Twisted-10.2.0.tar.bz2
pushd Twisted-10.2.0
python setup.py install
popd
rm -rf Twisted-10.2.0*
# --- Install Graphite ---
wget "http://launchpad.net/graphite/trunk/0.9.7/+download/graphite-web-0.9.7c-1.noarch.rpm"
rpm -Uvh graphite-web-0.9.7c-1.noarch.rpm
# ===== BEGIN MANUAL STEP =====
# Add the following line to /etc/httpd/conf/httpd.conf: (after the other LoadModule lines)
# LoadModule python_module modules/mod_python.so
# Edit /etc/httpd/conf.d/graphite.conf to replace @DJANGO_ROOT@ with /usr/lib/python2.4/site-packages/django
# Edit /etc/sysconfig/selinux to set the SELINUX line to:
# SELINUX=permissive
# ===== END MANUAL STEP =====
# --- Configure Graphite ---
# get SELinux out of the way
setenforcing 0
service httpd restart
# maybe change ownership of the storage folder to the Apache user/group?
#### chown -R apache:apache /opt/graphite/storage/
pushd /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
# ===== BEGIN MANUAL STEP =====
# run syncdb to setup the db and prime the authentication model (if you're using the DB model)
python manage.py syncdb
# ===== END MANUAL STEP =====
# start the carbon cache
/opt/graphite/bin/carbon-cache.py start
# --- 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
# --- Install StatsD ---
git clone https://github.com/etsy/statsd.git
cd statsd
# 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
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