Installation and configuration of resin + JSP + MySql in Linux

Source: Internet
Author: User

Prepare software:

1. j2sdk (1.5.0): jdk-1_5_0-linux-i586-rpm.bin

2. Apache (2.0.53): httpd-2.0.53.tar.gz

3. resin (3.0.13): resin-3.0.13.tar.gz

4. MySQL (4.1.12): SERVER: MySQL-server-4.1.12-1.i386.rpm

Client: MySQL-client-4.1.12-1.i386.rpm

5. mysql-jbdc connector: mysql-connector-java-3.1.10.tar.gz

Put all the above software in a directory, assuming it is in/down.

Installation Process:

1. Install j2sdk

1. decompress the file, decompress it, and run the RPM installation package. In the installation process, answer yes as prompted to install the file to the/usr/Java/jdk1.5.0 directory.

# Chmod U + X./jdk-1_5_0-linux-i586-rpm.bin
#./Jdk-1_5_0-linux-i586-rpm.bin
# Rpm-IVH jdk-1_5_0-linux-i586.rpm
InstallProgramThe j2sdk is installed in the following directory:
# Ls/usr/Java
Jdk1.5.0

2. Configure Environment Variables

(1) Configure user environment variables

If the username is Jun, edit the user's. bashrc file:

# Vi/home/Jun/. bashrc

Add:

Export java_home =/usr/Java/jdk1.5.0

Export classpath =.: $ java_home/lib: $ java_home/JRE/lib: $ classpathexport Path = $ path: $ java_home/bin: $ java_home/JRE/bin: $ homr/bin

(2) Configure environment variables for all users

# Vi/etc/profile

Join:

Export java_home =/usr/Java/jdk1.5.0

Export classpath =.: $ java_home/lib: $ java_home/JRE/lib: $ classpath

Export Path = $ path: $ java_home/bin: $ java_home/JRE/bin: $ homr/bin

Note: these should be added before export path user...

3. check whether it is correct:

Log out first

# Logout

Then log on and enter the following command. If the parameter is prompted, it is generally considered OK.

# Javac

Ii. Install apache2

1. Install

# Tar zxvf httpd-2.0.53.tar.gz

# Cd httpd-2.0.53

#./Configure -- prefix =/usr/local/apache2

# Make

# Make install

2. Test

Start the service

#/Usr/local/apache2/bin/httpd-K start

Enter in the address bar of the browser

Http: // localhost

The running result is displayed, indicating that the installation and running are successful.

3. Configure the Directory

Assume that the file directory of your www service is under/var/WWW, then modify the configuration file

# Vi/usr/local/apache2/CONF/httpd. conf

Set the default file path

DocumentRoot "/usr/local/apache2/htdocs"

Change to your service directory

DocumentRoot "/var/www"

Then restart the service:

#/Usr/local/apache2/bin/httpd-K restart

Refresh again

Http: // localhost

You should see your own homepage.

4. Configure the system and use httpd to enable it.

Copy/usr/local/apache2/apachectl to/etc/rc. d/init. d/httpd

# Cp/usr/local/apache2/apachectl/etc/rc. d/init. d/httpd

# Cd/etc/rc. d/rc3.d

# Ln-S/etc/rc. d/init. d/httpd s80httpd

In this way, the system can automatically load Apache at startup.

Iii. Install MySQL

1. Install the server separately

# Rpm-IVH MySQL-server-4.1.12-1.i386.rpm

The MySQL service is automatically started after the server is installed.

# Rpm-IVH MySQL-client-4.1.12-1.i386.rpm

2. Test

# Mysqlshow

If two databases, MySQL and test, are generated, the installation is correct.

4. install Resin

1. Unzip and install

# Cd/usr/local

# Tar zxvf/down/resin-3.0.13.tar.gz

# Cd Resin-3.0.13

#./Configure -- With-Java-home =/usr/Java/jdk1.5.0 -- With-apxs =/usr/local/apache2/bin/apxs

# Make

# Make install

2. Test

Start resin and test the result

#/Usr/local/resin-3.0.13/bin/httpd. Sh-verbose

If you see:

HTTP listening to *: 8080
Servletserver [] Starting
Host [] Starting
Application [http://XX.XX.XX.XX: 8080/resin-Doc] Starting
Application [http://XX.XX.XX.XX: 8080] Starting
....

This indicates that the operation is successful. In the address bar of the browser, enter:

Http: // localhost: 8080

The default homepage of resin is displayed.

3. Integrate Apache and resin

The purpose is to direct the Home Directory of resin to the same directory of Apache, and configure resin to parse the JSP page at port 80.

(1) Check the file

# Ls/usr/local/apache2/modules/mod_caucho.so

If yes, continue

(2) EDIT httpd. conf

# Vi/usr/local/apache2/CONF/httpd. conf

Find resinconfigserver localhost 6802.

Make sure that the content is:

Loadmodule caucho_module/usr/local/apache2/modules/mod_caucho.so

Resinconfigserver 192.168.1.109 6802 // change localhost to the actual IP address of your computer

Cauchostatus Yes

(3) EDIT resin. conf

# Vi/usr/local/resin-3.0.13/CONF/resin. conf

Replace the host with the actual IP Address:

...

Change the path to your webpage master path/var/www:

(4) Restart Apache and resin

#/Usr/local/apache2/bin/httpd-K restart

#/Usr/local/resin-3.0.13/bin/httpd. Sh start

If the port is occupied and cannot be bound, restart the system. # reboot

(5) test

Run the test. jsp file:

2 + 2 =

Put it in directory/var/WWW

Access:

Http: // localhost/test. jsp

If 2 + 2 = 4 is displayed normally, the operation is successful.

4. Install the mysql-JDBC driver

# Cd/usr/local

# Tar zxvf/down/mysql-connector-java-3.1.10.tar.gz

5. Configure resin to start automatically

Edit/etc/rc. d/rc. Local

# Vi/etc/rc. d/rc. Local

Join:

Export java_home =/usr/Java/jdk1.5.0

Export JDBC =/usr/local/mysql-connector-java-3.1.10 # configure the JDBC driver path

Export Path = $ path: $ java_home/bin: $ java_home/JRE/bin

Export classpath =.: $ java_home/lib/dt. jar: $ JDBC/MySQL-connector-Java-

3.1.10-bin. jar: $ classpath

Echo "Starting resin 3.0.13 ..."

/Usr/local/resin-3.0.13/bin/httpd. Sh start # Start Resin

Sleep 15 # because there is a lot of work done at startup, the latency is 15 seconds.

V. Test MySQL

1. Put the following file testmysql. jsp in/var/www:

2. test:

Http: // localhost/testmysql. jsp

If you see:

Driver loaded successfully!

The MySQL database connection has been established.

That is, the operation is successful.

The platform has been successfully installed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.