Sunday, September 11, 2011

Install Apache and Tomcat in linux


1. must have the base packages installed on your system, these include: httpd, httpd-devel, php, php-common, php-devel. must have the base packages installed on your system, these include: httpd, httpd-devel, php, php-common, php-devel. and their respective units, this will use the “yum” that comes with CentOS (RedHat Enterprise) and their respective units, this will use the “yum” that comes with CentOS (RedHat Enterprise)
yum install httpd httpd-devel php php-common php-devel
After having installed the packages above, we proceed to update all our centos, using yum command again as follows After having installed the packages above, we proceed to update all our centos, again using the yum command as follows
yum-y update
However, we already have installed centos with PHP support for Apache, which is listening on port 80 (default port). However, we already have installed centos with PHP support for Apache, which is listening on port 80 (default port). CentOS is a directory / var / www / html which is the ROOT of the HTTP server (Apache) that is where we should place the files you want to see in our server via http://localhost/ http://localhost or if we a domino. CentOS is a directory / var / www / html which is the ROOT of the HTTP server (Apache) that is where we should place the files you want to see in our server via http://localhost/ http://localhost if we or a domino.
The following are going to install the development libraries also known as Java JDK (Java Developer Kit). The following are going to install the development libraries also known as Java JDK (Java Developer Kit). to do so download the package in the JDK 1.6 version extension. bin “jdk-6u5-linux-x64.bin for this example. to do so download the package in the JDK 1.6 version extension. bin “jdk-6u5-linux-x64.bin for this example.
once we get this file, create a directory called java under / usr, then copy the file. bin in / usr / java / we execute permission and execute it well: once we get this file, create a directory called java under / usr, then copy the file. bin in / usr / java / we execute permission and execute it like this:
cd / usr
mkdir java
cd java
cp / root/jdk-6u5-linux-x64.bin.
chmod + x jdk-6u5-linux-x64.bin
./jdk-6u5-linux-x64.bin
That we already have unpacked all the JDK in / usr / java we need to do is rename the directory to better organization and outcome: That we already have unpacked all the JDK in / usr / java we need to do is to rename the directory better organization and result:
mv jdk1.6.0_05 jdk1.6.0
Now we must include in the PATH of our environment, the Java libraries, for this, edit the file / etc / profile and include sigueintes the lines just before the end of the file, may be before the line “unset i” Now we must include in The Path of our environment, the Java libraries, for this, edit the file / etc / profile and include sigueintes the lines just before the end of the file, may be before the line “unset i”
JAVA_HOME = / usr/java/jdk1.6.0
PATH = $ PATH: $ JAVA_HOME / bin
export PATH JAVA_HOME
However, once we finish with the editing, save the file, and update the varables environment like this: However, once we finish with the editing, save the file, and update the environment varables like this:
source / etc / profile
Ready, we can test whether the libraries are working, running the command “javac-version” in this way we should mostar version 1.6 just installed. Ready, we can test whether the libraries are working, running the command “javac-version” in this way we should just mostar version 1.6 installed.
Now proceed to download Tomcat 5, then take the file, go to the directory / usr / java / copy it there, decompress it, and rename the result directory for tomcat5 higher order like this: Now proceed to download Tomcat 5, then take the file, go to the directory / usr / java / copy it there, decompress it, and rename the result directory for tomcat5 higher order like this:
cd / usr / java
tar xzf apache-tomcat-5.5.26.tar.gz
mv apache-tomcat-5.5.26 tomcat5
With this and we in our tomcat linux, we must now add the path to the tomcat, in our work environment, again by editing / etc / profile at the end should be something like this: With this and we in our tomcat linux, we must now add the path to the tomcat, in our work environment, again by editing / etc / profile at the end should be something like this:
JAVA_HOME = / usr/java/jdk1.6.0
PATH = $ PATH: $ JAVA_HOME / bin
CATALINA_HOME = / usr/java/tomcat5
export PATH JAVA_HOME CATALINA_HOME
Now we can run the tomcat and test it in our browser http://localhost:8080/ Now we can run the tomcat and test it in our browser http://localhost:8080/
/ usr/java/tomcat5/bin/startup.sh
The next step is to compile the jk module for inclusion in the HTTP server that downloaded the source for download here and the following steps (assuming you have downloaded the file / root). The next step is to compile the jk module for inclusion in the HTTP server that downloaded the source for download here and the following steps (assuming you have downloaded the file / root).
cd / root
tar xzf jakarta-tomcat-connectors-1.2.15-src.tar.gz
cd jakarta-tomcat-connectors-1.2.15-src
cd jk / native
. / buildconf.sh
. / configure – with-apxs = / usr / sbin / apxs
make
make install
Now create a file in / etc / httpd / conf workers.properties called Now create a file in / etc / httpd / conf call workers.properties
workers.tomcat_home = $ CATALINA_HOME
workers.java_home = $ JAVA_HOME
ps = /
worker.list = default
worker.default.port = 8009
worker.default.host = localhost
worker.default.type = ajp13
worker.default.lbfactor = 1
Edit the Apache configuration file (/ etc / httpd / conf / httpd.conf) to load the module. Edit the Apache configuration file (/ etc / httpd / conf / httpd.conf) to load the module. In the LoadModule section add: In the LoadModule section add:
Jk_module LoadModule modules / mod_jk.so
And at the end of the file: And at the end of the file:
JkWorkersFile “conf / workers.properties”
JkLogFile “logs / mod_jk.log”
JkLogLevel warn
JkMount / jsp-examples default
JkMount / jsp-examples / * default
Now restart Tomcat, then Apache:
/ etc / init.d / httpd restart
/ usr/java/tomcat5/bin/shutdown.sh
/ usr/java/tomcat5/bin/startup.sh