Installing Apache,JDK, JRE and MySQL (Running JSP Application) on Linux


Installing Apache, JDK, JRE and MySQL on Linux 64 bit system

Download all the required software and tools to run a web application on Linux.

Below are the list of software and their download url:

  1. MySQL – http://dev.mysql.com/downloads/mirror.php?id=399576#mirrors (Download MySQL-bench-5.0.92-1.glibc23.ia64.rpm )
  1. JDK – http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u1-download-513651.html (Download jdk-7u1-linux-x64.rpm)
  1. JRE – http://www.oracle.com/technetwork/java/javase/downloads/jre-7u1-download-513652.html (Download jre-7u1-linux-x64.rpm)
  1. APACHE TOMCAT – http://tomcat.apache.org/download-60.cgi (Download Binary Distribution Core Package – tar.gz (pgp, md5) ) apache-tomcat-6.0.35.tar.gz
  1. MYSQL GUI TOOLS – http://dev.mysql.com/downloads/gui-tools/5.0.html (Download Generic x86/64 Linux TAR (bundled dependencies))


Install MySQL rpm package downloaded

Install JRE (JDK included) rpm package downloaded

Installing APACHE TOMCAT:

Open terminal of Linux.
Once you downloaded the tar file make sure the MD5 checksum matches the value posted on Tomcat’s web site:

md5sum /DownloadFolder/apache-tomcat-6.0.35.tar.gz

Result:

8354e156f097158f8d7b699078fd39c1  /DownloadFolder/apache-tomcat-6.0.35.tar.gz

Installing Tomcat from a binary release (tar file) requires manual creation of the Tomcat user account. This is not necessary if you install the Tomcat RPM package on a Linux system that supports RPMs. 

For security reasons I created a user account with no login shell for running the Tomcat server:

groupadd tomcat
useradd -g tomcat -s /usr/sbin/nologin -m -d /home/tomcat tomcat

Next I extracted the tar file to /var/lib and changed the ownership of all files and directories to tomcat:

cd /var/lib
tar zxvf /DownloadFolder/apache-tomcat-6.0.35.tar.gz
chown -R tomcat.tomcat /var/lib/apache-tomcat-6.0.35

The get the Tomcat version of the newly installed Tomcat, run:

/var/lib/apache-tomcat-6.0.35/bin/version.sh

Result:

Using CATALINA_BASE:   /var/lib/apache-tomcat-6.0.35
Using CATALINA_HOME:   /var/lib/apache-tomcat-6.0.35
Using CATALINA_TMPDIR: /var/lib/apache-tomcat-6.0.35/temp
Using JRE_HOME:       /usr
Server version: Apache Tomcat/6.0.35
Server built:   Dec 8 2011 02:00:36
Server number:  6.0.18.0
OS Name:        Linux
OS Version:     2.6.18-6-amd64
Architecture:   x86_64
JVM Version:    1.4.2
JVM Vendor:     Free Software Foundation, Inc.

Starting/Stopping Tomcat

Now try to startup the Tomcat server to see whether the default Tomcat home page is being displayed. 

For security reasons I don’t run the Tomcat server as user root but as tomcat which was created with no login shell. Therefore, to run Tomcat use the su command with the -p option to preserves all the environment variables when switching to tomcat (more on the Tomcat environment variables later). And since the tomcat account has no login shell, it needs to be specified with the -s option. (You may want to use this su command if you plan on writing and implementing a system startup and shutdown script for system reboots.)

export JAVA_HOME=/usr/java/jdk1.7.0_10
export PATH=$JAVA_HOME/bin:$PATH
export CATALINA_HOME=/var/lib/apache-tomcat-6.0.35
export CATALINA_BASE=/var/lib/apache-tomcat-6.0.35
# su -p -s /bin/sh tomcat $CATALINA_HOME/bin/startup.sh

Result:

Using CATALINA_BASE:   /var/lib/apache-tomcat-6.0.35
Using CATALINA_HOME:   /var/lib/apache-tomcat-6.0.35
Using CATALINA_TMPDIR: /var/lib/apache-tomcat-6.0.35/temp
Using JRE_HOME:       /usr/java/jdk1.7.0_10

Now verify that Tomcat was started successfully by opening the URL http://localhost:8080 (Port number 8080 is the default port used by Tomcat). Note that you should also be able to use the name of your server instead of localhost. Once you opened the URL in your browser you should see Tomcat’s Congratulation page. If you don’t see the page, check the log files under $CATALINA_HOME/logs (/var/lib/apache-tomcat-6.0.35/logs). 

Before you continue with the next steps, make sure to shut down Tomcat since we want to run the Tomcat server out of a separate application directory.

su -p -s /bin/sh tomcat $CATALINA_HOME/bin/shutdown.sh

Result:

Using CATALINA_BASE:   /var/lib/apache-tomcat-6.0.35
Using CATALINA_HOME:   /var/lib/apache-tomcat-6.0.35
Using CATALINA_TMPDIR: /var/lib/apache-tomcat-6.0.35/temp
Using JRE_HOME:       /usr/java/jdk1.7.0_10

Now start the tomcat using startup command stated above.

Installing MySQL Gui Tools:

Open new Terminal window.
To see all files in the tarball, run this command:

tar -tzf  /DownloadFolder/mysql-gui-tools-version.tar.gz

To install MySQL GUI Tools, run this command:

 tar --directory=/opt -xzvf /DownloadFolder/mysql-gui-tools-version.tar.gz

If you install MySQL GUI Tools to a directory other than the /opt directory, you will need to update the installation directory. This done by using the –update-paths option the first time that you run any one of the MySQL GUI Tools. For example, when running Query Browser for the first time, navigate to the installation directory and enter the following command:

./mysql-query-browser --update-paths

 

Tags: , ,

Comments & Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

*


× 1 = 8

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>