Created
August 24, 2022 15:48
-
-
Save gigsforlinux/aedb8c58a5c637624b9de72aa1bbe14a to your computer and use it in GitHub Desktop.
I'll Do Anything Goes With Apache Tomcat For You
This file contains 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 characters
sudo useradd -m -d /opt/tomcat -U -s /bin/false tomcat | |
sudo apt update | |
sudo apt install default-jdk | |
java -version | |
cd /tmp | |
wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.23/bin/apache-tomcat-10.0.23.tar.gz | |
sudo tar xzvf apache-tomcat-10*tar.gz -C /opt/tomcat --strip-components=1 | |
sudo nano /opt/tomcat/conf/tomcat-users.xml | |
<role rolename="manager-gui" /> | |
<user username="manager" password="manager_password" roles="manager-gui" /> | |
<role rolename="admin-gui" /> | |
<user username="admin" password="admin_password" roles="manager-gui,admin-gui" /> | |
sudo update-java-alternatives -l | |
sudo nano /etc/systemd/system/tomcat.service | |
[Unit] | |
Description=Tomcat | |
After=network.target | |
[Service] | |
Type=forking | |
User=tomcat | |
Group=tomcat | |
Environment="JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64" | |
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom" | |
Environment="CATALINA_BASE=/opt/tomcat" | |
Environment="CATALINA_HOME=/opt/tomcat" | |
Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid" | |
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC" | |
ExecStart=/opt/tomcat/bin/startup.sh | |
ExecStop=/opt/tomcat/bin/shutdown.sh | |
RestartSec=10 | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target | |
sudo systemctl daemon-reload | |
sudo systemctl start tomcat | |
sudo systemctl status tomcat | |
sudo ufw allow 8080 | |
http://localhost:8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment