Skip to content

Instantly share code, notes, and snippets.

@julian-garrido
Created August 8, 2014 08:29
Show Gist options
  • Save julian-garrido/46b0652f14d37906e19f to your computer and use it in GitHub Desktop.
Save julian-garrido/46b0652f14d37906e19f to your computer and use it in GitHub Desktop.
Install and set up tomcat7 server in ubuntu. Use https protocol
Tomcat installation:
sudo apt-get install tomcat7 (Minimun installation)
sudo apt-get install tomcat7-admin tomcat7-common tomcat7-docs tomcat7-examples
This installation implies that tomcat is installed as a service. /usr/share/tomcat7/bin/startup.sh cannot be used to start tomcat.
Set up environment variables. Edit .bashrc and add:
export JAVA_HOME=/usr/lib/jvm/default-java
export CATALINA_HOME=/usr/share/tomcat7
export CATALINA_BASE=/usr/share/tomcat7
Other tomcat folders:
/etc/tomcat7 ---> config files CATALINA_HOME
/etc/init.d/tomcat7
/usr/share/tomcat7 ---> bin, jars
/usr/share/tomcat7-root/default_root/
/var/lib/tomcat7 ---> contains webapps CATALINA_BASE
/var/log/tomcat7/ --> logs
Create a certificate, provide permissions. The default folder where it is stored is the home folder (/root/). To avoid the modification of this folder permissions, move the file to the conf tomcat folder:
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA
CN=amiga, OU=AMIGA, O=IAA-CSIC, L=Granada, ST=Spain, C=ES
chmod 755 /root/.keystore
mv /root/.keystore /etc/tomcat7/
Edit server.xml in /etc/tomcat7 to modify the connector (port and secure configuration)
Comment the connector that use 8080 port number.
Include a new connector for TSL connections according to the Taverna Tutorial specifications.
server.xml
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
keystoreFile="/etc/tomcat7/.keystore" keystorePass="amigatserver"
clientAuth="false" sslProtocol="TLS" />
Start and Stop the service:
service tomcat7 start
service tomcat7 stop
If there is any problem:
Check the logs at /var/logs/tomcat7
Check if the service is running in the right port: netstat -anp | grep 8443
Check if the service is running: ps -ef | grep tomcat
Verify that default web app is working:
https://xxx.xxx.xxx.xx:8443 You should get a web page saying "It Works!"
Modify tomcat-users and add the manager-gui role and manag user.
See the deployed (and deploy) web applications using https://161.111.165.90:8443/manager/html interface. The required user is "manag" the password is in /var/lib/tomcat7/conf/tomcat-users.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment