Apache Tomcat is opensource web hosting server for Java based web application. Tomcat is licensed under Apache License version 2. Apache tomcat team has announced its latest alpha release 9.0.0.M1 (alpha) on Nov 19, 2015.
Warning: Apache Tomcat 9 is in Alpha release, Use this release for learning and development only. For production servers use Apache tomcat 8.
- Tomcat 9 requires JAVA 8 or higher to work.
- Tomcat 9 support for HTTP/2 (requires the APR/native library)
- Tomcat 9 support for TLS virtual hosting
- Tomcat 9 support for using OpenSSL for TLS support with the JSSE connectors (NIO and NIO2)
Install Tomcat 9
This article will help you to Install Tomcat 9 (alpha) on Ubuntu systems. Tomcat 9 alpha release is available for download. To install other version of tomcat visit Tomcat 7 on Ubuntu, Debian and LinuxMint.
Step 1: Verify JAVA
JAVA is the first requirement of Tomcat installation. Use following command to check if you have Java ( installed already on your system.
java -versionjava version " 1.8.0_66" Java(TM) SE Runtime Environment (build 1.8.0_66-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
Tomcat 9 is designed to run on Java SE 8 and later. So make sure you have installed correct version on your system. If you don’t have Java installed on your system or installed lower version, use one of following link to install Java first.
Step 2: Download Tomcat Archive
Download Apache Tomcat 9 archive file using following commands or you can visit Tomcat 9 official download page for download most recent available version. After downloading extract archive file in /opt directory. You may change this location as per your setup.
# cd /opt # wget http://www.us.apache.org/dist/tomcat/tomcat-9/v9.0.0.M1/bin/apache-tomcat-9.0.0.M1.tar.gz # tar
xzfapache-tomcat-9.0.0.M1.tar.gz # mv apache-tomcat-9.0.0.M1 tomcat9
Step 3: Configure Environment Variables
Before starting Tomcat, configure CATALINA_HOME environment variable in your system using following commands.
# echo "export CATALINA_HOME="/opt/tomcat9"" >> /etc/environment # echo "export JAVA_HOME="/usr/lib/jvm/java-8-oracle"" >> /etc/environment # echo "export JRE_HOME="/usr/lib/jvm/java-8-oracle/jre"" >> /etc/environment # source ~/.bashrc
Step 4: Setup 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 <tomcat-users> </tomcat-users> tags.
<!-- user manager can access only manager section --><role rolename=" manager-gui" /> <user username=" manager" password=" _SECRET_PASSWORD_" roles=" manager-gui" /> <!-- user admin can access manager and admin section both --><role rolename=" admin-gui" /> <user username=" admin" password=" _SECRET_PASSWORD_" roles=" manager-gui,admin-gui" />
Step 5: Starting Tomcat
Tomcat is very easy to use, There are no need to compile its source. You simple 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 /opt/tomcat9 # ./bin/startup.sh
Using CATALINA_BASE: /opt/tomcat9 Using CATALINA_HOME: /opt/tomcat9 Using CATALINA_TMPDIR: /opt/tomcat9/temp Using JRE_HOME: /usr/lib/jvm/java-8-oracle/jre Using CLASSPATH: /opt/tomcat9/bin/bootstrap.jar:/opt/tomcat9/bin/tomcat-juli.jar Tomcat started.
Step 6: Access Tomcat in Browser
Tomcat server default works on port 8080. Access tomcat on web browser by connecting your server on port 8080.