Steps to Setup Jetty9 on Ubuntu 20.04 LTS

Hello, In this blog we are going to discuss how to install the Jetty9 on Ubuntu. Jetty is a free & open source HTTP Servlet Server, written in Java. It provides a web server and servlet container & providing additionally support for HTTP/2, Web Socket, OSGi, JMX, JNDI, & JAAS.

There are some steps to Setup Jetty9 on Ubuntu:

Step 1: Update the System.

apt-get update

Step 2: Install Java.

apt install openjdk-8-jdk

  • Check Java version.

java -version

  • Here is the command output.

root@ip-172-31-40-130:/home/ubuntu# java -version
openjdk version "1.8.0_312"
OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~20.04-b07)
OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)

Step 3; Install Jetty9 on system.

apt install jetty9

  • Here is the command output.

root@ip-172-31-40-130:/home/ubuntu# apt install jetty9
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
apache2-utils authbind libactivation-java libapache-pom-java libapr1 libaprutil1 libasm-java libatinject-jsr330-api-java
...
apache2-utils authbind jetty9 libactivation-java libapache-pom-java libapr1 libaprutil1 libasm-java libatinject-jsr330-api-java libcommons-logging-
.....
libservlet3.1-java libspring-beans-java libspring-core-java libtaglibs-standard-impl-java libtaglibs-standard-spec-java libtomcat9-java libwebsocket-api-java
0 upgraded, 35 newly installed, 0 to remove and 40 not upgraded.
Need to get 23.1 MB of archives.
After this operation, 30.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

  • Verify the Jetty.

apt show jetty9

  • Here is the command output.

root@ip-172-31-40-130:/home/ubuntu# apt show jetty9
Package: jetty9
Version: 9.4.26-1
Priority: optional
Section: universe/java
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian Java Maintainers <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 798 kB
...

Step 4: Start & Enable the jetty service.

systemctl start jetty9
&&
systemctl enable jetty9

  • Here is the command output.

root@ip-172-31-40-130:/home/ubuntu# systemctl start jetty9
root@ip-172-31-40-130:/home/ubuntu# systemctl enable jetty9
Synchronizing state of jetty9.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable jetty9

  • Check Jetty9 status.

systemctl status jetty9

  • Here is the command output.

root@ip-172-31-40-130:/home/ubuntu# systemctl status jetty9
● jetty9.service - Jetty 9 Web Application Server
Loaded: loaded (/lib/systemd/system/jetty9.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2022-01-27 08:48:02 UTC; 3min 15s ago
Docs: https://www.eclipse.org/jetty/documentation/current/
Main PID: 5838 (java)
Tasks: 24 (limit: 4693)
Memory: 74.6M
CGroup: /system.slice/jetty9.service
└─5838 /usr/bin/java -Djetty.home=/usr/share/jetty9

Step 5: Open the Jetty Installation.

http://server-ip:8080

  • Here is the output.

Leave a Reply