RSS

Category Archives: Tomcat

Steps to install Tomcat7 server on Ubuntu 12.04

By: Saad Faruque

1. Install Java JDK

    • Download jdk-7u45-linux-i586.tar.gz from Oracle
1
2
3
4
5
sudo tar zxvf jdk-7u45-linux-i586.tar.gz to /usr/lib/jvm folder
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_45/bin/javac" 1
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_45/bin/java" 1
sudo update-alternatives --set "javac" "/usr/lib/jvm/jdk1.7.0_45/bin/javac"
sudo update-alternatives --set "java" "/usr/lib/jvm/jdk1.7.0_45/bin/java"
    • Edit file to set JAVA_HOME: /etc/profile and add following lines at the bottom
1
2
3
4
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_45
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
export PATH
    • Reload the file use command:
1
. /etc/profile
    • Check installation:
1
2
java -version
javac -version

2. Install Tomcat7 Server

1
sudo apt-get install tomcat7
    • Edit file: /etc/default/tomcat7, and uncomment the line that sets the JAVA_HOME variable
    • Change default JAVA_HOME to:
1
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_45

3. Change default port from 8080 to 80

    • In /var/lib/tomcat7/conf/server.xml, change to have port=”80″ in line:
1
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
    • Edit file: /etc/default/tomcat7, uncommenting and setting the line like:
1
AUTHBIND=yes

4. Install SSL certificate

    • Run command and save the keystore file in any path:
1
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA -keystore /var/lib/tomcat7/conf/keystore
  • Follow instructions and enter domain name as first and last name and your organization name etc., and set your keystorePass
  • Uncomment the “SSL HTTP/1.1 Connector” entry in $CATALINA_BASE/conf/server.xml and modify as described in the Configuration section: http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html.

 

Copy from: http://garydengblog.wordpress.com/2013/12/20/steps-to-install-tomcat7-server-on-ubuntu-12-04/

Advertisements
 
Leave a comment

Posted by on January 8, 2014 in Tomcat