sudo rpm --import http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/RPM-GPG-KEY-EPEL-6
cd /tmp/
wget http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6-8.noarch.rpm
sudo yum install graphite-web graphite-web-selinux mysql mysql-server MySQL-python python-carbon
環境に応じては epel リポジトリが無効になっている場合があるので以下のように epel リポジトリを有効にしてインストールする。
sudo yum install --enablerepo=epel graphite-web graphite-web-selinux mysql mysql-server MySQL-python python-carbon
sudo service mysqld start
MySQL
の root
パスワード等は適宜設定する。
sudo su -
cp /etc/graphite-web/local_settings.py /etc/graphite-web/local_settings.py.bk
cat << EOT >> /etc/graphite-web/local_settings.py
GRAPHITE_ROOT = '/usr/share/graphite'
CONF_DIR = '/etc/graphite-web'
STORAGE_DIR = '/var/lib/graphite-web'
CONTENT_DIR = '/usr/share/graphite/webapp/content'
WHISPER_DIR = '/var/lib/carbon/whisper/'
RRD_DIR = '/var/lib/carbon/rrd'
LOG_DIR = '/var/log/graphite-web/'
DATABASES = {
'default': {
'NAME': 'graphite',
'ENGINE': 'django.db.backends.mysql',
'USER': 'graphite',
'PASSWORD': 'complexpassw0rd',
'HOST': 'localhost',
'PORT': '3306',
}
}
EOT
mysql -e "CREATE USER 'graphite'@'localhost' IDENTIFIED BY 'complexpassw0rd';" -u root
mysql -e "GRANT ALL PRIVILEGES ON graphite.* TO 'graphite'@'localhost';" -u root
mysql -e "CREATE DATABASE graphite;" -u root
mysql -e 'FLUSH PRIVILEGES;' -u root
/usr/lib/python2.6/site-packages/graphite/manage.py syncdb
幾つか質問されるので適宜答える。
/etc/init.d/carbon-cache start
/etc/init.d/httpd start
chkconfig carbon-cache on
chkconfig mysqld on
chkconfig httpd on
sudo su -
yum install initscripts fontconfig
cd ~
wget https://grafanarel.s3.amazonaws.com/builds/grafana-2.0.0_beta3-1.x86_64.rpm
yum localinstall grafana-2.0.0_beta3-1.x86_64.rpm
/etc/init.d/grafana-server start
chkconfig grafana-server on
graphite-web.conf
を以下のように設定する必要がある。
# Graphite Web Basic mod_wsgi vhost
<VirtualHost *:80>
ServerName graphite-web
DocumentRoot "/usr/share/graphite/webapp"
ErrorLog /var/log/httpd/graphite-web-error.log
CustomLog /var/log/httpd/graphite-web-access.log common
Alias /media/ "/usr/lib/python2.6/site-packages/django/contrib/admin/media/"
WSGIScriptAlias / /usr/share/graphite/graphite-web.wsgi
WSGIImportScript /usr/share/graphite/graphite-web.wsgi process-group=%{GLOBAL} application-group=%{GLOBAL}
<Location "/content/">
SetHandler None
</Location>
<Location "/media/">
SetHandler None
</Location>
<Directory "/usr/share/graphite/">
Require all granted
</Directory>
</VirtualHost>