Install Apache+ApacheJServ+JSP on Linux

  • 2020-05-05 11:43:06
  • OfStack

I. copyright notice
This document will be published in accordance with GPL.

Ii. Software acquisition
As the saying goes, the good work to do its work, must first sharpen their tools; Listed below are the related resources obtained by the software mentioned in this article; The order of the software is also choreographed in the order of installation.



I. Apache Web Server

o http://www.apache.org/
o http://www.redhat.com/
o http://cle.linux.org.tw/

II. JDK

o http://java.sun.com/

III. JSDK

o http://java.sun.com/

IV. Java Apache

o http://java.apache.org/

V. GUN JSP

o http://www.gnu.org/
o http://java.apache.org/

3. Software installation
I. Install Apache Web Server

a. Use RPM

If you are using the RPM suite, after you have obtained the Apache Web Server suite, simply type the following command to complete the installation:

[root @ localhost root] # rpm - ivh apache - 1.3 xx. i386. rpm (xx Apache Web Server version)

b. Use SOURCE

If you are using Source with Apache Web Server, then you must compile and install Source:

[root @ localhost root] # tar zxvf apache_1. 3. xx. tar. gz (xx Apache Web Server version)

[root@localhost root]# cd apache_1.3.xx

[root@localhost apache_1.3.xx]# ./congifure

> - prefix = / usr/local/apache/set (what you want to install directory)

> --enable-module=all

> --enable-rule=SHARE_CORE

[root@localhost apache_1.3.xx]# make clean ; make ; make install

After completing the above steps, you have basically completed the installation of Apache Web Server.

II. Install JDK

You can get the latest version of JDK (Java Development Kits) from the above location. Please follow the following steps to complete JDK:

[root@localhost root]# tar zxvf jdk1_2_2rc2-linux-i386.tar.gz

[root@localhost root]# mv jdk1.2.2 /usr/local/jdk122

After completing the above steps, you will also need to set the environment:

[root@localhost root]# vi .bash_profile

...

...

JAVA_HOME=/usr/local/jdk122

PATH=$PATH:$JAVA_HOME/bin

CLASSPATH=/usr/local/jdk122/lib/tools.jar:.

export JAVA_HOME

export PATH CLASSPATH

Note: if you are using JDK version 1.1.x, your CLASSPATH must be set to

CLASSPATH=/path/to/your/jdk/lib/classes.zip:.

III. Install JSDK

★ please note: if you are using Java Apache RPM version, please skip this section.

You must obtain and install JSDK (Java Servlet Development Kits) to make Java Apache work. In fact, all we need is a small portion of JSDK (a file called jsdk.jar or servlet.jar); Now all you have to do is get the file and set it to CLASSPATH:

CLASSPATH=/path/to/jsdk/lib/jsdk.jar:$CLASSPATH

export CLASSPATH

IV. Install Java Apache

. Use RPM

If you are using the RPM suite, after you have obtained the Java Apache suite, simply enter the following command to complete the installation:

[root@localhost root]# rpm -ivh ApacheJServ-1.1-b2.i386.rpm

a. Use SOURCE

If you are using Java Apache Source, then you must compile and install Source:

[root@localhost root]# tar zxvf ApacheJServ-1.1.tar.gz

[root@localhost root]# cd ApacheJserv-1.1

[root@localhost ApacheJserv-1.1]# ./congifure

> - prefix = / usr/local/jsdk/set (what you want to install directory)

> - with - apxs = / usr/local/apache bin/apxs (apache apxs place full path)

> --with-jdk-home=$JAVA_HOME

> -- with-java-platform =2 1 represents JDK 1.1.x; 2 stands for JDK 1.2.x)

> --with-JSDK=/usr/local/jsdk/lib/jsdk.jar

[root@localhost ApacheJserv-1.1]# make clean ; make ; make install

★ please note: please read the section "Java Apach test" first.

V. Install GNU JSP

After completing the complicated installation steps above, we will proceed with the installation of GNU JSP. But before I show you how to install GNU JSP, I want to briefly explain what JSP is and what JSP does.

JSP (Java Server Page) was originally a file format on Java Server. The content is somewhat similar to ASP (Active IIS Server). And through JDBC to access, modify, and edit data from back-end databases. Of course, this is not the only aspect of JSP. It can also perform functions such as Socket linking.

Basically, we can think of the JSP file as one of the Java Servlet programs. What do you mean? This is because when the JSP file is first read, it is translated by the JSP translator into the Java Servlet program, which is then compiled and executed. The syntax of the JSP code is no different from that of the Java Servlet (in fact, it will be copied intact into the newly generated Java Servlet code when translated). So we are sure that knowing the Java Servlet authoring techniques is very helpful for writing JSP files.

Next, we will continue with the installation of GNU JSP. Before you do this, make sure you have the GNU JSP file.

After you have obtained GNU JSP, follow these steps to install

[root@localhost root]# tar zxvf gnujsp_0_9_10.tar.gz

[root@localhost root]# mv gnujsp-0.9.10 /usr/local/gnujsp

[root@localhost root]# cd /home/httpd/servlets

[root@localhost servlets]# mkdir compiled

[root@localhost servlets]# chown nobody.nobody compiled

After completing the above instructions, we need to set several other files:

1. /etc/httpd/conf/jserv/jserv.properties

[root@localhost root]# cd /etc/httpd/conf/jserv

[root@localhost jserv]# vi jserv.properties

...

...

wrapper.classpath=/usr/local/gnujsp/lib/gnujsp.jar

...

...

2. /etc/httpd/conf/jserv/zone.properties

[root@localhost jserv]# vi zone.properties

...

...

repositories=/home/httpd/servlet,/usr/local/gnujsp/gnujsp.jar

...

...

servlet.gnujsp.code=org.gjt.jsp.JSPServlet

...

...

servlet.gnujsp.initArgs=repository=/home/httpd/servlets/

servlet.gnujsp.initArgs=compiler=/usr/local/jdk122/bin/java

-classpath %classpath%:%repository%

-d %repository% -deprecation %source%

...

...

3. /etc/httpd/conf/jserv/jserv.conf

Related articles: