MEWBIES@: Facebook Twitter G+ YouTube DeviantArt Forum Wall
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ██
█▌ - HOW TO INSTALL TOMCAT - █▌
█▌ █▌
█ ▐▌
█ I needed to install Tomcat so that I could 'deploy WAR files' (for the ▐▌
█ tunneling app SOHT). ▐▌
█ Tomcat's site is HERE. They have an IRC channel on freenode.net #tomcat ▐▌
█ with very helpful people. Thank you to kjkoster for his help :) ▐▌
█ ▐▌
█ PREREQUISITES: ▐▌
█ `````````````` ▐▌
█ Apache2, skip if you have it installed already, if not: ▐▌
█ su ▐▌
█ aptitude install apache2 ▐▌
█ ▐▌
█ Java; JDK, not just JRE, skip if you have it installed already, if not: ▐▌
█ To list out if you have installed the required java: ▐▌
█ dpkg --get-selections | grep sun-java ▐▌
█ Reply will be similar to this: ▐▌
█ sun-java6-bin install ▐▌
█ sun-java6-jdk install ▐▌
█ sun-java6-jre install ▐▌
█ ▐▌
█ If you need it do this: ▐▌
█ su ▐▌
█ aptitude install sun-java6-jdk ▐▌
█ ▐▌
█ Do this again to see it on the list: ▐▌
█ dpkg --get-selections | grep sun-java ▐▌
█ ▐▌
█ INSTALLING TOMCAT: ▐▌
█ `````````````````` ▐▌
█ Check HERE for the latest version. ▐▌
█ *NOTES: ▐▌
█ a. It is best to match your Tomcat version to your Java version. So if you ▐▌
█ have Java5 and don't want to upgrade then install Tomcat 5.x ▐▌
█ b. Whatever version you install of Java and Tomcat; be sure to change all ▐▌
█ the settings below to be the correct paths/versions that you have. ▐▌
█ ▐▌
█ wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz
█ tar xvzf apache-tomcat-6.0.20.tar.gz ▐▌
█ su ▐▌
█ mv apache-tomcat-6.0.20 /usr/local/tomcat-6.0.20 ▐▌
█ pico ~/.bashrc ▐▌
█ add this line: ▐▌
█ export JAVA_HOME=/usr/lib/jvm/java-6-sun ▐▌
█ ▐▌
█ cd /usr/local/tomcat-6.0.20/bin ▐▌
█ ./startup.sh ▐▌
█ Reply will be ('CATALINA' refers to the install path): ▐▌
█ Using CATALINA_BASE: /usr/local/tomcat-6.0.20 ▐▌
█ Using CATALINA_HOME: /usr/local/tomcat-6.0.20 ▐▌
█ Using CATALINA_TMPDIR: /usr/local/tomcat-6.0.20/temp ▐▌
█ Using JRE_HOME: /usr ▐▌
█ ▐▌
█ pico /etc/init.d/tomcat ▐▌
█ paste in the following to have Tomcat auto start: ▐▌
█ # Tomcat auto-start ▐▌
█ # ▐▌
█ # description: Auto-starts tomcat ▐▌
█ # processname: tomcat ▐▌
█ # pidfile: /var/run/tomcat.pid ▐▌
█ ▐▌
█ export JAVA_HOME=/usr/lib/jvm/java-6-sun ▐▌
█ ▐▌
█ case $1 in ▐▌
█ start) ▐▌
█ sh /usr/local/tomcat-6.0.20/bin/startup.sh ▐▌
█ ;; ▐▌
█ stop) ▐▌
█ sh /usr/local/tomcat-6.0.20/bin/shutdown.sh ▐▌
█ ;; ▐▌
█ restart) ▐▌
█ sh /usr/local/tomcat-6.0.20/bin/shutdown.sh ▐▌
█ sh /usr/local/tomcat-6.0.20/bin/startup.sh ▐▌
█ ;; ▐▌
█ esac ▐▌
█ exit 0 ▐▌
█ ▐▌
█ ▐▌
█ Then: ▐▌
█ chmod 755 /etc/init.d/tomcat ▐▌
█ chmod 755 /usr/local/tomcat-6.0.20/bin/*.sh ▐▌
█ ▐▌
█ ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat ▐▌
█ ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat ▐▌
█ exit ▐▌
█ ▐▌
█ Done :) Now try it out: ▐▌
█ http://yoursite.com:8080/ ▐▌
█ You should see: ▐▌
█ If you're seeing this page via a web browser, it means you've setup Tomcat ▐▌
█ successfully. Congratulations! ▐▌
█ ▐▌
█ Do not click on 'Status' or 'Tomcat Manager' yet, as it needs a login name ▐▌
█ and password set. For security there is not a default login. ▐▌
█ ▐▌
█ NOTES: ▐▌
█ `````` ▐▌
█ If you need to view your logs there are here: ▐▌
█ /usr/local/tomcat-6.0.20/logs/ ▐▌
█ For example if you are getting java errors/'stack trace' errors do the ▐▌
█ following to locate them: ▐▌
█ cd /usr/local/tomcat-6.0.20/logs ▐▌
█ grep -l Exception *.log ▐▌
█ ▐▌
█ LOGIN AND PASSWORD: ▐▌
█ ``````````````````` ▐▌
█ Set up your own login information for administering Tomcat: ▐▌
█ pico /usr/local/tomcat-6.0.20/conf/tomcat-users.xml ▐▌
█ Had this: ▐▌
█ <tomcat-users> ▐▌
█ <!-- ▐▌
█ <role rolename="tomcat"/> ▐▌
█ <role rolename="role1"/> ▐▌
█ <user username="tomcat" password="tomcat" roles="tomcat"/> ▐▌
█ <user username="both" password="tomcat" roles="tomcat,role1"/> ▐▌
█ <user username="role1" password="tomcat" roles="role1"/> ▐▌
█ --> ▐▌
█ </tomcat-users> ▐▌
█ ▐▌
█ ▐▌
█ Changed to: ▐▌
█ ▐▌
█ <tomcat-users> ▐▌
█ <role rolename="manager"/> ▐▌
█ <user username="YourName" password="YourSafePassword" roles="manager"/> ▐▌
█ </tomcat-users> ▐▌
█ ▐▌
█ ▐▌
█ Restart Tomcat and then give your new login a try :): ▐▌
█ /etc/init.d/tomcat restart ▐▌
█ ▐▌
█ NOTES: ▐▌
█ a. Above changes to the .xml file I have removed the <!-- & --> , just ▐▌
█ like html; those act as commented out. ▐▌
█ ▐▌
█ b. Change "YourName" and "YouSafePassword" to your own new information. ▐▌
█ (never use the same password that you use for other logins on the site- ▐▌
█ security). ▐▌
█ ▐▌
█ c. When asking about the Manager Page in #tomcat a skilled user replied: ▐▌
█ [someone] Don't use the manager app. It is useless and (in old versions of ▐▌
█ tomcat) a vector for viruses. ▐▌
█ [someone] I can't help you with manager. I always delete it. ▐▌
█ ▐▌
█ Well since I'm not a skilled user, I feel my site is decently protected, ▐▌
█ it's not public, I have left the manager app for now. ▐▌
█ ▐▌
█ SETUP AUTO MONITORING OF TOMCAT'S STATUS: ▐▌
█ ````````````````````````````````````````` ▐▌
█ One way to have your Tomcat server monitored and receive an e-mail if it ▐▌
█ goes down and then comes back on line is by java-monitor's easy free ▐▌
█ service HERE. You can view a live demo HERE. You need to sign up, enter ▐▌
█ some simple information and it will create a configuration file specific ▐▌
█ to your account login only. Only you can see your stats, no one else can- ▐▌
█ unless you choose to share them. You will view your stats on their site; ▐▌
█ not your site. ▐▌
█ 1. Sign up for account, you'll need to give them your site's address of ▐▌
█ course. ▐▌
█ 2. It will generate and zip a file specific to your account. ▐▌
█ 3. Download then upload that file to your server, then: ▐▌
█ unzip java-monitor-probe.zip ▐▌
█ su ▐▌
█ mv ~/java-monitor.war /usr/local/tomcat-6.0.20/webapps/java-monitor.war ▐▌
█ exit ▐▌
█ Done :) To view stats, login to your java-montior account. ▐▌
█ ▐▌
█ NOTES: ▐▌
█ `````` ▐▌
█ A. To 'deploy a WAR file' it couldn't be simpler: Put it in the webapps ▐▌
█ directory. That's it :D. ▐▌
█ ▐▌
█ B. This .war file will create a directory 'java-monitor' with a set of ▐▌
█ sub-directories and files. To see what is presently residing in your ▐▌
█ webapps directory: ls -l /usr/local/tomcat-6.0.20/webapps/ ▐▌
█ ▐▌
█ C. To change the default port for Tomcat: ▐▌
█ pico /usr/local/tomcat-6.0.20/conf/server.xml ▐▌
█ Search for 8080 and replace that with a port that isn't in use and is ▐▌
█ greater than 1024; as ports less than or equal to 1024 require superuser ▐▌
█ access to bind under UNIX. ▐▌
█ ▐▌
█ D. If you want 'https' on port 8443 ▐▌
█ 1. First be sure that port isn't in use ▐▌
█ 2. uncomment 8443 settings. ▐▌
█ For myself I've already used port 8443 for AjaxTerm so I replaced port ▐▌
█ 8443 entries with another SSL capable port. ▐▌
█ 3. Then restart Tomcat: /etc/init.d/tomcat restart ▐▌
█ ▐▌
█ E. Better security: To run Tomcat not as root, but as an unprivileged user ▐▌
█ there are a number of suggestions/settings HERE, scroll down to read all ▐▌
█ the user's post. I haven't tried any yet, thus not in this tut. ▐▌
█ ▐▌
█ //---------------------------------------------------------------------- ▐▌
█ ▐▌
█ If you find mistakes, have suggestions, and or questions please post at ▐▌
█ mewbies forum HERE - thank you. ▐▌
█ ▐▌
█ Last update on 23 Jul '09 ▐▌
█ ▐▌
█▌ █▌
█▌ - mewbies.com - █▌
█▌ █▌
██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██