Download: http://mirror.nbtelecom.com.br/apache/tomcat/tomcat-9/v9.0.24/bin/apache-tomcat-9.0.24.zip
Debian/Ubuntu
apt install default-jdk
useradd -r -m -U -d /opt/apache-tomcat -s /bin/false tomcat
chown -RH tomcat: /opt/apache-tomcat
sh -c 'chmod +x /opt/apache-tomcat/bin/*.sh'
vim /etc/systemd/system/tomcat.service
[Unit]
Description=Tomcat 9 servlet container
After=network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
Environment="JAVA_HOME=/usr/lib/jvm/default-java"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom -Djava.awt.headless=true"
Environment="CATALINA_BASE=/opt/apache-tomcat"
Environment="CATALINA_HOME=/opt/apache-tomcat"
Environment="CATALINA_PID=/opt/apache-tomcat/temp/tomcat.pid"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
ExecStart=/opt/apache-tomcat/bin/startup.sh
ExecStop=/opt/apache-tomcat/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
service tomcat start
service tomcat status
vim /opt/apache-tomcat/webapps/manager/META-INF/context.xml
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
vim /opt/apache-tomcat/conf/tomcat-users.xml
<tomcat-users>
<role rolename="manager-gui" />
<user username="manager" password="123" roles="manager-gui" />
<role rolename="admin-gui" />
<user username="admin" password="123" roles="manager-gui,admin-gui" />
</tomcat-users>
vim /opt/apache-tomcat/webapps/host-manager/META-INF/context.xml
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
service tomcat restart
Acesso de teste: http://<seu_ip>:8080
Fonte: https://linuxize.com/post/how-to-install-tomcat-9-on-ubuntu-18-04/
vim /etc/systemd/system/tomcat.service
[Unit]
Description=Tomcat 9 servlet container
After=network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
Environment="JAVA_HOME=/usr/lib/jvm/default-java"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom -Djava.awt.headless=true"
Environment="CATALINA_BASE=/opt/apache-tomcat"
Environment="CATALINA_HOME=/opt/apache-tomcat"
Environment="CATALINA_PID=/opt/apache-tomcat/temp/tomcat.pid"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
ExecStart=/opt/apache-tomcat/bin/startup.sh
ExecStop=/opt/apache-tomcat/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
service tomcat start
service tomcat status
vim /opt/apache-tomcat/webapps/manager/META-INF/context.xml
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
vim /opt/apache-tomcat/conf/tomcat-users.xml
<tomcat-users>
<role rolename="manager-gui" />
<user username="manager" password="123" roles="manager-gui" />
<role rolename="admin-gui" />
<user username="admin" password="123" roles="manager-gui,admin-gui" />
</tomcat-users>
vim /opt/apache-tomcat/webapps/host-manager/META-INF/context.xml
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
service tomcat restart
Acesso de teste: http://<seu_ip>:8080
Fonte: https://linuxize.com/post/how-to-install-tomcat-9-on-ubuntu-18-04/