9 C
Texas
angeloma
Senior Writer and partner

How to install Tomcat on Fedora 29?

Java application development is a market that seems to have no end in the near future. More and more people are starting their way into programming with Java and JSP. However, to use servlets and JSP you need a server that can run it. Today, I will teach you how to install Tomcat on Fedora 29.

Tomcat is a software developed with Java that serves as a web server with support for servlets and JSPs. It is developed and updated by members of the Apache Software Foundation and independent volunteers. It is also very easy to set up to get up and running and has a lot of documentation.

So, let’s install it on Fedora 29.

1. Check the Java Version

The first step to install Tomcat in Fedora is to check if you have Java installed. Most likely, yes, but it’s still better to be sure.

- Advertisement -

Open a terminal and run:

:~$ java -version

1.- Checking the Java version installed
1.- Checking the Java version installed

As you can see in the image above Java is installed correctly. So, you can continue with the installation.

2. Download and Install Tomcat on Fedora

Now, proceed to download Tomcat from its website. At the time this article has been written, the latest stable version is 9.0.12. So, install wget and then download Tomcat.

:~$ sudo dnf install wget
:~$ cd /usr/local
:~$ sudo wget http://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.12/bin/apache-tomcat-9.0.12.tar.gz

2.- Downloading Tomcat
2.- Downloading Tomcat

Then, decompress the downloaded file.

:~$ sudo tar -xvzf apache-tomcat-9.0.12.tar.gz

Next, rename the folder to make the process easier.

:~$ sudo mv apache-tomcat-9.0.12 tomcat9

3.- Rename the folder
3.- Rename the folder

Now, you need to configure environment variables. First, export the CATALINA_HOME variable.

:~$ sudo echo "export CATALINA_HOME="/usr/local/tomcat9"" >> ~/.bashrc

After that, refresh the bash.

:~$ source ~/.bashrc

4.- Configuring the environment variables
4.- Configuring the environment variables

3. Setting admin user

In order to manage Tomcat, it is necessary to create an administrator user who can perform all the essential tasks that the application allows to do. To do this, you need to edit the file tomcat-users.xml localized on /usr/local/tomcat9/conf/ directory.

:~$ sudo nano /usr/local/tomcat9/conf/tomcat-users.xml

And add the following before </tomcat-users>:

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

5.- Setting a admin user
5.- Setting an admin user

4. Using Tomcat

Before you start using Tomcat, you need to start it.

:~$ cd /usr/local/tomcat9
:~$ sudo ./bin/startup.sh

6.- Starting tomcat
6.- Starting tomcat

Now, you can open the web browser and go to http://IP_ADDRESS:8080/ and you will see this:

7.- Tomcat default page
7.- Tomcat default page

And to visit the manager page, go to http://IP_ADDRESS:8080/manager/html

8.- Access to manager page of Tomcat
8.- Access to manager page of Tomcat

By entering your username and password, you will be able to access the manager section.

9.- Manager page of Tomcat
9.- Manager page of Tomcat

And that’s it.

Conclusion

Tomcat is needed to develop applications with JSP. It is free which minimizes expenses for small or educational projects. It is also well documented and easy to use. Its installation in Fedora 29 is really easy and only requires a few essential commands.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article