User Tools

Site Tools


tomcat_letsencrypt


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tomcat_letsencrypt [2023/01/12 17:05] millerjstomcat_letsencrypt [2024/11/14 02:30] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Setup Tomcat9 in Ubuntu 20 ======+===== Install and Configure Tomcat 9.0.19 =====
 https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-10-on-ubuntu-20-04 https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-10-on-ubuntu-20-04
  
Line 5: Line 5:
 <code>sudo useradd -m -d /opt/tomcat -U -s /bin/false tomcat</code> <code>sudo useradd -m -d /opt/tomcat -U -s /bin/false tomcat</code>
      
-Update & Install JDK +Install JDK (Ubuntu) 
-<code>sudo apt update && sudo apt install default-jdk -y</code> +<code>sudo apt install default-jdk -y</code> 
-   + 
-Download Tomcat (9.0.19+Install JDK (CentOS/RHEL) 
-<code>wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.19/bin/apache-tomcat-9.0.19.tar.gz</code>+<code>sudo dnf install java-latest-openjdk-headless</code> 
 + 
 +Download Tomcat (9.0.76
 +<code>wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.76/bin/apache-tomcat-9.0.76.tar.gz</code>
      
 Decompress Decompress
Line 16: Line 19:
 Give tomcat user ownership Give tomcat user ownership
 <code>sudo chown -R tomcat:tomcat /opt/tomcat/ && sudo chmod -R u+x /opt/tomcat/bin</code> <code>sudo chown -R tomcat:tomcat /opt/tomcat/ && sudo chmod -R u+x /opt/tomcat/bin</code>
-====== Notes for RHEL/CentOS/Oracle Linux ====== 
  
 +
 +===== Install and configure authbind =====
 +
 +=== Ubuntu ===
 +<code>sudo apt install authbind -y</code>
 +
 +=== CentOS/RHEL ===
 Get authbind from here: https://aaronsilber.me/2016/04/24/install-authbind-on-centos-7-x86_64-download-the-rpm/ Get authbind from here: https://aaronsilber.me/2016/04/24/install-authbind-on-centos-7-x86_64-download-the-rpm/
  
 <code>sudo rpm -Uvh https://s3.amazonaws.com/aaronsilber/public/authbind-2.1.1-0.1.x86_64.rpm</code> <code>sudo rpm -Uvh https://s3.amazonaws.com/aaronsilber/public/authbind-2.1.1-0.1.x86_64.rpm</code>
  
-Install default-jdk with:  
  
-<code>sudo yum install java-11-openjdk-devel</code> 
-====== Configure Tomcat9 to run through authbind ====== 
- 
-<code>sudo apt install authbind -y</code> 
 <code> <code>
-touch /etc/authbind/byport/80 +sudo touch /etc/authbind/byport/80 
-touch /etc/authbind/byport/443 +sudo touch /etc/authbind/byport/443 
-chmod 0755 /etc/authbind/byport/80 +sudo chmod 0755 /etc/authbind/byport/80 
-chmod 0755 /etc/authbind/byport/443 +sudo chmod 0755 /etc/authbind/byport/443 
-chown tomcat:tomcat /etc/authbind/byport/80 +sudo chown tomcat:tomcat /etc/authbind/byport/80 
-chown tomcat:tomcat /etc/authbind/byport/443+sudo chown tomcat:tomcat /etc/authbind/byport/443
 </code> </code>
  
Line 44: Line 48:
  
  
-====== Using A Local CA with Tomcat9 ====== +===== Using Lets Encrypt with Tomcat9 (single) =====
-===== Generate CA in xca(?) ====== +
- +
-====== Using Lets Encrypt with Tomcat9 (wildcard) ====== +
-Generate Cert: +
-<code>sudo certbot certonly --manual --preferred-challenges dns -d \*.synergeticlaboratories.net</code> +
- +
- +
- +
-====== Using Lets Encrypt with Tomcat9 (single) ======+
 This is the manual way. I'm sure there's an automated way but I haven't bothered to do that yet. This is the manual way. I'm sure there's an automated way but I haven't bothered to do that yet.
  
Line 233: Line 228:
   </Service>   </Service>
 </Server> </Server>
 +</code>
 +
 +===== tomcat systemd service file =====
 +<code>
 +[Unit]
 +Description=Apache Tomcat Web Application Container
 +After=network.target
 +
 +[Service]
 +Type=forking
 +
 +Environment="JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64"
 +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=root
 +Group=root
 +UMask=0007
 +RestartSec=10
 +Restart=always
 +
 +[Install]
 +WantedBy=multi-user.target
 </code> </code>
tomcat_letsencrypt.1673543126.txt.gz · Last modified: 2024/11/14 02:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki