-
Step 1: Download Tomcat from here: http://tomcat.apache.org/download-70.cgi
-
Step 2: Right click and extract the file.
-
Step 3: Copy (or better Cut) the extracted folder (e.g. apache-tomcat-7.0.53) and paste it to ~/Tools/Tomcat
-
Step 4: Open Terminal and cd ~/Tools/Tomcat/apache-tomcat-7.0.53/conf
-
Step 5: nano tomcat-users.xml Add following at the end of the file before ""
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="admin"/>
<user username="admin" password="tomcat" roles="admin,manager,manager-gui"/>
CTRL + O (save)
CTRL + X (exit)
- Step 6: cd ~/Tools/Tomcat/apache-tomcat-7.0.53/bin
Change the permissions of catalina.sh so it can be executed, type:
chmod +x catalina.sh
- Step 7: To start tomcat type:
sh startup.sh
And you will see output like this:
Using CATALINA_BASE: /home/<username>/Tools/Tomcat/apache-tomcat-7.0.53
Using CATALINA_HOME: /home/<username>/Tools/Tomcat/apache-tomcat-7.0.53
Using CATALINA_TMPDIR: /home/<username>/Tools/Tomcat/apache-tomcat-7.0.53/temp
Using JRE_HOME: /home/<username>/Tools/java
Using CLASSPATH: /home/<username>/Tools/Tomcat/apache-tomcat-7.0.53/bin/bootstrap.jar:/home/aurora/Tools/Tomcat/apache-tomcat-7.0.53/bin/tomcat-juli.jar
Tomcat started.
- Step 8: On terminal run "netstat -anp | grep :8080" (This step is to verify that tomcat has started successfully) And if everything worked as expected then you should see output like this:
tcp6 0 0 :::8080 :::* LISTEN 12976/java
-
Step 9: Open your favorite browser and type "http://localhost:8080" And you should see home page of tomcat
-
Step 10: Add aliases to quickly start and stop tomcat Open terminal and enter "nano ~/.bash_aliases" enter following data:
### Tomcat 7 Start and Stop
alias tm7st='sh /home/aurora/Tools/Tomcat/apache-tomcat-7.0.53/bin/startup.sh'
alias tm7sp='sh /home/aurora/Tools/Tomcat/apache-tomcat-7.0.53/bin/shutdown.sh'
enter ctrl O and press enter to save changes and then ctrl x to exit nano. And close terminal.
- Step 11: Open Terminal and type: tm7st It will start tomcat And now type: tm7sd It will stop tomcat
chmod +x catalina.sh should be sudo chmod +x catalina.sh