This article will show you how to install Jetty 9 on Ubuntu 12.04. Perform all steps as root.

Jetty requires Java. Install Java first, I prefer openjdk instead of oracle jdk, but it should work both.

apt-get install openjdk-7-jdk

Create a symlink for easier reference from jetty

mkdir /usr/java
ln -s /usr/lib/jvm/java-7-openjdk-amd64 /usr/java/default

Go to the opt directory

cd /opt

Download the latest Jetty distribution (9.x).

wget ""
mv download.php\?file\=%2Fjetty%2Fstable-9%2Fdist%2Fjetty-distribution-9.0.0.M3.tar.gz\&r\=1  jetty-distribution-9.0.0.M3.tar.gz

Unpack the archive

tar -xvf jetty-distribution-9.0.0.M3.tar.gz
mv jetty-distribution-9.0.0.M3 jetty

Create jetty user and make it the owner of /opt/jetty

useradd jetty -U -s /bin/false
chown -R jetty:jetty /opt/jetty

Copy Jetty script to run as service

cp /opt/jetty/bin/ /etc/init.d/jetty

Create the settings file /etc/default/jetty

nano /etc/default/jetty

and paste the following in it

JAVA=/usr/bin/java # Path to Java
NO_START=0 # Start on boot
JETTY_HOST= # Listen to all hosts
JETTY_USER=jetty # Run as this user

Start Jetty as service

service jetty start

It should now be running on port 8085! Visit in your browser and you should see a Jetty screen.

Verify / check your configuration with:

service jetty check

To let Jetty automatically start on reboot execute

update-rc.d jetty defaults

Reboot the server and test if Jetty starts automatically


To check if Jetty is really running on that port or to see if it conflicts with another application running on that port run

netstat -tln

Remove the unsecure test and async-rest application:

cd /opt/jetty/webapps
rm -rf test.d/ test.war test.xml async-rest.war

Or in Jetty 9.0.3:

rm -rf /opt/jetty/webapps.demo