Installing Jetty Server on CentOS

1. Download a Jetty distribution from http://download.eclipse.org/jetty/. Taking jetty-distribution-9.2.3.v20140905 as an example.

2. Extract files

cd /srv
tar zxf jetty-distribution-9.2.3.v20140905.tar.gz
ln -s jetty-distribution-9.2.3.v20140905 jetty

3. Create a new user and setup service

adduser -r -m jetty
chown -R jetty:jetty /srv/jetty
cd /etc/init.d
ln -s /srv/jetty/bin/jetty.sh jetty
chkconfig --add jetty
chkconfig --level 345 jetty on

4. Modify default configuration

JAVA_HOME=/usr/local/java/jdk1.8.0_20
JAVA=$JAVA_HOME/bin/java
JAVA_OPTIONS=" -server -Xms256m -Xmx1024m -XX:+DisableExplicitGC "
JETTY_HOME=/srv/jetty
JETTY_USER=jetty
JETTY_HOST=0.0.0.0
JETTY_LOGS=/srv/jetty/logs/
JETTY_ARGS=jetty.port=8000

Original source comes from http://www.copper-arrow.com/blog/jetty-web-server-centos-6. Made minor corrections based on latest jetty version.

Leave a Reply

Your email address will not be published. Required fields are marked *