Last active
March 7, 2017 18:23
-
-
Save cabrel/9371402 to your computer and use it in GitHub Desktop.
Install vfense script
This file contains hidden or 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 | |
echo "** Updating apt cache list" | |
sudo apt-get -qq update | |
echo "** Installing apt-add-repository" | |
sudo apt-get -y install python-software-properties curl pwgen | |
echo "** Adding chris-lea/redis-server ppa" | |
sudo apt-add-repository -y ppa:chris-lea/redis-server | |
echo "** Adding chris-lea/node.js ppa" | |
sudo apt-add-repository -y ppa:chris-lea/node.js | |
echo "** Adding rethinkdb ppa" | |
sudo add-apt-repository -y ppa:rethinkdb/ppa | |
echo "** Updating apt cache list" | |
sudo apt-get -y update | |
echo "** Installing vfense prerequisites" | |
sudo apt-get -y install \ | |
python-setuptools \ | |
python-pip \ | |
python-lxml \ | |
python-pycurl \ | |
python-redis \ | |
python-openssl \ | |
python-tornado \ | |
python-beautifulsoup \ | |
python-roman \ | |
python-bcrypt \ | |
python-ipaddr \ | |
python-tz \ | |
python-urlgrabber \ | |
python-netifaces \ | |
redis-server \ | |
nginx-extras \ | |
python-jsonpickle \ | |
openssh-server \ | |
python-simplejson \ | |
git-core \ | |
g++ \ | |
nodejs \ | |
libprotobuf-dev \ | |
libgoogle-perftools-dev \ | |
libncurses5-dev \ | |
libboost-all-dev | |
echo "** Installing rethinkdb prerequisites" | |
sudo apt-get install rethinkdb | |
echo "** Updating python setuptools" | |
curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | sudo python | |
echo "** Installing vfense python libraries" | |
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp sudo pip install rq rethinkdb requests apscheduler tornado-redis xlrd | |
echo "** Downloading vfense server" | |
sudo wget http://www.vfense.org/download/593/ -O /tmp/vfense-server.tar.gz | |
echo "** Extracting vfense to /tmp/vfense-server" | |
if [ -d "/tmp/vfense-server" ]; then | |
sudo mkdir /tmp/vfense-server | |
else | |
sudo rm -Rf /tmp/vfense-server | |
sudo mkdir /tmp/vfense-server | |
fi | |
sudo tar xvzf /tmp/vfense-server.tar.gz -C /tmp/vfense-server --strip-components 1 | |
if [ -d "/opt/TopPatch" ]; then | |
sudo mkdir /opt/TopPatch | |
fi | |
# according to http://www.vfense.org/docs/installing-vfense-server/ the paths are hardcoded | |
# so.. move it to the specific directory | |
echo "** Moving /tmp/vfense-server to /top/TopPatch" | |
sudo mv /tmp/vfense-server/* /opt/TopPatch/ | |
echo "** Changing directories to /opt/TopPatch" | |
cd /opt/TopPatch | |
echo "** Linking TopPatch python source to dist-packages/vFense" | |
sudo ln -s /opt/TopPatch/tp/src /usr/local/lib/python2.7/dist-packages/vFense | |
HOSTNAME=`hostname` | |
PASSWORD=`pwgen -1 -s 12` | |
echo "** Starting initialize_vFense.py" | |
echo "" | |
echo "** The password that will be used is: ${PASSWORD}" | |
echo "** Please make note of it and change it when you can" | |
sudo python tp/src/scripts/initialize_vFense.py --dnsname="${HOSTNAME}" --password="${PASSWORD}" | |
sudo service rethinkdb restart | |
echo "** Starting nginx" | |
sudo service nginx start | |
echo "** Starting vFense" | |
sudo /opt/TopPatch/tp/src/daemon/vFensed start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment