# create download directories mkdir -p ~/build/jetty cd ~/build/jetty # download version="9.0.0.v20130308" wget -O jetty-distribution-$version.tar.gz "http://eclipse.org/downloads/download.php?file=/jetty/stable-9/dist/jetty-distribution-$version.tar.gz&r=1" # extract the archive - creates directory jetty-distribution-.... tar -xvf jetty-distribution-$version.tar.gz # rename jetty directory sudo mv jetty-distribution-$version /usr/local # create jetty user sudo useradd -U -s /bin/false jetty # Copy Jetty script to run as service sudo chown -R jetty:jetty /opt/jetty # move jetty.sh to init.d sudo cp /opt/jetty/bin/jetty.sh /etc/init.d/jetty # create /etc/default/jetty sudo sh -c ' printf " JAVA_HOME=/usr/java/default # Path to Java NO_START=0 # Start on boot JETTY_HOST=0.0.0.0 # Listen to all hosts JETTY_PORT=8080 # Run on this port JETTY_USER=jetty # Run as this user " > /etc/default/jetty' # make webapps writable sudo chmod o+w /etc/default/jetty/webapps # check if the installation settings are ok /opt/jetty/bin/jetty.sh check # Start Jetty as service sudo service jetty start # Start Jetty as service sudo service jetty stop # the server runs on the default port of 8080 # http://localhost:8080/ # To let Jetty automatically start on reboot execute sudo update-rc.d jetty defaults # deploy an app cd myapp.war /opt/jetty/webapps #In case port conflicts, you can check wich application is blocking port 8080 sudo netstat -lnptu|grep ":8080" # monitor jetty log files ls -l /opt/jetty/logs
References
1. Home: http://www.eclipse.org/jetty/
2. Documentation: http://www.eclipse.org/jetty/documentation/current/
3. Installation Tip: http://pietervogelaar.nl/ubuntu-12-04-install-jetty-9/
Leave a Reply