Tuesday, December 17, 2013

Setup Trigger on CentOs\RHEL

Setting up trigger (https://github.com/trigger/trigger) is no small task on a RHEL\CentOs system.

Here is a basic setup bash script which you can use or modify to get up and running. I haven't tested it yet on a completely new system, but it should work without too much tweaking.

## run this as root on a CentOs/RHEL system (tested on Centos 6.4 with rpmforge repos already setup)
## grab epel repository and make it available in yum
wget http://mirrors.solfo.com/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -i epel-release-6-8.noarch.rpm
## update yum cache so it knows to use epel rpms
yum update
## install everything you need to install trigger
yum -y install libxml2-devel libxml++-devel python-devel python-setuptools python-simpleparse python-twisted python-pip redis automake gcc
## start redis in case you need it
chkconfig redis on
service redis start
## use pip to install trigger
pip install trigger
## use pip to install twister (may be done already...but JIC)
pip install twister
## build config directory and populate with something (pip copies trigger files into /tmp/pip-build-root/trigger/)
mkdir -p /etc/trigger
cp /tmp/pip-build-root/trigger/conf/netdevices.xml /etc/trigger/netdevices.xml
cp /tmp/pip-build-root/trigger/conf/bounce.py /etc/trigger/bounce.py
cp /tmp/pip-build-root/trigger/conf/trigger_settings.py /etc/trigger/settings.py
cp /tmp/pip-build-root/trigger/conf/autoacl.py /etc/trigger/autoacl.py
cp /tmp/pip-build-root/trigger/tests/data/tackf /etc/trigger/.tackf
##create a few dirs that you may need
mkdir -p /data/firewalls
mkdir -p /data/tftproot
## now you need to edit your /etc/trigger/settings.py and set your DB type and details
## run init_task_db to populate your DB with the basic tables that you'll need

Don't forget, this is for my benefit as well. Now I'll have this post to look back on to see how I did this before.