Apache Tomcat 10 is an open-source Java servlet container developed by the Apache Software Foundation. It provides a powerful and reliable environment to deploy and run Java-based web applications.
In this guide, we’ll walk through installing and configuring Apache Tomcat 10 on AlmaLinux, a stable and secure RHEL-based distribution widely used for enterprise servers.
The installation process on AlmaLinux is quite similar to that on Ubuntu, with a few differences in package management and service configuration.
Steps to Install and Configure Apache Tomcat 10 on AlmaLinux
Step 1: Update Your System
First, update all system packages to ensure you’re working with the latest versions.
#dnf update
Step 2: Install Java (JDK)
Tomcat requires Java to run. Install the default OpenJDK 17 package (recommended for Tomcat 10):
#dnf install java-17-openjdk java-17-openjdk-devel
Verify Java installation:
#java -version
You should see an output similar to:
#openjdk version "17.x.x" 2024-xx-xx
Step 3: Create a Tomcat User and Group
Create a dedicated user and group for running Tomcat:
#groupadd tomcat
#useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
Step 4: Download and Extract Apache Tomcat 10
Navigate to /opt and download the latest ApacheTomcat 10 version:
#cd /opt
#wget https://archive.apache.org/dist/tomcat/tomcat-10/v10.1.48/bin/apache-tomcat-10.1.48.tar.gz
Extract it into /opt/tomcat:
#mkdir /opt/tomcat
#tar -xvzf apache-tomcat-10.1.48.tar.gz -C /opt/tomcat --strip-components=1
Then remove the downloaded archive:
#rm -rf apache-tomcat-10.1.48.tar.gz
Step 5: Set Permissions
Assign the correct ownership and execution permissions:
#chown -R tomcat:tomcat /opt/tomcat
#chmod -R u+x /opt/tomcat/bin
Step 6: Configure Tomcat Users
Edit the Tomcat user configuration file to add roles and a management user:
#vim /opt/tomcat/conf/tomcat-users.xml
Add the following between <tomcat-users> tags:
<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" />
Next, allow remote access to the Tomcat Manager and Host Manager (optional but useful for testing):
#vim /opt/tomcat/webapps/manager/META-INF/context.xml
#vim /opt/tomcat/webapps/host-manager/META-INF/context.xml
Comment out or edit the following line in both files:
<Valve className=”org.apache.catalina.valves.RemoteAddrValve”
allow=”127\.\d+\.\d+\.\d+|::1″/>
Change to:
<!-- <Valve className="org.apache.catalina.valves.RemoteCIDRValve"
allow="127.0.0.0/8,::1/128" /> -->
Step 7: Create a Systemd Service for Tomcat
Create a new systemd service file:
#vim /etc/systemd/system/tomcat.service
Paste the following configuration:
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk"
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
[Install]
WantedBy=multi-user.target
Save and exit the file.
Then reload the daemon and enable Tomcat:
#systemctl daemon-reload
#systemctl enable tomcat
#systemctl start tomcat
Note: If firewalld is enabled, open port 8080 (the default Tomcat port):
Step 8: Access Tomcat Web Interface
Now open your browser and visit:
http://<your-server-ip>:8080
You should see the Apache Tomcat 10 welcome page.
Login to Manager App or Host Manager using the credentials you created earlier.
Conclusion
This is how you can install and configure Apache Tomcat 10 on AlmaLinux.
Your Java web server is now ready to host and manage applications efficiently. From here, you can deploy your .war files to /opt/tomcat/webapps/ or set up automated deployments via CI/CD tools.
Need expert help setting up or managing Apache Tomcat 10 on your server? Skynats offers 24/7 Linux Server Management Services to ensure smooth installation, configuration, and performance optimization.