Monday, August 10, 2015

How can i install Apachi Tomcat on Linux?

How can i install Apachi Tomcat on Linux?


Apache Tomcat (earlier known as Jakarta Tomcat) is an open-source web server developed by Apache Foundation to provide a pure Java HTTP server, which will enable you to run Java files easily, which means that Tomcat is not a normal server like Apache or Nginx, because its main goal is to provide a good web environment to run Java applications only unlike other normal web servers.

Step 1: Installing and Configuring Java

Before heading up for the Tomcat installation, make sure you must have JAVA installed on your Linux box to run Tomcat. If not, download and install the latest version of JAVA , using the following link.
Note: Please select and download the below mentioned RPM files only for your system architecture.

jdk-8u20-linux-i586.rpm               [For 32-Bit OS]
 
jdk-8u20-linux-x64.rpm         [For 64-Bit OS]
o                    Download Java 8 (jdk-8u20) RPM Packages
Once the JAVA package has been downloaded, you can install it using following ‘rpm‘ command.
# rpm -Uvh jdk-8u20-linux-i586.rpm            [For 32-Bit OS]
 
# rpm -Uvh jdk-8u20-linux-x64.rpm             [For 64-Bit OS]
Sample Output
Preparing...                ########################################### [100%]
   1:jdk1.8.0_20            ########################################### [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...
        jfxrt.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
Next, configure newly installed JAVA 8 files using command ‘alternatives‘, run the following series of commands on the terminal to configure Java.
# alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_20/jre/bin/java 20000
# alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_20/bin/jar 20000
# alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_20/bin/javac 20000
# alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8.0_20/jre/bin/javaws 20000
# alternatives --set java /usr/java/jdk1.8.0_20/jre/bin/java
# alternatives --set javaws /usr/java/jdk1.8.0_20/jre/bin/javaws
# alternatives --set javac /usr/java/jdk1.8.0_20/bin/javac
# alternatives --set jar /usr/java/jdk1.8.0_20/bin/jar
Once, you fired above series of commands successfully, now it’s time to verify the newly installed JAVA version running the following command on your system.
# java -version
Sample Output
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) Client VM (build 25.20-b23, mixed mode, sharing)


Java installation completed 

Step 2: Installing Apache Tomcat 


After installing and configuring JAVA on the system, now it’s time to download latest version of Apache Tomcat (i.e. 8.0.9) is the most recent stable version at the time of writing this article. If you want to make a cross check, head over to following Apache download page and check if there is a newer version available.
on                   http://tomcat.apache.org/download-80.cgi
Now download the latest version of Apache Tomcat 8, using following wget command and extract it as shown below.
# cd /opt/
# wget http://ftp.itu.edu.tr/Mirror/Apache/tomcat/tomcat-8/v8.0.9/bin/apache-tomcat-8.0.9.tar.gz
# tar -xvf apache-tomcat-8.0.9.tar.gz
Note: Replace the version number above with the latest version available if it was different.
Now we all set to start the tomcat web server using the scripts provided by the tomcat package.
# cd /opt/apache-tomcat-8.0.9/bin
# ./startup.sh 
Sample Output
Using CATALINA_BASE:   /opt/apache-tomcat-8.0.9
Using CATALINA_HOME:   /opt/apache-tomcat-8.0.9
Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.9/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /opt/apache-tomcat-8.0.9/bin/bootstrap.jar:/opt/apache-tomcat-8.0.9/bin/tomcat-juli.jar
Tomcat started.
Now to open Tomcat from your browser, go to your IP or domain with the 8080 port (because Tomcat will always run on the 8080 port) as an example: mydomain.com:8080, replace mydomain.com with your IP or domain.
http://Your-IP-Address:8080
OR
http://Your-Domain.com:8080 

THANK YOU FOR WATCHING  *****************************************************

No comments:

Post a Comment