The home location of this user will be /opt/tomcat as this is where we are going to install Tomcat. The shell be set to /bin/false: $ sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat Now we are ready to proceed next step and download Tomcat. Step 3: Installing Apache Tomcat. To download the latest available package, head to Tomcat’s.
Apache Tomcat is another product released by the Apache Software Foundation. It is an open source implementation of the Java Servlet and JavaServer Pages (JSP) technologies. Tomcat is a web server used for hosting the Java-based web application. Apache Tomcat team has announced its latest Tomcat 9.0.14 release on Jan 18, 2018. This article helps you to Install Tomcat 9 on Ubuntu 18.04 & 16.04 LTS systems. Step 1 – Java Installation You must have Java installed on the system before installing Apache Tomcat on a Linux VPS.
Tomcat 9 required Java 8 or later version to work. You can check and verify that Java is installed with the right version.
Java -version java version '1.8.0144' Java(TM) SE Runtime Environment (build 1.8.0144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) If you don’t have Java installed on your system or installed a lower version, run below commands to satisfy requirements. Sudo apt-get update sudo apt-get install default-jdk Step 2 – Download & Install Tomcat 9 You need to download the Tomcat archive from its official download website or mirrors. Download and Install Tomcat 9 archive file using the following commands. You can also visit to download latest available version. Wget tar xzf apache-tomcat-9.0.14.tar.gz sudo mv apache-tomcat-9.0.14 /usr/local/apache-tomcat9 Step 3 – Configure Environment Variables Now configure the required environment variables for the Tomcat. Set CATALINAHOME to the extracted tomcat directory. Also, set Java environment variables as per Java installed on your system.
Echo 'export CATALINAHOME='/usr/local/apache-tomcat9' /.bashrc echo 'export JAVAHOME='/usr/lib/jvm/java-8-oracle' /.bashrc echo 'export JREHOME='/usr/lib/jvm/java-8-oracle/jre' /.bashrc source /.bashrc Step 4 – Setup Tomcat User Accounts Finally we need to create user accounts to secure and access admin/manager pages. Edit conf/tomcat-users.xml file in your editor and paste inside tags.
After making changes restart Tomcat service. Step 6 – Starting Tomcat Service Tomcat is very easy to use, There is no need to compile its source. You simply extract the archive and start the tomcat server. Tomcat by default start on port 8080, So make sure no other application using the same port. Cd /usr/local/apache-tomcat9 chmod +x./bin/startup.sh./bin/startup.sh Sample Output Using CATALINABASE: /usr/local/apache-tomcat9 Using CATALINAHOME: /usr/local/apache-tomcat9 Using CATALINATMPDIR: /usr/local/apache-tomcat9/temp Using JREHOME: /usr/lib/jvm/java-8-oracle/jre Using CLASSPATH: /usr/local/apache-tomcat9/bin/bootstrap.jar:/usr/local/apache-tomcat9/bin/tomcat-juli.jar Tomcat started. Step 7 – Access Tomcat in Browser Tomcat server default works on port 8080. Access tomcat in the web browser by connecting your server on port 8080.
Access Tomcat Home- This is default home screen of tomcat 9. There are no authentication required to access this page. Access Manager App- Click on Manager App link displayed on home page.This page is allowed for Admin and Manager access both. Access Host Manager Page:- Click on the Host Manager link on your Tomcat home.This page is allowed for Admin access only.
Reading Time: 2 minutes Apache Tomcat is used to deploy and serve JavaServer Pages and Java servlets. It is an open source technology based off Apache. Pre-Flight Check. 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 cd into that folder after completion. Mkdir /opt/tomcat cd /opt/tomcat Step 2: Install Tomcat Through Wget Click this link to the 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: wget http://apache.spinellicreations.com/tomcat/tomcat-8/v8.5.32/bin/apache-tomcat-8.5.32.tar.gz. 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, check out this article: After the download completes, decompress the file in your tomcat folder: tar xvzf apache-tomcat-8.5.32.tar.gz 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: java -version If that command returns the following message then Java has yet to be installed: The program 'java' can be found in the following packages: To install Java, simply run the following command (and at the prompt enter Y to continue): apt-get install default-jdk Step 4: Configure.bashrc File Set the environment variables in.bashrc with the following command: vim /.bashrc Add this information to the end of the file: export JAVAHOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 export CATALINAHOME=/opt/tomcat/apache-tomcat-8.5.32. 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:. /.bashrc Step 5: Test Run Tomcat and Java should now be installed and configured on your server.
To activate Tomcat, run the following script: $CATALINAHOME/bin/startup.sh You should get a result similar to: Using CATALINABASE: /opt/tomcat Using CATALINAHOME: /opt/tomcat Using CATALINATMPDIR: /opt/tomcat/temp Using JREHOME: /usr/lib/jvm/java-7-openjdk-amd64/ Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar Tomcat started 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. Author Bio About the Author: Michelle Almendarez Michelle Almendarez started her love for technology at the University of Texas at San Antonio where she pursued a degree in Computer Science. She has written several Knowledge Base articles for Liquid Web starting in 2018. She has experience with video editing, web design and server management and in her free time likes to post cute pictures of her dog “Ghost” on Facebook. She sustains her healthy lifestyle by eating only organic farm raised tacos with her coffee daily.