Forked from jgeurts/install-graphite-ubuntu-12.04.sh
Last active
December 25, 2015 15:19
-
-
Save wkettler/6997357 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#################################### | |
# Last tested & updated 04/09/2014 | |
#################################### | |
VERS="0.9.12" | |
# Make sure only root can run script | |
if [[ $EUID -ne 0 ]] | |
then | |
echo "" | |
echo "This script must be run as root" 1>&2 | |
echo "" | |
exit 1 | |
fi | |
cd | |
apt-get update | |
apt-get upgrade --assume-yes | |
apt-get install --assume-yes apache2 apache2-mpm-worker apache2-utils apache2.2-bin libapache2-mod-wsgi libapache2-mod-python libaprutil1-ldap memcached python-cairo-dev python-django python-ldap python-memcache python-pysqlite2 sqlite3 erlang-os-mon erlang-snmp rabbitmq-server python-setuptools | |
# Download packages | |
wget https://pypi.python.org/packages/source/g/graphite-web/graphite-web-${VERS}.tar.gz | |
wget https://pypi.python.org/packages/source/c/carbon/carbon-${VERS}.tar.gz | |
wget https://pypi.python.org/packages/source/w/whisper/whisper-${VERS}.tar.gz | |
tar -zxvf graphite-web-${VERS}.tar.gz | |
tar -zxvf carbon-${VERS}.tar.gz | |
tar -zxvf whisper-${VERS}.tar.gz | |
mv graphite-web-${VERS} graphite | |
mv carbon-${VERS} carbon | |
mv whisper-${VERS} whisper | |
rm graphite-web-${VERS}.tar.gz | |
rm carbon-${VERS}.tar.gz | |
rm whisper-${VERS}.tar.gz | |
# Python packages | |
easy_install django-tagging==0.3.1 | |
easy_install zope.interface | |
sudo easy_install twisted==12.2.0 | |
easy_install txamqp | |
#################################### | |
# INSTALL WHISPER | |
#################################### | |
cd ~/whisper | |
python setup.py install | |
#################################### | |
# INSTALL CARBON | |
#################################### | |
cd ~/carbon | |
python setup.py install | |
cd /opt/graphite/conf | |
cp carbon.conf.example carbon.conf | |
cp storage-schemas.conf.example storage-schemas.conf | |
### Replace contents of storage-schemas.conf to be the following | |
cat > /opt/graphite/conf/storage-schemas.conf <<EOF | |
[stats] | |
priority = 110 | |
pattern = .* | |
retentions = 10:2160,60:10080,600:262974 | |
EOF | |
#################################### | |
# CONFIGURE GRAPHITE (webapp) | |
#################################### | |
cd ~/graphite | |
python check-dependencies.py | |
python setup.py install | |
################### | |
# CONFIGURE APACHE | |
################### | |
cd ~/graphite/examples | |
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default.orig | |
cp example-graphite-vhost.conf /etc/apache2/sites-available/default | |
cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi | |
##### | |
# Change the line: WSGISocketPrefix run/wsgi | |
# To: WSGISocketPrefix /etc/httpd/wsgi | |
##### | |
mkdir -p /etc/httpd/wsgi | |
chown www-data:www-data /etc/httpd/wsgi | |
sed -i 's/WSGISocketPrefix run\/wsgi/WSGISocketPrefix \/etc\/httpd\/wsgi/' /etc/apache2/sites-available/default | |
/etc/init.d/apache2 reload | |
#################################### | |
# INITIAL DATABASE CREATION | |
#################################### | |
cd /opt/graphite/webapp/graphite/ | |
python manage.py syncdb | |
# follow prompts to setup django admin user | |
chown -R www-data:www-data /opt/graphite/storage/ | |
/etc/init.d/apache2 restart | |
cd /opt/graphite/webapp/graphite | |
cp local_settings.py.example local_settings.py | |
#################################### | |
# STARTUP SCRIPTS | |
#################################### | |
wget https://gist.githubusercontent.com/wkettler/6995080/raw/carbon-cache -O /etc/init.d/carbon-cache | |
chmod 755 /etc/init.d/carbon-cache | |
update-rc.d carbon-cache defaults | |
service carbon-cache start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment