Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to run a Tomcat application with Podman on a cPanel server

This guide shows you how to run a Java web app in a Podman container on your own server. It needs root access, so it is for VPS and dedicated server owners.

cPanel2 min read6 steps3 screenshots

What are these words?

Tomcat is a program that runs Java websites. A Java website is often packed in a file ending in .war.

Podman is a tool that runs containers. A container is like a lunch box. It holds an app and everything the app needs. The app stays apart from the rest of the server.

Many servers with cPanel do not ship Tomcat. Podman lets you add it without a messy install. Your server must have Podman installed. Ask Hostvento support if you are not sure.

Install Tomcat Using Podman

Before you start

  • Log in to your server over SSH as root. SSH is a safe way to type commands on a server.
  • Have your .war file ready.
  • Take a backup of the server first.

Steps

  1. Check that Podman is installed.
    podman --version
    This shows the Podman version.
  2. Make a folder for the app.
    mkdir -p /opt/tomcat/webapps
    This makes a folder to hold your app file.
  3. Copy your app.war file into /opt/tomcat/webapps.
  4. Start the container.
    podman run -d --name mytomcat -p 8080:8080 -v /opt/tomcat/webapps:/usr/local/tomcat/webapps:Z docker.io/library/tomcat:9
    This downloads Tomcat 9 and starts it in the background. Port 8080 on the server connects to port 8080 in the container. A port is a numbered door for network traffic.
  5. Check that it runs.
    podman ps
    This lists running containers. You should see mytomcat.
    Restart the Tomcat Service
  6. Open http://YOUR-SERVER-IP:8080/app in a browser. Replace the address with your own. The path matches your war file name.

Use your domain

Most people do not want a port number in the address. You can use Apache as a go-between. Apache is the web server cPanel uses. This is called a reverse proxy. It sends visitors from port 80 to port 8080. Setting this up needs a custom Apache rule. Ask Hostvento support if you need help.

Useful commands

  • podman logs mytomcat shows what the app prints.
  • podman stop mytomcat stops it.
  • podman start mytomcat starts it again.
Tip: Open port 8080 in the firewall only for testing. Close it after you set up the proxy.

Quick recap

  • Podman runs Tomcat inside a container.
    Create Proxy Configuration
  • Put your .war file in a folder and share it with the container.
  • Use podman run to start it and podman ps to check it.
  • Use an Apache proxy to serve it on your domain.