The process and considerations for deploying Java Web Projects with Tomcat under Linux (original) __oracle

Source: Internet
Author: User
Tags echo command java web

It programmer development must-all kinds of resources download list, the most complete IT resources in history, personal collection summary.


The process and considerations for deploying Java Web Projects with Tomcat under Linux (original)

I. Installing JDK
Download Javase 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 the Jdk-6u27-linux-x64-rpm.bin and put it in the/home directory, but other places are fine.
Note: Linux is case sensitive!!!
Add executable permissions to this file: chmod +x Jdk-6u27-linux-x64-rpm.bin

And then execute the 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! do not save 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 was 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 Linux server
(2) uncompressed file, as follows: TAR-ZXVF Apache-tomcat-6.0.33.tar.gz-c/usr/local
(3) Compressed files are extracted into the/usr/local directory to form 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 Java environment variable information. Under/usr/local/apache-tomcat-6.0.33/bin There are files catalina.sh add the following information (note case) to the file header:
Export java_home=/usr/java/jdk1.6.0_
exportclasspath=.: $CLASSPATH: $JAVA _home/lib: $JAVA _home/jre/lib
Export path= $PATH: $JAVA _home/bin: $JAVA _ Home/jre/bin
(5) has an executable program under/usr/local/apache-tomcat-5.5.17/bin
to start Tomcat #  ./startup.sh
Turn off Tomcat #  ./shutdown.sh
To see if the boot is successful you can enter PS Axuwf|grep java, if a lot of results, is the start of success.
can also be NETSTAT-LNPT, Check that port 8088 is not in use. If used, the instructions start successfully.
(6) test Tomcat open IE, enter URL http://ip address:8080   can see Tomcat launch welcome page, prove tomcat configured correctly
in tomcat/conf/ The default port number can be modified in Server.xml: For example, change to 8088, note: Do not add <Context> elements as in Windows

Three. Deployment of Java Web applications
To export the Web application to the war package file in Eclipse and copy it to the Tomcat/wabapps directory
The folder of the referenced item is also tested in the Tomcat/wabapps directory
Start Tomcat again after shutdown
Enter HTTP://IP address when accessing: 8088/war file name/....
For example, the war file name is 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, and at the end add
<role rolename= "Manager"/>
<role rolename= "admin"/>
<user username= "admin" password= "123456" roles= "Admin,manager"/>
Click the Tomcat Manager link at the top left corner of the Tomcat welcome page to view the running application after entering admin,123456.

to see the startup log, you can use the command at the command line:./catalina.sh run starts the Tomcat service

To start and run the Tomcat service in the background, the Tomcat service is not closed with the SSH terminal shutdown and can be used on the command line: Nohup./catalina.sh Run



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.