Getting the Tomcat server running on our Alpine Linux virtual machine.
The Tomcat server is running

Getting the Tomcat server running on our Alpine Linux virtual machine.

Welcome back to another tutorial from our Alpine Linux explorations tutorial series.

This time we are going to get our very own Tomcat web server running on our Alpine Linux virtual machine.

 We need to complete several steps to get it working correctly.

 1. We need to power on our Alpine Linux virtual machine from the Oracle Virtual Box Manager.

Power on the Alpine Linux Virtual Machine
Power on the Alpine Linux Virtual Machine

2. Once our Alpine Linux virtual machine execution environment has fully booted we are ready to begin the process – system ready.

Login to our Alpine Linux Virtual machine
Login to our Alpine Linux Virtual machine

3. We need to open the Linux Terminal.

Open the Linux Terminal
Open the Linux Terminal

4. We need to switch to the root user to run the necessary commands to install the Tomcat server correctly. 

Use the root account
Use the root account

5. We first need to update our Alpine Linux virtual machine execution environment. First, run the command ‘apk update’.

Run the command apk update
Run the command apk update

6. We then need to run the command ‘apk upgrade’.

Run the command apk upgrade
Run the command apk upgrade

7. Now the Alpine Linux virtual machine execution environment is fully updated. 

The Alpine Linux virtual machine execution environment is now updated
The Alpine Linux virtual machine execution environment is now updated

8. We need to run the command ‘reboot’.

Now we run the command reboot
Now we run the command reboot

9. Now we need to log back in, open the Linux Terminal again and switch to the root account. Now we can add the Tomcat web server packages and we need to install the necessary Java packages as well.

 For the Java packages, we need to run the following Linux terminal command “apk add openjdk11” and we need to check if it is correctly installed by using the command “java –version”.

Now we install the Java execution environment
Now we install the Java execution environment
The correct Java execution environment is now properly installed
The correct Java execution environment is now properly installed

 10. We can then proceed to search for the correct Tomcat server packages and install them using this Linux terminal command “apk search tomcat”.

Here is have the Tomcat server packages ready for installation
Here is have the Tomcat server packages ready for installation

Then we install the packages with these commands:

 “apk add tomcat-native tomcat9 tomcat9-admin tomcat9-examples tomcat9-openrc”

Now we install the required packages
Now we install the required packages
Almost done
Almost done

11. We can then start the Tomcat server using the Linux terminal command “service tomcat9 start”.

We can start the Tomcat server using the command service tomcat9 start
We can start the Tomcat server using the command service tomcat9 start

We can also shut it down using the command “service tomcat9 stop”.

 12. Here we can see that I have made a mistake. I should have opted for another Java version.

Incorrect Java execution environment version
Incorrect Java execution environment version

 We can see here that I need a more recent version of Java to properly run this server. My bad :)

I need a more recent version of Java to properly run this server
I need a more recent version of Java to properly run this server

 Now we shall upgrade our Java environment version. 

Now we can upgrade our Java environment
Now we can upgrade our Java environment

 Sweet victory! Now we have completed our work.

The Tomcat server is now running on our Alpine Linux virtual machine
The Tomcat server is now running on our Alpine Linux virtual machine

 

The Tomcat server is running
The Tomcat server is running

Finally, we should make use of the openrc framework to allow our newly installed Tomcat server to load automatically every time we boot our Alpine Linux virtual machine.  

The command is "rc-update add tomcat default".

Time to set our newly installed Tomcat server to autostart
Time to set our newly installed Tomcat server to autostart


All done
All done

Now we have fully completed our great work. We can shut down the Alpine Linux Virtual machine. 

Now we can shutdown our Alpine Linux virtual machine using the poweroff command
Now we can shutdown our Alpine Linux virtual machine using the poweroff command

For this purpose, we need to use the Linux terminal command “poweroff”.

 Well, that was fun. See you next time! #linux

To view or add a comment, sign in

More articles by Razvan Alexandru Ionica

  • Updating Rocky Linux 9.4 packages

    Rocky Linux was founded by Gregory Kurtzer, one of the original founders of CentOS, in December 2020. The project was…

  • Installing GUI on Oracle Solaris 11 (sol-11_4-text-x86.iso)

    Sun Solaris, now known as Oracle Solaris, is a Unix operating system originally developed by Sun Microsystems. Oracle…

    9 Comments
  • Updating Rocky Linux 9.4 Kernel

    Rocky Linux is a free and open-source enterprise operating system designed to be fully compatible with Red Hat…

    8 Comments
  • Updating Rocky Linux 9.4 Multimedia Codecs

    Rocky Linux is an open-source enterprise operating system designed to be a downstream, community-supported…

  • Setting up OpenSolaris 2009.06 (osol-0906-x86.iso) for a virtual machine

    UNIX is a powerful, multiuser, multitasking operating system originally developed in the 1960s and 1970s at AT&T's Bell…

    13 Comments
  • OpenSolaris 2009.06

    OpenSolaris was an open-source operating system based on the Solaris kernel and associated tools. It was initiated by…

    32 Comments
  • Force RHEL 7 to set the date 2 years in the past

    Here is a question from one of our fellow UNIX Europe group members: How can he force RHEL 7 to set the date 2 years in…

    12 Comments
  • Setting up RHEL 7 (rhel-server-7.9-x86_64-dvd) for a virtual machine

    RHEL 7, or Red Hat Enterprise Linux 7, was a major release of the RHEL operating system that was introduced in June…

    8 Comments
  • Update Rocky Linux from 9.3 to 9.4

    Rocky Linux is an exciting development in the world of Linux distributions. It was created as a direct response to the…

    2 Comments
  • Install LibreOffice on Rocky Linux 9.3

    Rocky Linux was created as a community-driven, enterprise-focused Linux distribution. It aims to be a downstream…

Insights from the community

Others also viewed

Explore topics