Skip to content

Instantly share code, notes, and snippets.

@lorinma
Created April 19, 2016 05:18
Show Gist options
  • Save lorinma/01f90d1aabac13b9ff84ffe772dfb362 to your computer and use it in GitHub Desktop.
Save lorinma/01f90d1aabac13b9ff84ffe772dfb362 to your computer and use it in GitHub Desktop.
Clound9 install java and tomcat
# install Java8
Add the two following lines to your file /etc/apt/sources.list (which you can create if it does not exist)
sudo vim /etc/apt/sources.list;
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
sudo apt-get update; sudo apt-get install oracle-java8-set-default -y;
# install tomcat 7
sudo groupadd tomcat; sudo useradd -s /bin/false -g tomcat -d /usr/local/tomcat tomcat; cd ~; wget http://apache.spd.co.il/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.tar.gz; sudo mkdir /usr/local/tomcat; sudo tar xvf apache-tomcat-7*tar.gz -C /usr/local/tomcat --strip-components=1;
cd /usr/local/tomcat;sudo chgrp -R tomcat conf;sudo chmod g+rwx conf;sudo chmod g+r conf/*;sudo chown -R tomcat work/ temp/ logs/; sudo vim /etc/init/tomcat.conf;
Paste in the following script (modify the value of JAVA_HOME if necessary.You may also want to modify the memory allocation settings that are specified in CATALINA_OPTS):
description "Tomcat Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
setuid tomcat
setgid tomcat
env JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre
env CATALINA_HOME=/usr/local/tomcat
# Modify these options as needed
env JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
env CATALINA_OPTS="-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
exec $CATALINA_HOME/bin/catalina.sh run
# cleanup temp directory after stop
post-stop script
rm -rf $CATALINA_HOME/temp/*
end script
sudo vim /usr/local/tomcat/conf/tomcat-users.xml
<tomcat-users>
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="tomcat" password="tomcat" roles="manager-gui,manager-status"/>
</tomcat-users>
# install bimserver
export TOMCAT_HOME=/usr/local/tomcat; export BIMSERVER_APP=$TOMCAT_HOME/webapps/bimserver; sudo rm -rf $TOMCAT_HOME/webapps/examples; sudo wget -O $BIMSERVER_APP.war https://github.com/opensourceBIM/BIMserver/releases/download/1.4.0-FINAL-2015-11-04/bimserver-1.4.0-FINAL-2015-11-04.war; sudo unzip $BIMSERVER_APP.war -d $BIMSERVER_APP && sudo rm $BIMSERVER_APP.war
# run apache
sudo initctl reload-configuration; sudo initctl start tomcat; cd /usr/local/tomcat/bin; sudo ./catalina.sh run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment