Prerequisites
shell access sudo priviledged account access
Step 1 – Install Java
Java is the primary requirement for running Tomcat 8.5 on CentOS 8 Linux system. Make sure you have Java 8 or higher version installed in your system. If you don’t’ have Java installed, use the following command to install java (OpenJDK) on your system. Then check the installed Java version
Step 2 – Create Tomcat User
Many of the system administrators are run the Tomcat server with root user. Which is not the correct way for security purposes. So, I always prefer to create a separate user account to run the Tomcat server on the Linux system. The above command will create user “tomcat” with the group “tomcat”.
Step 3 – Download Tomcat 8
Download Apache Tomcat archive file from Apache tomcat official download page. You can use below wget command to download it. Then extract the archive file and copy all the files under tomcat home directory Also, set the proper ownership of all files.
Step 4 – Enable Host/Manager for Remote IP
The latest Tomcat versions do not allow manager and host-manager interface for remote users. You can access them from the localhost only. To enable access to these pages for the remote system, allow IP or IP range in the application-specific context.xml file. The files are as following:
Manager – /opt/tomcat/webapps/manager/META-INF/context.xml Host Manager – /opt/tomcat/webapps/host-manager/META-INF/context.xml
Edit the above files one byte one and add your IP address like 192.168.1.10 in the below screenshot.
Step 5 – Setup User Accounts
Finally we need to create user accounts to secure and access admin/manager pages. Edit conf/tomcat-users.xml file in your editor and paste inside
Step 6 – Create Tomcat Start Script
Tomcat provides bash scripts for start or stop service. But you can also create a startup script to manage Tomcat via systemctl command. Create a tomcat.service file with the following content: Reload the systemd daemon service to apply changes Then, enable and start Tomcat service on your system
Step 7 – Access Tomcat in Browser
Tomcat server works on port 8080 default. To access Tomcat on the web browser by connecting your server on port 8080. If you are connecting from the local machine then use the localhost. To connect from remote machine use IP address of the system with port:
Conclusion
You have a running Tomcat 8.5 server on your CentOS 8 system. You may also need to create a Virtual host or configure a SSL certificate in Tomcat.