A note on building Jetty on CentOS 7 without yum, which is famous for being lighter and faster than Tomcat I personally really like the restart of the service because it ends at an explosive speed. (Tomcat takes 5 minutes if you are not good at it)
Add jetty user (user name can be anything but easy to understand)
[root@localhost ]# useradd jetty
[root@localhost ]# passwd jetty
Download the JDK rpm from the URL below http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Bring the dropped .rpm to the target server
[root@localhost ]# yum localinstall jdk-8u111-linux-x64.rpm
#root and jetty.bash_export to profile Java_HOME=/usr/Java/jdk1.8.0_111/jre/Added
Dropped from jetty official and decompressed => Owner / Group change In the example below, it is placed in / opt, but you can use any path you like.
[root@localhost ]# wget http://central.maven.org/maven2/org/eclipse/jetty/jetty-distribution/8.1.21.v20160908/jetty-distribution-8.1.21.v20160908.tar.gz
[root@localhost ]# tar xzvf jetty-distribution-8.1.21.v20160908.tar.gz
[root@localhost ]# mv jetty-distribution-8.1.21.v20160908 /opt/jetty
[root@localhost ]# cd /opt
[root@localhost /opt]# chown -R jetty:jetty jetty
You need to manually create / register this area, which yum will do automatically.
[root@localhost /opt]# vim /usr/lib/systemd/system/jetty.service
[Unit]
Description=Jetty Application Containar
[Service]
Type=simple
EnvironmentFile=-/opt/jetty/etc/jetty-env
PIDFile=/opt/jetty/jetty.pid
User=jetty
Group=jetty
ExecStart=/opt/jetty/bin/jetty.sh start
ExecReload=/opt/jetty/bin/jetty.sh restart
ExecStop=/optjetty/bin/jetty.sh stop
StandardOutput=null
[Install]
WantedBy=multi-user.target
[root@localhost /opt]# systemctl daemon-reload
If you do not use firewalld for verification purposes, skip it and OK
[root@localhost ]# vim /usr/lib/firewalld/services/jetty.xml
<service>
<short>WWW (HTTP-jetty)</short>
<description>HTTP is the protocol used to serve Web pages. If you plan to make your Web server publicly available, enable this option. This option is not required for viewing pages locally or developing Web pages.</description>
<port protocol="tcp" port="8080"/>
</service>
[root@localhost ]# systemctl restart firewalld
[root@localhost ]# firewall-cmd --add-service=jetty --zone=public --permanent
success
[root@localhost ]# systemctl restart firewalld
First, start Jetty. Also, make sure that the service starts automatically when the OS starts.
[root@localhost ]# systemctl enable jetty
[root@localhost ]# systemctl start jetty
[root@localhost ]# systemctl status jetty
[root@localhost ]# ss -nat | grep 8080
LISTEN 0 100 :::8080 :::*
Access http: // [ip_addr]: 8080 with a web browser, and when the top page of jetty is displayed, it's OK.
Recommended Posts