How to install Apache Tomcat 9 in CentOS
To install Apache Tomcat 9 in CentOS
Apache Tomcat is an open-source web server and servlet container is used to serve JAVA application. It follows Java EE specifications and provides a HTTP web server. Installation of Apache tomcat 9 in CentOS is explained in this manual.
Installation of Apache Tomcat 9
First install the java 8 package with the following command.
[root@linuxhelp Desktop]# yum install java-1.8.0
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
* base: centos.excellmedia.net
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
updates/7/x86_64/primary_db
.
.
.
Dependency Updated:
tzdata-java.noarch 0:2016f-1.el7
Complete!
Then run the below command to check the version of Java.
[root@linuxhelp Desktop]# java -version
openjdk version " 1.8.0_101"
OpenJDK Runtime Environment (build 1.8.0_101-b13)
OpenJDK 64-Bit Server VM (build 25.101-b13, mixed mode)
Now run the below link in the terminal to download the latest tomcat package.
[root@linuxhelp Desktop]# wget http://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.0.M21/src/apache-tomcat-9.0.0.M21-src.tar.gz
--2016-08-23 14:34:29-- http://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.0.M9/bin/apache-tomcat-9.0.0.M9.tar.gz
Resolving www-eu.apache.org (www-eu.apache.org)... 88.198.26.2, 2a01:4f8:130:2192::2
.
.
.
100%[====================================================================> ] 9,322,413 439KB/s in 23s
2016-08-23 14:34:52 (390 KB/s) - ‘ apache-tomcat-9.0.0.M21-src.tar.gz’ saved [9322413/9322413]
Extract the downloaded package in respective location.
[root@linuxhelp Desktop]# tar -xvf apache-tomcat-9.0.0.M21-src.tar.gz -C /opt/
apache-tomcat-9.0.0.M9/conf/
apache-tomcat-9.0.0.M9/conf/catalina.policy
apache-tomcat-9.0.0.M9/conf/catalina.properties
apache-tomcat-9.0.0.M9/conf/context.xml
.
.
.
apache-tomcat-9.0.0.M9/bin/startup.sh
apache-tomcat-9.0.0.M9/bin/tool-wrapper.sh
apache-tomcat-9.0.0.M9/bin/version.sh
Next move the extracted package to the new directory.
[root@linuxhelp Desktop]# cd /opt/
[root@linuxhelp opt]# mv apache-tomcat-9.0.0.M21/ tomcat/
Here use the below command to add and execute the configuration file.
[root@linuxhelp opt]# echo " export CATALINA_HOME=' /opt/tomcat/' " > > ~/.bashrc
[root@linuxhelp opt]# source ~/.bashrc
Now you can start the tomacat service with the below steps.
[root@linuxhelp ~]# cd /opt/tomcat/bin/
[root@linuxhelp bin]# ./startup.sh
Using CATALINA_BASE: /opt/tomcat/
Using CATALINA_HOME: /opt/tomcat/
Using CATALINA_TMPDIR: /opt/tomcat//temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/tomcat//bin/bootstrap.jar:/opt/tomcat//bin/tomcat-juli.jar
Tomcat started.
If you want to stop the tomcat server, Run the below command to stop the tomacat service.
[root@linuxhelp ~]# cd /opt/tomcat/bin/
[root@linuxhelp bin]# ./shutdown.sh
Finally, configure the tomcat port in firewall and reload it with the below command.
[root@linuxhelp bin]# firewall-cmd --permanent --zone=public --add-port=8080/tcp success [root@linuxhelp bin]# firewall-cmd --reload Success
Open the browser and enter your server IP with port number to access the Apache tomcat.
Comments ( 0 )
No comments available