Embracing Tomcat 8.5 on CentOS 7
In the bustling realm of web servers, Apache Tomcat stands tall, offering a sanctuary for deploying Java applications with finesse. In this harmonious symphony of technology and CentOS 7’s robust architecture, the installation of Tomcat 8.5 emerges as a rhythmic dance, a choreography of commands and configurations that beckon towards a seamless hosting experience. Let us embark on this enchanting journey, exploring the nuances and intricacies of ushering Tomcat 8.5 onto the stage of your CentOS 7 server.
Preparing the Stage:
System Update and Java Installation
Before the curtains rise, the CentOS 7 system awaits its preparatory rites. Begin by updating the system, a vital overture to ensure the latest software orchestrates the performance. Execute the sacred commands:
sudo yum update
sudo yum install epel-release
With the stage primed, the melodious resonance of Java beckons. Tomcat 8.5 entwines elegantly with Java. Install the melodious Java Development Kit (JDK) with the command:
sudo yum install java-1.8.0-openjdk-devel
Acquiring the Tomcat Ensemble:
Download and Unpack
The orchestral score of Tomcat 8.5 awaits its conductor. Navigate to the Apache Tomcat official site, and with the finesse of a seasoned virtuoso, procure the desired version:
wget https://downloads.apache.org/tomcat/tomcat-8/v8.5.75/bin/apache-tomcat-8.5.75.tar.gz
Once the opus of Tomcat graces your realm, unfurl its essence. Unpack this auditory masterpiece with the command:
tar -xzvf apache-tomcat-8.5.75.tar.gz -C /opt
Tuning the Melody:
Setting Environment Variables
The symphony nears completion as environment variables harmonize with Tomcat’s essence. Employ the delicate strokes of configuration, sculpting the variables in the revered /etc/profile
:
sudo sh -c 'echo "export CATALINA_HOME=/opt/apache-tomcat-8.5.75" >> /etc/profile'
sudo sh -c 'echo "export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk" >> /etc/profile'
sudo sh -c 'echo "export PATH=$PATH:$CATALINA_HOME/bin" >> /etc/profile'
source /etc/profile
With this incantation, the pathways align, bestowing the symphony of Tomcat upon your CentOS 7 server.
Setting the Stage:
User Creation and Permissions
In the theatrical performance of Tomcat, a dedicated player emerges—a user endowed with the privilege of conducting the server. Forge this protagonist with the command:
sudo useradd -r -m -U -d /opt/tomcat -s /bin/false tomcat
Grant this protagonist the script, the manuscript to orchestrate Tomcat’s opus:
sudo chown -R tomcat: /opt/apache-tomcat-8.5.75
sudo sh -c 'chmod +x /opt/apache-tomcat-8.5.75/bin/*.sh'
Raising the Curtains:
Starting and Enabling Tomcat
The crescendo approaches—the moment to unveil Tomcat’s sonorous melodies. Initiate the overture with the command:
sudo -u tomcat /opt/apache-tomcat-8.5.75/bin/startup.sh
Witness the rhapsody of Tomcat unfurling its vibrant canvas. Engrave this performance into the echelons of your server’s chronicles:
sudo systemctl enable tomcat
sudo systemctl start tomcat
With these final gestures, Tomcat’s symphony reverberates through the corridors of your CentOS 7 server, inviting the world to experience the harmonious amalgamation of technology and finesse.
The journey to install Tomcat 8.5 on CentOS 7, an ethereal quest through commands and configurations, now stands completed, unveiling a realm where Java applications thrive amidst the orchestral symphony of Tomcat’s melodies.