Install Oracle's JDK
Install Java, see here
Set the JAVA_HOME, CATALINA_HOME and PATH environment variables
The JAVA_HOME variable is used by Java Servers such as Tomcat and JBoss.
The CATALINA_HOME variable is required by when running Tomcat from command line
to locate the files stored in $CATALINA_HOME/conf and $CATALINA_HOME/logs directories.
To set user environment variables edit the
~/.profile:
max@ubuntu-host:~$ nano ~.profile
Append the following lines to the ~.profile file:
export JAVA_HOME=/usr/lib/jvm/java-8-oracle export CATALINA_HOME=/opt/apache-tomcat-8.0.38 export PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
Tomcat Installation
To Download the latest version of tomcat from apache. Choose the binary distribution tar.gz. Copy the destination link and past it in the terminal after the wget command. You shoul get something alike:
~$ wget http://www-us.apache.org/dist/tomcat/tomcat-8/v8.0.38/bin/apache-tomcat-8.0.38.tar.gz
Untar the binary archive:
~$ tar -xvf apache-tomcat-8.0.38.tar.gz
Copy the folder to /opt directory:
~$ sudo cp -R apache-tomcat-8.0.38 /opt/apache-tomcat-8.0.38
Change owner user and owner group of the /opt/apache-tomcat-8.0.38 directory:
~$ sudo chown max:max -R /opt/apache-tomcat-8.0.38
Finally, you get an /opt/apache-tomcat-8.0.38 directory and the its owner is the user logged in:
max@ubuntu-host:/opt$ ls -l total 18 drwxrwxr-x 9 max max 4096 Aug 15 17:10 apache-tomcat-8.0.38 drwxrwxr-x 8 max max 4096 Aug 15 15:31 eclipse-jee-neon drwxr-xr-x 3 root root 4096 Jul 31 09:57 extras.ubuntu.com drwxr-xr-x 3 root root 4096 Jul 30 21:22 google drwxr-xr-x 4 root root 4096 Aug 8 16:19 sublime_text
Common Tomcat Commands
To start tomcat, type on the shell:
~$ startup.sh
To stop tomcat, type on the shell:
~$ shutdown.sh
To read the log file:
cd /opt/apache-tomcat-8.0.38/log ~$ tail -f catalina.out
Test Tomcat installation by pointing your browser to: http://localhost:8080
Manager Web Application
The Manager App is an application that comes with Tomcat and allows you to start, stop, reload and undeploy web applications installed in Tomcat
To allow the access to the Manager App, you must add a manager user to the tomcat users configuration file.
Edit the file /opt/tomcat-8/conf/tomcat-users.xml, and add the following two lines:
<tomcat-users> ... <role rolename="manager-gui"/> <user username="manager" password="password" roles="manager-gui"/> </tomcat-users>
No comments:
Post a Comment