• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to install Tomcat9 on Ubuntu 16.04

2225

To install Tomcat9 on Ubuntu 16.04

Apache Tomcat is an open source web hosting server and servlet container from Apache Software Foundation. It executes Java servlets and renders Web pages for the Java-based web application. In fact, Apache Tomcat is one of the most popularly used web servers among the java developers. It is really simple to install Apache Tomcat on Ubuntu 16.04, and this article covers the ground on the same process.

Installing Tomcat9

It is really very essential to install Java, so make sure you run the following command.

root@linuxhelp11:~# apt-get install default-jdk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gnome-software-common libgtkspell3-3-0
Use ' sudo apt autoremove'  to remove them.
The following additional packages will be installed:
  ca-certificates-java default-jdk-headless default-jre default-jre-headless
  fonts-dejavu-extra java-common libgif7 libice-dev libpthread-stubs0-dev
  libsm-dev libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev
  libxt-dev openjdk-8-jdk openjdk-8-jdk-headless openjdk-8-jre
  openjdk-8-jre-headless x11proto-core-dev x11proto-input-dev x11proto-kb-dev
  xorg-sgml-doctools xtrans-dev
.
.
.
Updating certificates in /etc/ssl/certs...
0 added, 0 removed  done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.


Once it is installed, you shall check the version of Java which you’ ve just installed. Run the following command for the same purpose.

root@linuxhelp11:~# java -version
openjdk version " 1.8.0_151" 
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)


Once it is done, you need to create a user for Tomcat. Run the command for that.

root@linuxhelp11:~# useradd -r tomcat9 --shell /bin/false

Then enter into the opt location through the following command.

root@linuxhelp11:~# cd /opt  

Now, you shall download tomcat9 package by using the wget command in the following manner.

root@linuxhelp11:/opt# wget http://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.1/bin/apache-tomcat-9.0.1.tar.gz
--2017-11-19 05:39:43--  http://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.1/bin/apache-tomcat-9.0.1.tar.gz
Resolving www-eu.apache.org (www-eu.apache.org)... 195.154.151.36, 2001:bc8:2142:300::
Connecting to www-eu.apache.org (www-eu.apache.org)|195.154.151.36|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9397803 (9.0M) [application/x-gzip]
Saving to: ‘ apache-tomcat-9.0.1.tar.gz’ 

apache-tomcat-9.0.1 100%[===================> ]   8.96M  9.51MB/s    in 0.9s    

2017-11-19 05:40:35 (9.51 MB/s) - ‘ apache-tomcat-9.0.1.tar.gz’  saved [9397803/9397803]

Then, extract the downloaded file as follows.

root@linuxhelp11:/opt# tar -zxf apache-tomcat-9.0.1.tar.gz

After that, you need to create a symbolic link for extracted directory in the following manner.

root@linuxhelp11:/opt# ln -s apache-tomcat-9.0.1 tomcat-latest

Later, you need to change the ownership of the extracted directory.

root@linuxhelp11:/opt# chown -R tomcat9: tomcat-latest apache-tomcat-9.0.1

Once it is done, you need to create a user for manager and admin in tomcat-user file. Using the vim editor, create a new file.

root@linuxhelp11:/opt# vim tomcat-latest/conf/tomcat-users.xml

And, in that file, you need to add the following lines.

< role rolename=" manager-gui" /> 
< role rolename=" admin-gui" /> 
< user username=" admin"  password=" password"  roles=" manager-gui,admin-gui" /> 

Once the above part is over, you need to make an entry to allow the server. So open the file.

root@linuxhelp11:/opt# vim tomcat-latest/webapps/manager/META-INF/context.xml

And in that file, you need to give your server ip.

< Valve className=" org.apache.catalina.valves.RemoteAddrValve" 
         allow=" 127.d+.d+.d+|::1|0:0:0:0:0:0:0:1|<  server ip > "  /> 

You should also add your server ip in another location as well. And for that, go to the following location.

root@linuxhelp11:/opt# vim tomcat-latest/webapps/host-manager/META-INF/context.xml

And in that file, modify the server ip to yours.

< Valve className=" org.apache.catalina.valves.RemoteAddrValve" 
         allow=" 127.d+.d+.d+|::1|0:0:0:0:0:0:0:1|<  server ip > "  /> 

Next, you need to configure the daemon file to start and stop tomcat service. So, open the file.

root@linuxhelp11:/opt# vim /etc/systemd/system/tomcat.service

And add the following lines to it.

[Unit]
Description=Tomcat9
After=network.target

[Service]
Type=forking
User=tomcat9
Group=tomcat9

Environment=CATALINA_PID=/opt/tomcat-latest/tomcat9.pid
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
Environment=CATALINA_HOME=/opt/tomcat-latest
Environment=CATALINA_BASE=/opt/tomcat-latest
Environment=" CATALINA_OPTS=-Xms512m -Xmx512m" 
Environment=" JAVA_OPTS=-Dfile.encoding=UTF-8 -Dnet.sf.ehcache.skipUpdateCheck=true -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC" 

ExecStart=/opt/tomcat-latest/bin/startup.sh
ExecStop=/opt/tomcat-latest/bin/shutdown.sh

[Install]
WantedBy=multi-user.target

Once it is done, you need to reload the daemon as follows.

root@linuxhelp11:/opt# systemctl daemon-reload

Then, start the Tomcat service.

root@linuxhelp11:/opt# systemctl start tomcat


And, enable it as follows.

root@linuxhelp11:/opt# systemctl enable tomcat
Created symlink from /etc/systemd/system/multi-user.target.wants/tomcat.service to /etc/systemd/system/tomcat.service.

Now, open a browser and give localhost:8080 as the URL . The home page of Tomcat appears on your screen.
Home

If you want to open the manager app, then click on it.
Manager


And give your login credentials in the popup that appears.
Login

The Manager page of Tomcat now appears.
Tomcat


Application


If you want to open the VirtualHost for admin panel, then click on Host manage.
Admin

In that popup, give your credentials.
Popup

The Host page now appears.
Host


Virtual

With this, the installation of Tomcat9 comes to an end.

Tags:
matthew
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What's the difference between JK and mod_jk ?

A

JK is a project covering web-servers to Tomcat connectors, whereas mod_jk is the Apache module developped in JK.

Domino webserver support is implemented on JK, using a redirector called dsa

Q

Which protocol should I use? Ajp12 or Ajp13?

A

Ajp13 is a newer protocol, it's faster, and it works better with SSL. You almost certainly want to use it now that ajp12 is deprecated.

Also ajp13 is supported by all Apache Tomcat includin

Q

What is Tomcat9 on Ubuntu?

A

Apache Tomcat is an open source web hosting server and servlet container from Apache Software Foundation. It executes Java servlets and renders Web pages for the Java-based web application. In fact, Apache Tomcat is one of the most popularly used web servers among the java developers.

Q

How to check the current version of java?

A

USe the following command:
# java -version

Q

How to download the Tomcat9 package on Ubuntu?

A

Run the following command:
# wget http://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.1/bin/apache-tomcat-9.0.1.tar.gz

Related Tutorials in How to install Tomcat9 on Ubuntu 16.04

Related Tutorials in How to install Tomcat9 on Ubuntu 16.04

How to install Meld tool in Ubuntu
How to install Meld tool in Ubuntu
Feb 25, 2017
How to install Dconf-Editor on Ubuntu 18.04
How to install Dconf-Editor on Ubuntu 18.04
Jul 14, 2018
How to install and update OpenSSL on Ubuntu 16.04
How to install and update OpenSSL on Ubuntu 16.04
Mar 9, 2017
How to install GLib 2.0 on Ubuntu 17.04
How to install GLib 2.0 on Ubuntu 17.04
May 22, 2017
How to Install Android Emulator on Ubuntu 20.4.1
How to Install Android Emulator on Ubuntu 20.4.1
Jul 13, 2021
How To Install AnyDesk on Ubuntu 16.04
How To Install AnyDesk on Ubuntu 16.04
Apr 4, 2018
How to install Genymotion 2.12.1 on Ubuntu 18.04
How to install Genymotion 2.12.1 on Ubuntu 18.04
Jul 9, 2018
How to install Timeshift 18.4 on Ubuntu 18.04
How to install Timeshift 18.4 on Ubuntu 18.04
Jul 6, 2018

Related Forums in How to install Tomcat9 on Ubuntu 16.04

Related Forums in How to install Tomcat9 on Ubuntu 16.04

Ubuntu
matthew class=
Failed to enable unit: Refusing to operate on linked unit file sshd.service
Apr 15, 2019
Ubuntu
mason class=
Passwd: You may not view or modify password information for root On Ubuntu 19.04
May 27, 2019
Ubuntu
isaac class=
/etc/apt/sources.list Permission denied
May 18, 2017
Ubuntu
yousuf class=
lsb_release command not working : Debian
Jan 18, 2018
ifconfig command
jackbrookes class=
what is the location of the ifconfig program on your machine?
Jan 4, 2018
Ubuntu
mason class=
"E: Package 'php-mcrypt' has no installation candidate" error on Ubuntu 20.4.1
Mar 15, 2021
NFS
luke class=
clnt_create: RPC: Program not registered
Apr 25, 2017
Apache
isaac class=
How to disable apache welcome page on Ubuntu
Dec 15, 2018

Related News in How to install Tomcat9 on Ubuntu 16.04

Related News in How to install Tomcat9 on Ubuntu 16.04

How To Install Mixxx on Ubuntu 16.04
How To Install Mixxx on Ubuntu 16.04
Oct 11, 2017
Ubuntu 17.04 released with greater expectations
Ubuntu 17.04 released with greater expectations
Apr 15, 2017
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Mar 1, 2017
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Sep 2, 2017
Ubuntu Unity is no more: One Linux dream has been axed
Ubuntu Unity is no more: One Linux dream has been axed
Apr 7, 2017
What’s next for Ubuntu Linux Desktop?
What’s next for Ubuntu Linux Desktop?
Apr 11, 2017
Say Hi to Ubuntu's new mascot
Say Hi to Ubuntu's new mascot
Mar 22, 2019
KDE Connect App was removed from Google Play Store and brought back in 24 hours
KDE Connect App was removed from Google Play Store and brought back in 24 hours
Mar 22, 2019
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Ryan ?
how to use visual traceroute tool

Am using traceroute command to check for the route. i got this tool while surfing. So pls help me out installation and usage of Visual traceroute tool.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.