, , , , , , , , , ,

For latest updates on this post check
my new blog site

Jetty is a Java HTTP (Web) server and Java Servlet container. While Web Servers are usually associated with serving documents to people, Jetty is now often used for machine to machine communications, usually within larger software frameworks. Jetty is developed as a free and open source project as part of the Eclipse Foundation. The web server is used in products such as Apache ActiveMQ, Alfresco, Apache Geronimo, Apache Maven, Apache Spark, Google App Engine, Eclipse, FUSE, iDempiere, Twitter’s Streaming API and Zimbra. Jetty is also the server in open source projects such as Lift, Eucalyptus, Red5, Hadoop and I2P. Jetty supports the latest Java Servlet API (with JSP support) as well as protocols HTTP/2 and WebSocket.

This guide will help you to setup jetty on CentOS / RHEL

1. Install Java JDK as it is required to install and run Jetty

sudo yum install java-1.7.0-openjdk

2. Download jetty from http://download.eclipse.org/jetty/. As we have JDK 1.7 I will download Jetty server 9.2.12 as it is compatible to the JDK 1.7

wget http://download.eclipse.org/jetty/9.2.12.v20150709/dist/jetty-distribution-9.2.12.v20150709.tar.gz

3. Extract the downloaded tar.gz file to /opt

tar zxvf jetty-distribution-9.2.12.v20150709.tar.gz -C /opt/

4. Rename it to jetty

mv /opt/jetty-distribution-9.2.12.v20150709/ /opt/jetty

5. Create a user called jetty to run jetty web server on system startup

useradd -m jetty

6. Change ownership of extracted jetty directory

chown -R jetty:jetty /opt/jetty/

7. Copy or Symlink jetty.sh to /etc/init.d directory to create a start up script file for jetty web server

ln -s /opt/jetty/bin/jetty.sh /etc/init.d/jetty

8. Add script

chkconfig --add jetty

9. Auto start at 3,4 and 5 levels

chkconfig --level 345 jetty on

10. Add the following information in /etc/default/jetty, replace port and listening address with your value

vi /etc/default/jetty


11. Now start the jetty service

service jetty start

12. Jetty can be accessed using web browser http://your-ip-address:8080