In this tutorial, we will see step-by-step guidelines and the process of installing Apache Tomcat 10 on OpenSuse 15.
STEP 1: Install Java
Before diving into the installation process we need to make sure that java is installed on our system, to install java on OpenSUSE click here
STEP 2: Download Apache Tomcat
Now download the latest version of Apache Tomcat 10 on our system. to download run the following commands one by one
after download, extract the archive by running the following command
tar -zxvf tomcat-10.0.16.tar.gz
as we can see from the above image, files have been extracted successfully. if you want you can rename the folder name to whatever you want and it’s optional.
STEP 3: Directory Configuration
you can run tomcat from any directory you want, but it’s suggested to store files under /usr/local/ or /opt/tomcat( you may need to create the folder if not exist) directory. for the time being, we keep our files under /opt/tomcat/. run the following command to move files from extract directory to /opt/tomcat directory
mv /usr/local/apache-tomcat-10.0.16 /opt/tomcat
as we can see all files have been moved to under /opt/ directory from /usr/local directory.
STEP 4: Start Tomcat Server.
start tomcat server by running the following command. make sure you are in the right directory to start the tomcat server else you need to write the full path of that location you store tomcat files.
We can see from the above image that, the tomcat server is started. now type server IP on a browser as follow
BOOM! we have successfully installed tomcat 10 in our system.
STEP 5: Create systemd service
Since the idea is to manage Tomcat 10 as one more service of openSUSE Leap 15, it is good to create a configuration file to manage this new service. now create a new service file with the name tomcat.service using text editor under /etc/systemd/system/ directory.
Now copy the following lines, save the file and exit the editor
[Unit] Description=Apache Tomcat 10 Web Application Container Wants=network.target After=network.target [Service] Type=forking Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:///dev/urandom" Environment="CATALINA_BASE=/opt/tomcat" Environment="CATALINA_HOME=/opt/tomcat" Environment="CATALINA_TMPDIR=/opt/tomcat/temp" Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC" ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh [Install] WantedBy=multi-user.target
Now run the following commands one by one
systemctl daemon-reload # Star Tomcat service automatically during boot time systemctl enable tomcat.service # Start Tomcat Server systemctl start tomcat # Verify Tomcat service running or not systemctl status tomcat.service
In this tutorial, we learned how to install and configure the tomcat service in OpenSUSE operating system.