Install Apache Tomcat 8 on Ubuntu:
Apache Tomcat is used to deploy and serve Java Server Pages and Java servlets. It is an open source technology based off Apache.
- This document assumes you are installing Apache Tomcat on Ubuntu 16.04.
- Be sure you are logged in as root user.
Installing Apache Tomcat 8
Step 1: Create the Tomcat Folder
Logged in as root, within the opt folder make a directory called tomcat and cdinto that folder after completion.
Step 2: Install Tomcat Through Wget
- Click this link to the Apache Tomcat 8 Download site.
- Place you cursor under 8.5.32 Binary Distributions, right click on the tar file and select copy link address (as shown in the picture below).
- At the time of this article Tomcat 8 is the newest version but feel free to pick whatever version is more up-to-date.
Next from your server, use wget command to download the tar to the tomcat folder from the URL you copied in the previous step:
You can down the file to your local desktop, but you’ll then want to transfer the file to your Liquid Web server. If assistance is needed,
After the download completes, decompress the file in your tomcat folder:
Step 3: Install Java
Before you can use Tomcat you’ll have to install the Java Development Kit (JDK). Beforehand, check to see if Java is installed:
If that command returns the following message then Java has yet to be installed:
To install Java, simply run the following command (and at the prompt enter Y to continue):
Step 4: Configure .bashrc file
Set the environment variables in .bashrc with the following command:
Add this information to the end of the file:
Verify your file paths! If you downloaded a different version or already installed Java, you may have to edit the file path or name. Older versions of Java may say java-7-openjdk-amd64 instead of java-1.8.0-openjdk-amd64 . Likewise, if you installed Tomcat in a different folder other then /opt/tomcat (as suggested) you’ll indicate the path in your bash file and edit the lines above.
Save your edits and exit from the .bashrc file, then run the following command to register the changes
Step 5: Test Run
Tomcat and Java should now be installed and configured on your server.
To activate Tomcat, run the following script:
You should get a result similar to:
To verify that Tomcat is working visit the ip address of you server:8080 in a web browser. For example http://127.0.0.1:8080.