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.
Open a terminal and run:
:~$ java -version
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
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
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
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" />
4. Using Tomcat
Before you start using Tomcat, you need to start it.
:~$ cd /usr/local/tomcat9 :~$ sudo ./bin/startup.sh
Now, you can open the web browser and go to http://IP_ADDRESS:8080/
and you will see this:
And to visit the manager page, go to http://IP_ADDRESS:8080/manager/html
By entering your username and password, you will be able to access the manager section.
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.