Configure Tomcat in Fedora

To configure tomcat in fedora follow the bellow steps

Step 1: Check version of java

$ java -version

Output :

openjdk version "11.0.7" 2020-04-14 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing)

Step 2 : Download tomcat any version (latest preferred) from https://tomcat.apache.org/

Extract file apache-tomcat-9.0.56.tar.gz

tar xzf apache-tomcat-9.0.56.tar.gz

Move or copy file to /usr/local/tomcat9

sudo mv apache-tomcat-9.0.56 /usr/local/tomcat9

Step 3 : Set environment variable to .bashrc

echo "export CATALINA_HOME="/usr/local/tomcat9"" >> ~/.bashrc
source ~/.bashrc

Step 4 : Setup user account to tomcat-users.xml file

vim /usr/local/tomcat9/conf/tomcat-users.xml

Copy the bellow code inside <tomcat-users> </tomcat-users> block

<!-- user manager can access only manager section -->
<role rolename="manager-gui" />
<user username="manager" password="_SECRET_PASSWORD_" roles="manager-gui" />

<!-- user admin can access manager and admin section both -->
<role rolename="admin-gui" />
<user username="admin" password="_SECRET_PASSWORD_" roles="manager-gui,admin-gui" />

Step 5 : Start up the sever

cd /usr/local/tomcat9
./bin/startup.sh

Output:

Using CATALINA_BASE:   /usr/local/tomcat9
Using CATALINA_HOME:   /usr/local/tomcat9
Using CATALINA_TMPDIR: /usr/local/tomcat9/temp
Using CLASSPATH:       /usr/local/tomcat9/bin/bootstrap.jar:/usr/local/tomcat9/bin/tomcat-juli.jar
Tomcat started.

Finally check in browser

http://localhost:8080

Thats it.

Leave a Reply

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