Adobe Introduces Powerful Generative AI Tools in Photoshop
Artificial Intelligence

Adobe Introduces Powerful Generative AI Tools in Photoshop Beta

by Veronica
June 1, 2023
2

Adobe Photoshop beta AI will take your creativity to the...

Read more
Adobe Photoshop's Generative Fill Feature

Exploring the Power of Adobe Photoshop’s Generative Fill Feature

June 1, 2023
ChatGPT app

The Easiest Way to Download ChatGPT App Free

June 1, 2023
Nvidia Unveils Futuristic Gaming Experience at Computex 2023

Nvidia Unveils Futuristic Gaming Experience at Computex 2023, Blending Gaming and AI

May 29, 2023
NVIDIA and Microsoft Partner to Accelerate AI

NVIDIA and Microsoft Partner to Accelerate AI

May 25, 2023
Top 5 Data Science Courses in 2023 for Better Job Opportunities

Top 5 Data Science Courses in 2023 for Better Job Opportunities

March 1, 2023
LLM Connected with APIs

Gorilla: LLM Connected with APIs

June 1, 2023
Set Up Deep Learning with Nvidia, Cuda, cuDNN on Ubuntu

How to Set Up Deep Learning with Nvidia, CUDA, cuDNN on Ubuntu 22.04

May 27, 2023
Microsoft Guidance The Next-Gen Prompt Programming Language

Microsoft Guidance: The Next-Gen Prompt Programming Language

May 20, 2023
Leonardo AI Login

How to login and use Leonardo AI

June 1, 2023
How to Get Midjourney AI for Free

How to Get Midjourney AI for Free

May 29, 2023
Cloudbooklet
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Linux

How to Install Apache Tomcat 10 on Ubuntu 22.04 with Nginx

by Cloudbooklet
May 19, 2023
in Linux
Reading Time: 8 mins read
How to Install Apache Tomcat 10 on Ubuntu 22.04 with Nginx
Share on FacebookShare on TwitterShare on WhatsAppShare on Telegram

Install Apache Tomcat 10 on Ubuntu 22.04 with Nginx. Apache Tomcat is an open source web server and a servlet container which is mainly used to server Java based applications.

In this guide you are going to learn how to install Apache Tomcat 10 on Ubuntu 22.04 and secure the setup with Nginx and Let’s Encrypt SSL.

You might also like

Best PHP-FPM Configuration - Easy and Simple Calculation

Best PHP-FPM Configuration – Easy and Simple Calculation

June 1, 2023
How to Use ChatGPT in Linux Terminal

How to Use ChatGPT in Linux Terminal

May 19, 2023

Prerequisites

  • A server with Ubuntu 22.04 OS
  • A user with sudo privileges.

Initial Setup

Start by updating the server packages to the latest version available.

sudo apt update
sudo apt dist-upgrade -y

Create New User for Tomcat

It would be better if Tomcat runs as it’s own unprivileged user. Execute the following command to create a new user with required privileges for Tomcat. This user wont be allowed to be logged in to SSH.

sudo useradd -m -d /opt/tomcat -U -s /bin/false tomcat

Install Java

Install default JDK using the below command. Check here for more detailed guide to install Java.

sudo apt install default-jdk

Once the installation is completed, check the version using the following command.

java -version

Your output should be similar to the one below.

openjdk version "11.0.15" 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1)
OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1, mixed mode, sharing)

Install Apache Tomcat

Download the latest version of Tomcat from their official downloads page. Choose the tar.gz under the core section.

Download the archive using wget.

cd ~/
wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.21/bin/apache-tomcat-10.0.21.tar.gz

Extract the contents to /opt/tomcat directory.

sudo tar xzvf apache-tomcat-10*tar.gz -C /opt/tomcat --strip-components=1

Configure correct permissions for Tomcat files.

sudo chown -R tomcat:tomcat /opt/tomcat/
sudo chmod -R u+x /opt/tomcat/bin

Configure Admin Users

Now we need to setup users who can access the Host manager and the Manager pages in Tomcat.

Add the users with passwords in /opt/tomcat/conf/tomcat-users.xml

sudo nano /opt/tomcat/conf/tomcat-users.xml

Add the following lines before the end tag.

<role rolename="manager-gui" />
<user username="manager" password="secure_password" roles="manager-gui" />

<role rolename="admin-gui" />
<user username="admin" password="secure_password" roles="manager-gui,admin-gui" />

Now we have 2 users who can access the Manager and the Host manager pages.

Configure Tomcat as a Service

Here we will configure a systemd service to manage Tomcat to start, stop and restart automatically.

Note the Java location.

sudo update-java-alternatives -l
Output
java-1.11.0-openjdk-amd64      1111       /usr/lib/jvm/java-1.11.0-openjdk-amd64

Create a systemd file.

sudo nano /etc/systemd/system/tomcat.service

Add the following contents to the file.

[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

Replace JAVA_HOME variable with the one you noted before.

Reload systemd daemon for the changes to take effect.

sudo systemctl daemon-reload

Start Tomcat.

sudo systemctl start tomcat

Enable Tomcat to start at system boot.

sudo systemctl enable tomcat

Check Tomcat status.

sudo systemctl status tomcat
Output
● tomcat.service - Tomcat
     Loaded: loaded (/etc/systemd/system/tomcat.service; disabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-05-25 06:41:36 UTC; 6s ago
    Process: 5155 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=0/SUCCESS)
   Main PID: 5302 (java)
      Tasks: 29 (limit: 1151)
     Memory: 132.7M
     CGroup: /system.slice/tomcat.service

Install Nginx

Install Nginx using the following command.

sudo apt install nginx

Remove default configurations

sudo rm /etc/nginx/sites-available/default
sudo rm /etc/nginx/sites-enabled/default

Configure Nginx Proxy for Tomcat

Create new Nginx configuration

sudo nano /etc/nginx/sites-available/yourdomainname.conf

Paste the following

server {
     listen [::]:80;
     listen 80;

     server_name yourdomainname.com www.yourdomainname.com;

     location / {
         proxy_pass http://localhost:8080;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection 'upgrade';
         proxy_set_header Host $host;
         proxy_cache_bypass $http_upgrade;
    }
}

Save and exit the file.

Enable your configuration by creating a symbolic link.

sudo ln -s /etc/nginx/sites-available/yourdomainname.conf /etc/nginx/sites-enabled/yourdomainname.conf

Install Let’s Encrypt SSL with Certbot

Install Certbot package.

sudo apt install python3-certbot-nginx

Install SSL certificate using the below command.

sudo certbot --nginx --redirect --no-eff-email --agree-tos -m yo[email protected] -d yourdomainname.com -d www.yourdomainname.com

If your domain is pointed to the server the free SSL certificate will get installed and HTTP to HTTPS redirection will get configured automatically and Nginx will get restarted by itself for the changes to take effect.

If you want to restart you can check your Nginx configuration and restart it.

sudo nginx -t
sudo service nginx restart

Prepare yourself for a role working as an Information Technology Professional with Linux operating system

Verify Tomcat Installation

Now check your domain in your browser.

Install Apache Tomcat

Click Manager App, you will be prompted to enter username and password. Use the one we have configured in the Tomcat users section.

Manager App

You can also take a look on the Host Manager page.

Host Manager

You can also view the server status.

Conclusion

Now you have learned how to install Apache Tomcat on Ubuntu 22.04 and secure with Nginx and Let’s Encrypt SSL..

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Tags: TomcatUbuntuUbuntu 22.04
Share1Tweet1SendShare
Cloudbooklet

Cloudbooklet

Help us grow and support our blog! Your contribution can make a real difference in providing valuable content to our readers. Join us in our journey by supporting our blog today!
Buy me a Coffee

Related Posts

Install WordPress with Docker Compose, Nginx, Apache with SSL

WordPress Deployment Made Easy: Docker Compose, Nginx, Apache, SSL Setup Guide

May 20, 2023
How to Install WordPress on Docker

How to Install WordPress on Docker for Windows, macOS, and Linux

May 20, 2023
How to install python on Ubuntu

How to Install Python on Ubuntu 22.04?

May 31, 2023
what's new in node.js 20

What’s new in Node.js 20?

April 23, 2023

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

  • Trending
  • Comments
  • Latest
DragGAN The AI-Powered Image Editing Tool

DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

May 30, 2023
DragGAN AI editing Tool Install and Use DragGAN Photo Editor

DragGAN AI editing Tool Install and Use DragGAN Photo Editor

May 27, 2023
Bard API key

Everything You Need to Know About Google’s Bard API Key

May 20, 2023
Install PHP 8.1 on Ubuntu

How to Install or Upgrade PHP 8.1 on Ubuntu 20.04

May 17, 2023
DragGAN The AI-Powered Image Editing Tool

DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

78
Upgrade PHP version to PHP 7.4 on Ubuntu

Upgrade PHP version to PHP 7.4 on Ubuntu

28
Install Odoo 13 on Ubuntu 18.04 with Nginx - Google Cloud

Install Odoo 13 on Ubuntu 18.04 with Nginx – Google Cloud

25
Best Performance WordPress with Google Cloud CDN and Load Balancing

Best Performance WordPress with Google Cloud CDN and Load Balancing

23
Best PHP-FPM Configuration - Easy and Simple Calculation

Best PHP-FPM Configuration – Easy and Simple Calculation

June 1, 2023
ChatGPT Shared Links

ChatGPT Shared Links: A New Way to Share Your Conversations

June 1, 2023
Deepfake

Deepfake: The Rise of Synthetic Media

June 1, 2023
How to Setup SSH Keys on Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

May 31, 2023

Popular Articles

  • DragGAN The AI-Powered Image Editing Tool

    DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

    1509 shares
    Share 604 Tweet 377
  • DragGAN AI editing Tool Install and Use DragGAN Photo Editor

    393 shares
    Share 157 Tweet 98
  • Auto-Photoshop-Stable Diffusion-Plugin: A New Way to Create AI-Generated Images in Photoshop

    71 shares
    Share 28 Tweet 18
  • InternGPT: A New Way to Interact with ChatGPT

    56 shares
    Share 22 Tweet 14
  • Microsoft research Reveals GPT-4 AI Shows Promising Signs of Common Sense and Human-Like Reasoning

    97 shares
    Share 39 Tweet 24
Latest Technology Trends in Artificial Intelligence and Machine Learning with Cloudbooklet

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS

Cloudbooklet © 2023 All rights reserved.

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.