Java EE Development Environment configuration under centos6.2 (1)-Java + Tomcat environment Configuration

Source: Internet
Author: User

Version description:

JDK: jdk1.7.0 _ 03

Package: jdk-7u3-linux-i586.rpm

Tomcat: APACHE-Tomcat-7.0.26

Package: apache-tomcat-7.0.26.tar.gz

Step 4 install JDK:

(The following steps require root permissions ($ su ...))

Copy the jdk-7u3-linux-i586.rpm to the/usr/Java/directory, of course, if there is no Java directory, first create a, (mkdir)

Under centos6.2, you can double-click to run the jdk-7u3-linux-i586.rpm and wait for the installation to complete. (Environment variables can be configured with Tomcat)

After the installation is completed, the following code is displayed:

Step 4 install Tomcat:

Download and unzip the package directly, and put it in the/usr/local/directory. My software:

Step 1 configure the environment variable (append the global shell environment variable to/etc/profile ):

After obtaining the root permission on the terminal, use the gedit editor that comes with centos6.2:

The command is as follows:

Append the content at the end of the file (if the version is different, it is a different directory name ):

export JAVA_HOME=/usr/java/jdk1.7.0_03export JRE_HOME=/usr/java/jdk1.7.0_03/jreexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport TOMCAT_HOME=/usr/local/tomcatexport CATALINA_HOME=/usr/local/tomcatexport PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:$JAVA_HOME/bin

Save it! Of course, if you do not have the root permission, the file is read-only!

Is the configuration effective:

# Source/etc/profile // make the current configuration take effect immediately

Step 2: Run Tomcat:

After obtaining the root permission, #/usr/local/tomcat/bin/startup. Sh is displayed, but the permission is insufficient,

Use # ls-L/usr/local/tomcat/bin/startup. sh really shows-RW-r ---, indicating that no one has the permission to modify it, and the root does not work, so it is not difficult to get the code;

#chmod a+x startup.sh
#chmod a+x catalina.sh

Run startup. Sh

Open your browser and enter localhost: 8080.

View the Tomcat login page in the browser:

Add tomcat to auto-start upon startup:

# echo "/usr/local/tomcat/bin/startup.sh" >>/etc/rc.local

Open Tomcat ports to the firewall

# iptables -F# iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080# iptables -t nat -I OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080

Complete. You need to configure nginx and memcache for future tasks!

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.