Sunday, July 22, 2012
Wednesday, November 24, 2010
Notes on Installing Ubuntu, Tomcat, Apache
- Install AMI (AMI ID: ami-6743ae0e [32-bit] ami-7d43ae14 [64-bit] ):
- http://alestic.com
- login as ubuntu (putty instructions here: http://docs.amazonwebservices.com/AmazonEC2/gsg/2007-01-19/putty.html).
- Check for updates:
- sudo apt-get update
- Install MySQL:
- sudo apt-get install -y mysql-server
- Create user:
- CREATE USER 'your_user_name'@'localhost' IDENTIFIED BY 'some_passwd';
- GRANT SELECT,DELETE,INSERT,UPDATE ON your_database.* TO 'your_user_name'@'localhost';
- Create and attach an external EBS volume; configure MySQL to use this volume - http://developer.amazonwebservices.com/connect/entry.jspa?categoryID=100&externalID=1663 - we will assume that this EBS volume gets mounted as /vol
- Install Java (http://openjdk.java.net/install/)
- sudo apt-get install openjdk-6-jdk
- Install Tomcat (http://www.ubuntugeek.com/how-to-install-tomcat-6-on-ubuntu-9-04-jaunty.html)
- sudo apt-get install tomcat6 tomcat6-examples
- CATALINA_HOME gets set to /usr/share/tomcat6.
- CATALINA_BASE gets set to /var/lib/tomcat6
- Webapps in /var/lib/tomcat6. However, we will configure Tomcat to load our web application from the mounted EBS volume, /vol.
- For Grails application - increase -Xmx and permGen space in /etc/init.d/tomcat6
- JAVA_OPTS="-Djava.awt.headless=true -Xmx1024M -XX:PermSize=512m -XX:MaxPermSize=512m" (use smaller values for "micro" instance)
- Disable context reloading
- edit "/var/lib/tomcat6/conf/Context.xml"
- <Context reloadable="false">
- Create "your_application.xml" in /var/lib/tomcat6/conf/Catalina/localhost
- <?xml version='1.0' encoding='utf-8'?>
<Context docBase="/vol/your_application" path="/your_application" reloadable="false" /> where it is assumed your "unwarred" application resides in /vol/your_application -this is the mounted external EBS volume. - Disable security, else, grails gives java.security.AccessControlException: access denied (java.util.PropertyPermission grails.env read) error:
- Edit /etc/default/tomcat6 and change the line that reads
#TOMCAT6_SECURITY=yes
into
TOMCAT6_SECURITY=no - Start/Stop Tomcat: sudo /etc/init.d/tomcat6 start/stop
- Install Apache:
- sudo apt-get install apache2 libapache2-mod-jk
- Apache-Tomcat Integration (http://rcpeters.blogspot.com/2009/05/installing-apache2-and-tomcat6-on.html)
- This will configure your application to be served under "root", e.g., http://www.yourdomain.com (NOT http://www.yourdomain.com/your_application).
- sudo vim /etc/apache2/workers.properties:
- sudo vim /etc/apache2/apache2.conf: # Load mod_jk module
- sudo vim /etc/apache2/sites-enabled/000-default Delete "DocumentRoot /var/www" And type in JkMount / worker1 JkMount /* worker1
- Enable port 8009 on tomcat sudo vim /etc/tomcat6/server.xml
- restart tomcat sudo /etc/init.d/tomcat6 restart
- restart apache sudo /etc/init.d/apache2 restart
- For automatic MySQL backup (http://sourceforge.net/projects/automysqlbackup/)
- copy automysqlbackup to /vol/somedirectory - This is your mounted, external EBS volume
- Create a symbolic link to automysqlbackup in /etc/cron.daily
- Install mutt, if you want your mysql backup dumps to be emailed to you.
- Configure it for "Internet" using the defaults.
- After your AMI is configured, don't forget to bundle it as your very own private AMI, or everything will be lost once you terminate your instance (except, of course, the content you put under /vol, your mounted EBS volume).
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
# Update this path to match your modules location
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
# Declare the module for (remove this line on Apache 2.x)
#AddModule mod_jk.c
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile /etc/apache2/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /var/log/apache2/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
note, you can use JkUnMount to define directories you want apache to serve
uncomment <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Subscribe to:
Posts (Atom)