This article takes Redhat AS5 and Linux 2.6.18-8. el5 as an example. The Redhat/Fedora series are basically the same, and can be referenced in other Linux or versions. STEP 1
Software Download:
1. jdk1.6.x http://java.sun.com/javase/downloads/index.jsp
2. tomcat6.x http://tomcat.apache.org/download-60.cgi Note: This requires the CORE version
3. apache2.x http://httpd.apache.org/download.cgi
4. jk_mod1.2.x http://tomcat.apache.org/download-connectors.cgi if the above files have been successfully downloaded, and put to/home/work/software/, suppose you are a work user. SETP 2
1. JDK Installation
1.1 decompress the package and grant the download program the executable permission.
[Work @ localhost webServer] $ chmod a + r jdk-6u10-beta-linux-i586.bin
* ** A license agreement ***
Do you agree to the above license terms? [Yes or no]
[Work @ localhost webServer] $ yes
* ** Decompression process ***
Done.
# If a license agreement is displayed and you are prompted to agree to the above terms, enter yes. [Work @ localhost webServer] $ mv jdk1.6.0 _ 10/home/work/usr/local/
[Work @ localhost local] $ ln-s jdk1.6.0 _ 10 jdk
After that, move the decompressed jdk1.6.0 _ 10 folder to a dedicated directory, and configure Java environment variables by using a symbolic connection 1.2.
Directly edit the/etc/profile file or create a java. sh file in the/etc/profile. d/file.
Normal users do not have the editing permission. You can authorize or switch to the root account to edit the file.
[Work @ localhost local] $ vim/etc/profile. d/java. sh
Here we use the newly created java. sh file as an example (this method is also recommended) and add the following content: # set java environment variable
JAVA_HOME =/home/work/usr/local/jdk
PATH = $ PATH:/$ JAVA_HOME/bin
CLASSPATH =.: $ JAVA_HOME/lib
JRE_HOME = $ JAVA_HOME/jre
Export JAVA_HOME path classpath JRE_HOME 1.3 sets the symbolic connection between java and javac. This is to change the default jdk (JDK1.4 by default in the system) to the newly installed jdk 1.6.
[Work @ localhost local] # cd/usr/bin # Switch to usr/bin directory
[Work @ localhost local] # su root # Switch to the root account for symbolic connection
[Root @ localhost bin] # ln-s-f/home/work/usr/local/jdk/jre/bin/java
[Root @ localhost bin] # ln-s-f/home/work/usr/local/jdk/bin/javac JDK installation is complete, please refer to: http://jiarry.bokee.com/2425368.html 2. Tomcat installation
2.1 decompress the package and move the folder to the specified directory.
[Work @ localhost webServer] $ tar-zxvf apache-tomcat-6.0.16.tar.gz
[Work @ localhost webServer] $ mv apache-tomcat-6.0.16/home/work/usr/local/
2.2 configure Environment Variables
Edit the newly created/etc/profile. d/java. sh file (if no new file is created, edit the/etc/profile file) and add atat_home
TOMCAT_HOME =/home/work/usr/local/tomcat
Export JAVA_HOME path classpath JRE_HOME TOMCAT_HOME3. test and install
3.1 check environment variables and java versions
Enter the following commands to check whether the output matches the settings:
[Work @ localhost ~] $ Echo $ JAVA_HOME
/Home/work/usr/local/jdk
[Work @ localhost ~] $ Echo $ PATH
The output contains/home/work/usr/local/jdk/bin:
[Work @ localhost ~] $ Echo $ CLASSPATH
.:/Home/work/usr/local/jdk/lib
[Work @ localhost ~] $ Echo $ TOMCAT_HOME
After the java and javac symbols under/home/work/usr/local/tomcat settings/usr/bin are connected, the new jdk1.6
[Work @ localhost ~] $ Java-version
Java version "1.6.0 _ 10-beta"
Java (TM) SE Runtime Environment (build 1.6.0 _ 10-beta-b25)
Java HotSpot (TM) Client VM (build 11.0-b12, mixed mode, sharing)
If no symbolic connection is set, jdk1.4 is the default one.
[Work @ localhost ~] $ Java-version
Java version "1.4.2"
Gij (GNU libgcj) version 4.1.1 20070105 (Red Hat 4.1.1-52) 3.2 start tomcat
[Work @ localhost local] $ sh/home/work/usr/local/tomcat/bin/startup. sh
Enter http: // localhost: 8080/in the address bar of the browser/
If you can see the welcome page of Tomcat, the integration is successful. Now the Java/JSP server has been built. 3.3 Add a project to Tomcat
3.3.1 modify tomcat/conf/server. add the test project to the <Host name = "localhost"> </Host> file: <Context path = "/test" reloadable = "true" docBase = "/home/work/dev/test"
WorkDir = "/home/work/usr/local/tomcat/work/test"/>
In this way, a project named test is added. path is the web Request access path, docBase is the directory actually put, and workDir is the tomcat parsing working directory, which can be placed under tomcat's work.
He can access the test project through http: // localhost: 8080/test.
So far, Tomcat configuration is complete. To enable directory browsing and servlet direct access, refer to the following configuration. 3.3.2 enable directory browsing. tomcat does not enable directory browsing by default. You can change the value of listings in web. xml to true by modifying the value of false. As follows:
<Param-name> listings </param-name>
<Param-value> true </param-value> 3.3.3 servlet direct access is disabled by default. You can modify the configurations of web. xml and context. xml files to enable this function, as shown below:
Web. xml. Find this section and open the comment. (Of course, servlet is recommended for implicit injection)
<Servlet-name> invoker </servlet-name>
<Servlet-class>
Org. apache. catalina. servlets. InvokerServlet
</Servlet-class>
In this section, annotations are also enabled.
<Servlet-mapping>
<Servlet-name> invoker </servlet-name>
Context. xml. Add privileged in Context
<Context privileged = "true"> SETP 3 Apache installation Configuration
1. Decompress Apache and read the INSTALL file in the httpd directory.
[Work @ localhost webServer] $ tar-zxvf httpd-2.2.9.tar.gz
You can move the obtained folder to the installation directory, such as/home/work/software/. Put it in/home/work/software/webServer/
[Work @ localhost webServer] $ cd httpd-2.2.9
[Work @ localhost httpd-2.2.9] $./configure -- help # It is best to check the compilation command first
[Work @ localhost httpd-2.2.9] $./configure -- prefix =/home/work/usr/local/apache2 -- enable-mods-shared = all
[Work @ localhost httpd-2.2.9] $ make
[Work @ localhost httpd-2.2.9] $ make install
[Work @ localhost httpd-2.2.9] $ cd/home/work/usr/local/apache2
[Root @ localhost apache2] # su root
[Work @ localhost apache2] $ bin/apachectl start
Compile and install -- enable-so-mod-shared = all in the new version of the installation documentation, there is no prompt to load, directly./configure -- prefix =/home/work/usr/local/apache2
The installation takes 2 minutes. After the installation is complete, switch to the root account to start Apache.
Enter http: // localhost/in the address bar. If the it works welcome page is displayed, the request is successful.
Configure apache/conf/http. conf in http://httpd.apache.org/docs/2.2/install.html 2
# Add a test project
Alias/ut "/home/work/dev/test"
<Directory "/home/work/dev/test">
Options Indexes FollowSymLinks MultiViews between des ExecCGI
AllowOverride None
Order allow, deny
Allow from all
</Directory> # prohibit access to the WEB-INF folder
<Directory "/home/work/dev/test/WEB-INF">
Order allow, deny
</Directory> enable the annotation configuration language and set the default Chinese character.
Include conf/extra/httpd-languages.conf
Add the following code in the extra/httpd-languages.conf, so that the default is Chinese, such as Ajax request data, do not define encoding can also be normal support of Chinese.
DefaultLanguage zh-CN
Adddefacharcharset gb2312 3 open the browser and enter http: // localhost/test/to check the directory list. You can access the previously created JSP file and try it out. Because Tomcat Connector has not been configured, so it will be processed as a text file.
If access is prohibited, you must authorize [work @ localhost ut] $ chmod 777 * SETP 4 to install jk_mod and integrate Apache and Tomcat.
1. Copy the downloaded binary mod_jk-1.2.26-httpd-2.2.6.so to the modules directory of apache.
: Http://apache.mirror.phpchina.com/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.26/
2. Create two new files in the conf directory of Apache, mod_jk.conf and workers. properties. The configuration process is basically the same as that of windows.
The content of mod_jk.conf is the jk configuration file, including the loading module and log information, as well as the designated parser and directory. workers. properties is the Tomcat wokers configuration file. 3. Add the following content to mod_jk.conf (the mod_jk.conf file is convenient for management, and you do not need to write the configuration in httpd. conf)
# Load jk module. The name must correspond
LoadModule jk_module modules/mod_jk-1.2.26-httpd-2.2.6.so
# Load the newly created workers. properties File
JkWorkersFile conf/workers. properties
# Jk log file
JkLogFile logs/mod_jk.log
# Jk log level. The parameters include [debug/error/info]
JkShmFile logs/mod_jk.shm
JkLogLevel info
# Jk log data format
JkLogStampFormat "[% a % B % d % H: % M: % S % Y]"
# Some configuration options of Jk: indicate to send ssl key size,
JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories
# Jk request log format
JkRequestLogFormat "% w % V % T" # submit the JSP do Servlet File to Tomcat for processing
JkMount/servlet/* ajp13
JkMount/*. jsp ajp13
JkMount/*. do ajp13
# JkMount indicates that Tomcat is used for parsing, while JkUnMount indicates that the opposite is true.
# JkMount/test/* ajp13 indicates that all files and subdirectories under the test directory are handed over to Tomcat for processing.
# Generally, jsp and servlet programs can be processed by tomcat, and static file images are still processed by Apache.
# You can set it as needed. For example, you can only send test/*. jsp to Tomcat for processing # JkMount/test/*. jsp ajp13
# JkAutoAlias/home/work/dev/test /*
# All static files in this folder are automatically processed by Apache.
JkMount/test/servlet/* ajp13
#/Test/servlet/all files are also handed over to Tomcat to process 4. Edit the httpd. conf file of Apache and load the jk_mod.conf file:
Include conf/mod_jk.conf 5 edit the workers. properties file and add the following content:
Workers. tomcat_home =/home/work/usr/local/tomcat/
Workers. java_home =/home/work/usr/local/jdk/
Ps = \
Worker. list = ajp13
Worker. ajp13.port = 8009
Worker. ajp13.host = localhost
Worker. ajp13.type = ajp13
Worker. ajp13.lbfactor = 1
# If no special configuration is available, you can leave the content empty or not.
# Configuration reference see http://tomcat.apache.org/connectors-doc/reference/workers.html 6 if the download is the source file, need to compile and then configure. It is also very simple, as follows:
[Work @ localhost webServer] $ tar-zxvf tomcat-connectors-1.2.26-src.tar.gz
Decompress the file first, decompress the build.txt file, and follow the instructions.
[Work @ localhost webServer] $ cd tomcat-connectors-1.2.26-src/native/
[Work @ localhost native] $./configure -- with-apxs =/home/work/usr/local/apache2/bin/apxs
Note that the path of apxs is your apache directory bin/apxs [work @ localhost native] $ make
[Work @ localhost native] $ su-c 'make install'
Follow the prompts to enter the root password for installation. The following prompt is displayed:
Libraries have been installed in:
/Home/work/usr/local/apache2/modules chmod 755/home/work/usr/local/apache2/modules/mod_jk.so [work @ localhost modules] $ cd/home/work /usr/local/apache2/modules/
Go to the Module Directory of Apache and authorize mod_jk without changing the user group.
[Work @ localhost modules] $ su-c 'chgrp-R work mod_jk.so'
[Work @ localhost modules] $ su-c 'chown-R work mod_jk.so'
[Work @ localhost modules] $ chmod 777 mod_jk.so create jk_mod.conf and workers. properties, and configure them in the same way as the above 5.2 Installation Method
Edit the newly created apache/conf/jk_mod.conf file and load mod_jk.so. For detailed configuration, see 5.4
LoadModule jk_module modules/mod_jk.so 7 restart Apache test
[Work @ localhost modules] $ su-c '/home/work/usr/local/apache2/bin/apachectl restart'
Open the browser and access the jsp file through the following two addresses respectively. If normal resolution is available, the integration is successful. According to the configuration of Apache and Tomcat, test points to the same directory.
Http: // localhost/test/
Http: // localhost: 8080/test/. In this way, Apache and Tomcat are added with Jk_mod.
If you encounter any problems, you can view the log information of apache and jk_mod. Generally, the configuration file details can be solved:
So far, the http://tomcat.apache.org/connectors-doc/reference/apache.html Tomcat in Apache integration completed, the installation process is actually very simple. You only need to be careful and strictly follow the steps. Remember to refer to the readme and install files. Refer:
Full version please view: http://docs.google.com/View? Docid = dgh6pn6x_19ccgx54hd
Jdk1.6 + Tomcat6 + Apache2 + jk_mod1.2 + PHP5 + MySql5 installation and configuration details http://jiarry.bokee.com/6738182.html (windows)
Install Jdk + Tomcat + Apache + PHP + MySql (Linux) detailed introduction to http://jiarry.bokee.com/2425368.html
Several commands are required for installation:
1. download the file: wget URL
2. Compression: tar-zxvf file name (.tar or .tar.gz) tar-jxvf file name (.tar.bz2)
3. Copy: cp file name or cp-Rf folder name
4. Delete: rm file name or rm-Rf folder name
5. edit the file command: vi file name, q! (Do not save and exit): wq (save and quit)
6. Authorize chmod 777 * (file name or folder, supporting wildcards)
7. Change User ownership chown-R user.
8. Change the chgrp-R user of the user group.
9. Switch user su user
10. Run the su-c "command" as the root user"
11. View mysql processes, such as ps-el | grep mysqld.
Http://lcw410.blog.51cto.com/119396/106299
Http://www.svn8.com/java/pz/20090724/7651.html
Http://www.cnblogs.com/kaixuan/archive/2009/03/18/1415431.html
Http://www.pcdog.com/edu/linux/18/10/y234511.html
Http://lcw410.blog.51cto.com/119396/106299
Http://jiarry.bokee.com/2425368.html
Http://tech.ccidnet.com/art/302/20041217/191565_1.html
Http://www.blogjava.net/crespochen/archive/2009/01/16/251535.html
Http://www.cnblogs.com/CSblog/archive/2009/09/24/1573275.html
Http://www.javaeye.com/topic/313209
Unzip
Tar-xvfj example.tar.bz2
Tar-xvfz example.tar.gz
Tar-xvfz example. tgz
Tar-xvf example.tar
Unzip example.zip