Last active
August 20, 2017 11:32
-
-
Save imesh/c8f5ca82b193130611289b05d162fa9d to your computer and use it in GitHub Desktop.
Revisions
-
imesh revised this gist
Aug 20, 2017 . No changes.There are no files selected for viewing
-
imesh created this gist
Aug 20, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ #!/bin/bash sudo apt-get update sudo apt-get install default-jdk sudo groupadd tomcat sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat wget http://www-eu.apache.org/dist/tomcat/tomcat-8/v8.5.20/bin/apache-tomcat-8.5.20.tar.gz sudo tar -xzvf apache-tomcat-8.5.20.tar.gz mv apache-tomcat-8.5.20 /opt/tomcat sudo chgrp -R tomcat /opt/tomcat sudo chown -R tomcat /opt/tomcat sudo chmod -R 755 /opt/tomcat cat > /etc/systemd/system/tomcat.service <<EOF [Unit] Description=Apache Tomcat Web Server After=network.target [Service] Type=forking Environment=JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid Environment=CATALINA_HOME=/opt/tomcat Environment=CATALINA_BASE=/opt/tomcat Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom' ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh User=tomcat Group=tomcat UMask=0007 RestartSec=15 Restart=always [Install] WantedBy=multi-user.target EOF sudo systemctl daemon-reload sudo systemctl start tomcat sudo systemctl status tomcat