Linux + Apache + JSP + PHP + MySql

Source: Internet
Author: User
1. install linux
I will introduce the FTP installation method here. The installation method in this way is faster than the installation from CDROM, and
You cannot continue the installation because you cannot read the CD during the installation process. ① First install serv_u on a Windows system
FTP server software, specify the user directory, and allow anonymous access; then, press the three CDs of RedHat 9
Copy the files and folders in the root directory to this user directory. When copying the second and third CDs, the system will prompt that the directory has the same
Folder or file. If you want to overwrite the file, answer yes. After the copy is complete, enable the FTP server and enter
FTP: // ftp ip address, for example, <ftp: // 192.168.100.100>, to verify the correctness of the FTP server configuration. ② CD
In the optical drive of the server where you want to install the system, let the system boot from the CD and enter the Linux Installation Wizard Page for a moment. Enter
Input the command line Linux askmethod and press Enter. Next .... Specify the IP address of the local server (to be the same as the FTP server
Network Segment) and the default gateway. When the system prompts you to select the installation method, select the FTP method, and then specify
The directory where the IP address and RedHat 9 are stored. After the installation is correct, proceed. The subsequent steps are similar to the installation with a CD.
We recommend that you install less suites during installation (but we recommend that you install MySQL). For example, do not install httpd.
To use the new version. After a while, the system installation is complete.
2. download the required software and download the following software to a Windows machine.
1、httpd-2.0.54.tar.gz // Apache server
2、php4.3.11.tar.gz // PHP interpreter
3. j2sdk-1.4.2-01-linux-i586-rpm.bin // Java Runtime Environment
4、jakarta-tomcat-5.0.28.tar.gz // JSP Interpreter
5、fedora-core-1-i386.tar.gz // connection between APACHE and tomcat Program The general method is to use
Jakarta-tomcat-connectors-jk2-src-current.tar.gz, but this process is very troublesome, but also need to rely on another good
Several packages, so we recommend that you use this file.
3. upload and download software to the server
On the above Windows machine, install the SSH client software. I use securecrt4.1.5 for registration. Use this software
To remotely control the Linux server. Start the software securecrt, create a session, and enter
The IP address of the Linux server. Enter the user name as root and enter the root password of the Linux server to connect to the Linux
Server, and then operate like on a Linux host. Create the directory/tmp/upload on Linux to receive
Files uploaded by machines. Use the command # mkdir/tmp/upload to create a directory and then go to this directory # cd
/Tmp/upload, and then use the securecrt upload tool to transfer files to the Linux Server/tmp/upload. upload files:
Click "transfer" and "zmodem upload list…" in the menu of securecrt ...", The dialog box that selects the file to be transferred appears.
Box, press Ctrl to select multiple files. After this step is completed, click the menu item "transfer" Start of securecrt
Zmodem upload ", the selected file can be put in a few minutes
Securecrt Remote Control Linux Server creation directory/tmp/upload
Transfer to the Linux directory/tmp/upload. Run the # ls-Al command on/tmp/upload to verify that the file is correctly uploaded.
I uploaded httpd-2.0.54.tar.gz, php4.3.11.tar.gz, j2sdk-1.4.2-01-linux-i586-rpm.bin,
Jakarta-tomcat-5.0.28.tar.gz, fedora-core-1-i386.tar.gz these five files.
Iv. installation and configuration
In the configuration process, you may need to modify some configuration files multiple times, such as the Apache configuration file httpd. conf. Is
So that the description is more logical. Here I will install all the software first, and then configure it once.
(1) Installation
① Install JDK: Execute the command in the current directory (/tmp/upload)
#./J2sdk-1.4.2-01-linux-i586-rpm.bin, enter yes to generate the file in the current directory
J2sdk-1.4.2-01-linux-i586-rpm. Run the command # rpm-IVH j2sdk-1.4.2-01-linux-i586-rpm, JDK will
Installed in the/usr/Java/j2sdk1.4.2 directory.
2 install Tomcat: Extract files in the current directory, use the command # tar-zxvf Jakarta-tomcat-5.0.28.tar.gz, Solution
After the pressure is complete, generate the directory Jakarta-tomcat-5.0.28, and then move this directory to the directory/usr/local, with the command
# Mv/tmp/upload/Jakarta-tomcat-5.0.28/usr/local, installation of Tomcat is complete.
③ Install Apache: in the current directory (/tmp/upload.pdf decompress httpd-2.0.54.tar.gz, use the command
# Tar-zxvf httpd-2.0.54.tar.gz, decompress and go to the directory/tmp/upload/httpd-2.0.54, use the command
# Cd httpd-2.0.54 to execute; Execute Command #./configure-Prefix =/usr/local/Apache
-Enable-module = most-enable-shared = max (note that the prefix and enable are two "-"). After a period of time,
If the error message is not displayed, run the command # make; and # make install to install Apache.
Installation.
(4) install PHP: Back to the directory/tmp/upload, # CD .. (because just transferred to the directory httpd-2.0.54), unzip
File php-4.3.11.tar.gz, # tar-zxvf php-4.3.11.tar.gz, decompress the package and go to the directory php-4.3.11, # cd
Php-4.3.11, execute command #./configure-Prefix =/usr/local/PHP-with-apxs2 =/usr/local/Apache/bin/apxs,
After installation, run # Make and # make install to install PHP. After these processes are completed
Php-4.3.11 generated file PHP. ini-Dist file, need to copy this file to # cp PHP. ini-Dist
/Usr/local/lib/PHP. ini.
Decompress fedora-core-1-i386.tar.gz: two files in this directory need to be decompressed. # Tar-zxvf
Fedora-Core-1-i386.tar.gz.
Command summary for installation (assuming the current directory is/tmp/upload)
#./J2sdk-1.4.2-01-linux-i586-rpm.bin # rpm-IVH j2sdk-1.4.2-01-linux-i586-rpm
# Tar-zxvf Jakarta-tomcat-5.0.28.tar.gz // unzip the file # cd Jakarta-tomcat-5.0.28 #
Music/tmp/upload/Jakarta-tomcat-5.0.28/usr/local
# CD .. # tar-zxvf httpd-2.0.54.tar.gz // unzip the file # cd httpd-2.0.54
#./Configure -- prefix =/usr/local/Apache -- enable-module = most
-- Enable-shared = max # Make // compile # make install // install
# Cp PHP. ini-Dist/usr/local/lib/PHP. ini // copy the file # CD ..
# Tar-zxvf Fedora-Core-1-i386.tar.gz # cp
Fedora-Core-1-i386/usr/lib/httpd/modules/*. So/usr/local/Apache/modules/put the module
Add to Apache # cp Fedora-Core-1-i386/etc/httpd/CONF/workers. Properties
/Usr/local/Apache/conf // This file is a script for Tomcat to work with Apache.
Modify
# Tar-zxvf php-4.3.11.tar.gz // unzip file #./configure -- prefix =/usr/local/PHP
-- With-apxs2 =/usr/local/Apache/bin/apxs // normal // After completion will be in/usr/local/Apache/modules
And add a line to the configuration file httpd. conf of // Apache.
Loadmodule php4_module // modules/libphp4.so # Make // compile # Make
Install // install
V. Configuration
① Configure JDK: to modify the environment variable file/etc/profile, add the following lines to the original file.
Export java_home =/usr/Java/j2sdk1.4.2 export classpath =/usr/Java/j2sdk1.4.2/lib
Run # vi/etc/profile.
Modify Environment Variables
Save the file and run # source/etc/profile to make the modification take effect immediately. Use the command # Java-version to verify the configuration
Is correct.
② Configure Tomcat: This process is complicated and involves several steps.
A. Modify the Web. xml. # vi/usr/local/Jakarta-Tomcat/CONF/Web. xml file
Next part:
<! --
<Servlet>
<Servlet-Name> invoker </servlet-Name>
<Servlet-class>
Org. Apache. Catalina. servlets. invokerservlet
</Servlet-class>
<Init-param>
<Param-Name> debug </param-Name>
<Param-value> 0 </param-value>
</Init-param>
<Load-on-startup> 2 </load-on-startup>
</Servlet>
-->
And <! --
<Servlet-mapping>
<Servlet-Name> invoker </servlet-Name>
<URL-pattern>/servlet/* </url-pattern>
</Servlet-mapping>
-->
Remove the comments of the two parts (that is, <! --> Remove ). The reason for this step is that Tomcat 4.1.12
Servlet callers of later versions are disabled by default.
B. Modify the file jk2.properties. # Vi/usr/local/tomcat/CONF/jk2.properties
# This file may be overriden at runtime. Make sure Tomcat is stoped
# When you edit the file.
# Comments will be _ lost _
# Documentation of the format in jkmain javadoc.
# Set the desired handler list
Handler. List = Apr, request // remove the comment symbol #
# Override the default port for the socketchannel
Channelsocket. Port = 8009 // removed the comment symbol #
# Default:
# Channelunix. File =$ {jkhome}/work/jk2.socket
# Just to check if the config is working
SHM. File =/usr/local/Apache/logs/jk2.shm // manually added
# In order to enable JNI use any channeljni direve ve
# Channeljni. Disabled = 0
# And one of the following ctictives:
# Apr. jnimodeso =/opt/apache2/modules/mod_jk2.so
# If set to inprocess the mod_jk2 will register natives itself
# This will enable the starting of the Tomcat from mod_jk2
# Apr. jnimodeso = inprocess
Verify whether Tomcat works properly. Start Tomcat # sh
/Usr/local/jakarta-tomcat-5.0.28/bin/startup. Sh, normally output Tomcat and JDK directory.
Tomcat startup output
Then, enter the IP address and port number of the Linux server in the Windows computer browser, as shown in the following figure:
<Http: // 192.168.0.100: 8080>: the cute kitten appears if no accident occurs.
③ Configure Apache: Because PHP and JSP must be integrated into Apache (you can think of Apache as a container), this step
The configuration process is also very complex. Verify Apache before configuration to see if it works properly. And Tomcat
This is just like Indicates that everything is normal.
A. Modify the workers2.properties file. The purpose is to make Tomcat and Apache systems work. Use the command # vi
The Edit file/usr/local/Apache/CONF/workers2.properties is as follows:
[SHM]
Info = scoreboard. requried for reconfiguration and status with Multiprocess servers.
File =/usr/local/Apache/logs/SHM. File // This line has been changed.
Size = 1048576 // manually added
# Defines a Load balancer named lb. Use even if you only have one machine.
[LB: LB]
# Example socket channel, override port and host.
[Channel. Socket: localhost: 8009]
Port = 8009
Host = 127.0.0.1
# Define the worker
[Ajp13: localhost: 8009]
Channel = channel. Socket: localhost: 8009
Group = LB
# Map the Tomcat examples webapp to the Web server URI Space
[URI:/*. jsp] // the JSP script is handed over to the Tomcat interpreter. Others are processed by Apache. If this is not the case,
The PHP script in/usr/local/Jakarta-Tomcat/webapps/root cannot be
Resolution. Thank you for your great help.
[URI:/servlet/*]
[URI:/*. Do]
Worker = ajp13: localhost: 8009 // manually added
Group = LB
[Status:]
Info = status worker, displays runtime information
[URI:/jkstatus/*]
Worker = ajp13: localhost: 8009 // manually added
Info = the tomcat/jkstatus Handler
Group = status:
B. Modify the Apache configuration file/etc/httpd/CONF/httpd. conf. # vi.
/Usr/local/Apache/CONF/httpd. conf,
Loadmodule jk2_module modules/mod_jk2.so // JK2 runs in Apache module Mode
Directoryroot "/usr/local/Jakarta-tomcat-5.0.28/webapps/root" // default //
For "/var/www/html" typeadd application/X-httpd-PHP. php3 // Let
Apache can explain PHP scripts //. Note that there are spaces in front of php3.
Vi. Test
Copy several *. php and *. jsp files to the directory, and start Apache and tomcat respectively.
# Sh/usr/local/Apache/bin/apachectl start // start Apache (unfortunately not a helicopter) # sh
/Usr/local/Jakarta-Tomcat/bin/startup. Sh // start Tomcat
Enter the Linux IP address in the browser address bar of any computer, such as http: // 192.168.0.100/index. jsp,
Http: // 192.168.0.100/index. php. If it can be normally displayed in the browser, congratulations !!!
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.