This entry will cover installing and configuration of Tomcat 7 on Slackware 13
It will also work for Tomcat 6.x.
We'll install the JDK, Tomcat, create a start/stop script, and configure Tomcat to run as a service and start at boot.
For this installation, we'll use Tomcat 7.0.14, the current release of Tomcat 7.
To begin, we'll install the Java Development Kit (JDK) 1.6 update 25
JDK 1.6 is the minimum JDK version required for Tomcat 7.
Download the JDK here: http://www.oracle.com/technetwork/java/javase/downloads/index.html
We'll use the latest, JDK 6 Update 25. The JDK is specific to 32 and 64 bit versions.
My Slackware box is 32 bit, so I'll need: jdk-6u25-linux-i586.bin
If you are on 32 bit, you'll need: jdk-6u25-linux-x64.bin
Download the JDK and save it to a directory. I'm saving it to /opt.
Create a new directory /usr/java.
Change to the /usr/java directory we created and install the JDK using 'sh /opt/jdk-6u25-linux-i586.bin'
Set the JAVA_HOME path to the location we installed our JDK above.
To set it for your current session, you can issue the following from the CLI:
Download apache-tomcat-7.0.14.tar.gz here
Save the file to the /usr/share directory In the /usr/share directory, unpack the file using tar -xzf:
We will now create a simple Start/Stop/Restart script and configure Tomcat to run as a service. We will also configure Tomcat to start at boot.
Change to the /etc/rc.d directory and create a script called 'tomcat' as shown below.
CATALINA_HOME is the Tomcat home directory (/usr/share/apache-tomcat-7.0.14)
Now, set the permissions for your script to make it executable:
Test our script.
Start Tomcat:
You should now be able to access Tomcat at:
http://yourdomain.com:8080 or http://yourIPaddress:8080 and we should see the Tomcat home page. FInally, to enable Tomcat to start at boot time, add the following lines to /etc/rc.local:
Learn More About Apache Tomcat 7Apache Tomcat FoundationTomcat 7
It will also work for Tomcat 6.x.
We'll install the JDK, Tomcat, create a start/stop script, and configure Tomcat to run as a service and start at boot.
For this installation, we'll use Tomcat 7.0.14, the current release of Tomcat 7.
To begin, we'll install the Java Development Kit (JDK) 1.6 update 25
JDK 1.6 is the minimum JDK version required for Tomcat 7.
Step 1: Install the JDK
Download the JDK here: http://www.oracle.com/technetwork/java/javase/downloads/index.html
We'll use the latest, JDK 6 Update 25. The JDK is specific to 32 and 64 bit versions.
My Slackware box is 32 bit, so I'll need: jdk-6u25-linux-i586.bin
If you are on 32 bit, you'll need: jdk-6u25-linux-x64.bin
Download the JDK and save it to a directory. I'm saving it to /opt.
Create a new directory /usr/java.
root@slackd:~# mkdir /usr/java
Change to the /usr/java directory we created and install the JDK using 'sh /opt/jdk-6u25-linux-i586.bin'
root@slackd:~# cd /usr/java root@slackd:/usr/java# sh /opt/jdk-6u25-linux-i586.bin
Set the JAVA_HOME path to the location we installed our JDK above.
To set it for your current session, you can issue the following from the CLI:
root@slackd:/usr/java# JAVA_HOME=/usr/java/jdk1.6.0_25 root@slackd:/usr/java# export JAVA_HOME root@slackd:/usr/java# PATH=$JAVA_HOME/bin:$PATH root@slackd:/usr/java# export PATH
Step 2: Download and Unpack Tomcat 7.0.14
Download apache-tomcat-7.0.14.tar.gz here
Save the file to the /usr/share directory In the /usr/share directory, unpack the file using tar -xzf:
root@slackd:~# cd /usr/share root@slackd:/usr/share# tar -xzf apache-tomcat-7.0.14.tar.gzThis will create the directory /usr/share/apache-tomcat-7.0.14
Step 3: Configuring Tomcat to Run as a Service.
We will now create a simple Start/Stop/Restart script and configure Tomcat to run as a service. We will also configure Tomcat to start at boot.
Change to the /etc/rc.d directory and create a script called 'tomcat' as shown below.
root@slackd:~# cd /etc/rc.d root@slackd:/etc/rc.d# vi rc.tomcat
#!/bin/bash JAVA_HOME=/usr/java/jdk1.6.0_25 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH CATALINA_HOME=/usr/share/apache-tomcat-7.0.14 case $1 in start) sh $CATALINA_HOME/bin/startup.sh ;; stop) sh $CATALINA_HOME/bin/shutdown.sh ;; restart) sh $CATALINA_HOME/bin/shutdown.sh sh $CATALINA_HOME/bin/startup.sh ;; esac exit 0In the above script, we are simply calling the startup.sh and shutdown.sh scripts located in the Tomcat bin directory (/usr/share/apache-tomcat-7.0.14/bin).
CATALINA_HOME is the Tomcat home directory (/usr/share/apache-tomcat-7.0.14)
Now, set the permissions for your script to make it executable:
root@slackd: /etc/rc.d# chmod 755 tomcatWe can now run tomcat as a background service using: /etc/rc.d/rc.tomcat start | stop | restart
Test our script.
Start Tomcat:
root@slackd:~# /etc/rc.d/rc.tomcat start Using CATALINA_BASE: /usr/share/apache-tomcat-7.0.14 Using CATALINA_HOME: /usr/share/apache-tomcat-7.0.14 Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.14/temp Using JRE_HOME: /usr/java/jdk1.6.0_25 Using CLASSPATH: /usr/share/apache-tomcat-7.0.14/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.14/bin/tomcat-juli.jarStop Tomcat:
root@slackd:~# /etc/rc.d/rc.tomcat stop Using CATALINA_BASE: /usr/share/apache-tomcat-7.0.14 Using CATALINA_HOME: /usr/share/apache-tomcat-7.0.14 Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.14/temp Using JRE_HOME: /usr/java/jdk1.6.0_25 Using CLASSPATH: /usr/share/apache-tomcat-7.0.14/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.14/bin/tomcat-juli.jarRestarting Tomcat (Must be started first):
root@slackd:~# /etc/rc.d/rc.tomcat restart Using CATALINA_BASE: /usr/share/apache-tomcat-7.0.14 Using CATALINA_HOME: /usr/share/apache-tomcat-7.0.14 Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.14/temp Using JRE_HOME: /usr/java/jdk1.6.0_25 Using CLASSPATH: /usr/share/apache-tomcat-7.0.14/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.14/bin/tomcat-juli.jar Using CATALINA_BASE: /usr/share/apache-tomcat-7.0.14 Using CATALINA_HOME: /usr/share/apache-tomcat-7.0.14 Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.14/temp Using JRE_HOME: /usr/java/jdk1.6.0_25 Using CLASSPATH: /usr/share/apache-tomcat-7.0.14/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.14/bin/tomcat-juli.jarYou should review the Catalina.out log located at /usr/share/apache-tomcat-7.0.14/logs/catalina.out and check for any errors.
You should now be able to access Tomcat at:
http://yourdomain.com:8080 or http://yourIPaddress:8080 and we should see the Tomcat home page. FInally, to enable Tomcat to start at boot time, add the following lines to /etc/rc.local:
if [ -x /etc/rc.d/rc.tomcat ]; then /etc/rc.d/rc.tomcat startRelated Tomcat Posts
Learn More About Apache Tomcat 7Apache Tomcat FoundationTomcat 7