Setting up Blazeds ( Tomcat ) on Amazon Ec2 à la Ubuntu

We’ll throw in some lamp and phpmyadmin in too for good mesure. These are the steps I recently used to setup an Ec2 box for some dev…

Step 1: Java

#See if we have it already
javac
sudo apt-get install sun-java6-jdk
#if no repo add it...
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
# and try again
sudo apt-get install sun-java6-jdk

Step 2: Tomcat

sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples
sudo /etc/init.d/tomcat6 start
#modify user rights so you can use the webadmin gui
sudo pico /etc/tomcat6/tomcat-users.xml
sudo /etc/init.d/tomcat6 restart

#And if we want to autostart tomcat...

sudo pico /etc/init.d/tomcat

Insert the following
# Tomcat auto-start
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

export JAVA_HOME=/usr/lib/jvm/java-6-sun

case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0

Now issue
sudo chmod 755 /etc/init.d/tomcat

sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat

Step 3: Blazeds

Copy up the blazeds WAR (assuming you’ve already downloaded blazeds on your localmachine)

scp -i ~/pathto/YOURPEM.pem blazeds.war ubuntu@someelasticip
sudo /etc/init.d/tomcat6 restart

Step 4: LAMP

tasksel --list-task
sudo tasksel install lamp-server

Step 5: phpmyadmin

sudo apt-get install phpmyadmin

Add the following line to /etc/apache2/apache2.conf:
Include /etc/phpmyadmin/apache.conf

sudo /etc/init.d/apache2 restart

Extra Credit: Xuggler for kicks

uname -m (verify which version of linux 32/64)

wget http://com.xuggle.s3.amazonaws.com/xuggler/xuggler-3.4.FINAL/xuggle-xuggler.3.4.1012-x86_64-unknown-linux-gnu.sh
mv xuggle-xuggler.3.4.1012-x86_64-unknown-linux-gnu.sh xuggle-xuggler.sh
chmod a+x ./xuggle-xuggler.sh
sudo ./xuggle-xuggler.sh

sudo pico /usr/share/tomcat6/bin/catalina.sh
add
export XUGGLE_HOME=/usr/local/xuggler
export LD_LIBRARY_PATH=$XUGGLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$XUGGLE_HOME/bin:$PATH

Leave a Reply

Your email address will not be published. Required fields are marked *