Procedures and considerations for deploying a Java Web project with Tomcat under Linux

Source: Internet
Author: User
Tags echo command java se

Procedures and considerations for deploying a Java Web project with Tomcat under Linux

I. Installing the JDK
Download Java SE 6 Update 27 to Http://www.oracle.com/technetwork/java/javase/downloads/index.html
Choose Linux x64-rpm Installer or Linux x86-rpm based on the operating system Installer
Download Jdk-6u27-linux-x64-rpm.bin and put it in the/home directory, of course, anywhere else.
Note: Linux is case-sensitive!!!
Add executable permissions to this file: chmod +x Jdk-6u27-linux-x64-rpm.bin

Then execute this file:. jdk-6u27-linux-x64-rpm.bin

Configure the Java environment variables, modify the/etc/profile file: Vi/etc/profile then press the letter I into insert mode,
Shift+insert paste;
ESC exits edit;
: Wq save exit;
: q! does not save the exit;
Add the following lines at the end:
#set Java evironment
Java_home=/usr/java/jdk1.6.0_27
Classpath=.: $JAVA _home/lib.tools.jar
Path= $JAVA _home/bin: $PATH
Export Java_home CLASSPATH PATH

Use the echo command at the terminal to check environment variable settings:
#echo $JAVA _home
#echo $CLASSPATH
#echo $PATH
Check that the JDK is installed successfully:
#java-version
If you see the JVM version and related information, the installation is successful

Two. Tomcat Configuration Deployment
(1) file upload:
Download apache-tomcat-6.0.33.tar.gz on tomcat website
upload to the Linux server
(2) Unzip the file as follows: TAR-ZXVF Apache-tomcat-6.0.33.tar.gz-c/usr/local
(3) Compressed files are extracted to the/usr/local directory, forming a new folder apache-tomcat-6.0.33, Inside is all the Tomcat-related execution configuration files.
(4) Modify the configuration file to increase the environment variable information for Java. Under/usr/local/apache-tomcat-6.0.33/bin file catalina.sh Add the following information to the file header (note case):
Export java_home=/usr/java/jdk1.6.0_
Export classpath=.: $CLASSPATH: $JAVA _home/lib: $JAVA _home/jre/lib
Export path= $PATH: $JAVA _home/bin: $JAVA _ Home/jre/bin
(5) executable program under/usr/local/apache-tomcat-5.5.17/bin
to start Tomcat #   ./startup.sh
Turn off Tomcat #   ./shutdown.sh
to see if startup success can be entered PS axuwf|grep Java, if there are a lot of results, is the start success.
You can also netstat-lnpt to see if Port 8088 is used. If it is used, the boot is successful.
(6) test Tomcat open IE, enter URL HTTP://IP address:8080    can see Tomcat's launch Welcome page, prove that Tomcat is configured correctly
in tomcat/ The default port number can be modified in Conf/server.xml: For example, change to 8088, note: Do not add the <Context> element as in Windows

Three. Deployment of Java Web Apps
Export the Web application into the war package file in Eclipse and copy it into the Tomcat/wabapps directory
The folder of the referenced items is also tested in the Tomcat/wabapps directory
Start Tomcat again after shutting down
Enter HTTP://IP address when accessing: 8088/war file name/....
For example, the war file is named Wapinfo.war
Then enter HTTP://IP address: 8088/wapinfo/....
To access

To facilitate the management of the project, you can modify the/root/apache-tomcat-6.0.33/conf/tomcat-users.xml file, at the end add
<role rolename= "Manager"/>
<role rolename= "admin"/>
<user username= "admin" password= "123456" roles= "Admin,manager"/>
Click the Tomcat Manager link in the upper-left corner of the Tomcat welcome page to view the running apps after entering admin,123456.

Procedures and considerations for deploying a Java Web project with Tomcat under Linux

Related Article

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.