Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#Environment Configuration sh file:
#1 Mongodb
apt-key adv --keyserver hkp:// --recv EA312927
echo "deb trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
apt-get update
apt-get install -y mongodb-org
sudo service mongod start
#2 Apache
apt-get install -y apache2
add-apt-repository -y ppa:sumo/stable
apt-get update
apt-get install -y sumo sumo-tools sumo-doc
#4 Python
apt-get install -y python-pip
#5 cherrypy
pip install cherrypy
#6 Clone Project
git clone
mv c2sumo/src/C3STEM/ /opt/
#7 Change permission
cd /opt/C3STEM/Middleware
mkdir session
mkdir -p /opt/C3STEM/Middleware/log/apache
chown -hR www-data session
chown -hR www-data log
chown -hR www-data static/Data
#8 Web config:
cp /opt/C3STEM/webserver-config/etc/apache2/sites-available/* /etc/apache2/sites-available/
cp /opt/C3STEM/webserver-config/etc/apache2/* /etc/apache2/
#9 mod_wsgi
apt-get install -y libapache2-mod-wsgi
#10 pymongo pip package
pip install pymongo
#11 bcrypt
apt-get install -y python-bcrypt
apt-get install -y python-cffi
#12 Paramiko pip package
pip install --upgrade setuptools
apt-get install -y python-dev
pip install --upgrade pip enum34
pip install paramiko
#13 g-viz
apt-get install -y subversion
cd /opt
svn co
cd /opt/google-visualization-python/trunk
python install
#14 DB config
echo 'edit the file to add ip address of the mongodb host
ip =
# simulation update rate
Changed the application.conf file with the above values'
echo '[DB]
ip =
# simulation update rate
UPDATE_RATE = 2' > /opt/C3STEM/Middleware/config/application.conf
#15 DB schema
cd /opt/C3STEM/DB
#update the private ip in the file to match the ip of sumo server
#and put the correct key name to login to the VM in this case, your localhost
#Note that we use root as the ssh user so plz copy your authorized_keys to /root/ authorized_keys
#Also ensure that the private key that you place at /opt/C3STEM/Middleware/KEY_NAME.pem
#has .pem extension but in the DB entry you don’t put the extension. Also change the owner of the key to www-data
#e.g. in sample below, it says key_name: id_rsa, however in the file system it should be id_rsa.pem
#Go to ~/.ssh folder
cd ~
mkdir .ssh
cd .ssh
# Create id_rsa pub and ppk file
ssh-keygen -t rsa -f id_rsa -q -N '' -y
# Convert id_rsa file into pem format openssl
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
# Give www-data permissions to pem file
chown -hR www-data id_rsa.pem
# Copy pem file into /opt/C3STEM/Middleware/KEY_NAME.pem
cp id_rsa.pem /opt/C3STEM/Middleware/id_rsa.pem
#Edit with host
cd /opt/C3STEM/DB
echo 'import pymongo
from pymongo import MongoClient
from bson.objectid import ObjectId
connection = MongoClient()
db = connection.c3stem_database
ip = ""
"_id": ip,
"flavor": "m1.medium",
"private_IP": ip,
"public_IP": ip,
"key_name": "id_rsa",
"type": "TRANSIENT",
"status": "AVAIL",
"user": "ALL",
"mode": "GROUP"
});' >
#18 Run Apache2 Web Service
echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf
sudo a2enconf fqdn
service apache2 restart
echo 'Now you should be able to login to
username and passwords are the ones in the file /opt/C3STEM/DB/users.csv'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment