Apache Tomcat Installation

Published: May 15, 2022 by Ufkun Karaman

What is apache tomcat?, How to install and use apache tomcat?

Apache Tomcat Installation Process

1. Apache Tomcat

Apache tomcat is web server used to publish Java based web applications

2. Standard linux settings made in the operating system

  • Standard linux settings made in the operating system

    Standart-Confugration-For-OS

  • Define hostname

      hostnamectl set-hostname apache-tomcat-1 
    
    

3. Apache Tomcat Installation Process

  • Install Java
    • Install Java runtime environment.

        sudo apt install default-jdk 
      
    • Verify Java installation.

        java -version
      
  • Install Apache Tomcat
    • Download the latest version of Apache Tomcat. To find the latest Tomcat version, visit the official download page.

        wget https://kozyatagi.mirror.guzel.net.tr/apache/tomcat/tomcat-9/v9.0.62/bin/apache-tomcat-9.0.62.tar.gz -P /SETUP/
      
    • Extract the downloaded archive.

      mkdir /opt/tomcat -p
      tar -zxvf /SETUP/apache-tomcat-9.0.62.tar.gz --directory /opt/tomcat  --strip-components=1
      cd /opt/tomcat
    
    • Define Apache Tomcat Service file

        $ vim /etc/systemd/system/tomcat.service
              
        [Unit]
        Description=Tomcat
        After=network.target
              
        [Service]
        Type=forking
              
        User=root
        Group=root
              
        LimitNOFILE=65535
        LimitNPROC=65535
              
        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
              
        [Install]
        WantedBy=multi-user.target
      
    • Start Apache Tomcat Service ,

        sudo systemctl daemon-reload
        sudo systemctl start tomcat
        sudo systemctl enable tomcat
      
    • Verify Apache Tomcat installation.

        sudo systemctl status tomcat
      
    • Make simple confugration for our project

        echo "$hostname" > /opt/tomcat/webapps/ROOT/index.jsp
      
    • Verify Apache Tomcat installation.

        curl http://ServerIPaddress:8080
        #hostname
      
linux docs tomcat

Support Me

Buy Me A Coffee

Share

Latest Posts

Kuberentes Autoscale with Keda
Kubernetes Monitoring Stack
Helm Kuberentes Backup