Install jdk1.7 under Linux CentOS 6.5, tomcat7.0 environment configuration __linux

Source: Internet
Author: User
Tags gz file mixed pack centos iptables
First, jdk1.7 installation instructions

Software: jdk-7-linux-x64.rpm
Download Address: http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

Verify the original version of the system

[Root@zck ~]# java-version
java Version "1.6.0_24"
OpenJDK Runtime (Environment IcedTea6) ( rhel-1.45.1.11.1.el6-x86_64)
OpenJDK 64-bit Server VM (build 20.0-b12, Mixed mode)

Further view JDK information:

[Root@zck ~]# Rpm-qa | grep java
tzdata-java-2012c-1.el6.noarch
java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.x86_64

Uninstall OPENJDK and do the following:

[Root@zck ~]# rpm-e--nodeps tzdata-java-2012c-1.el6.noarch [root@zck ~]# rpm-e---nodeps
Java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.x86_64

Installing JDK

Upload the new jdk-7-linux-x64.rpm software to/usr/local/to perform the following actions:

[Root@zck local]# RPM-IVH jdk-7-linux-x64.rpm

The JDK is installed by default in/usr/java.

Verifying installation

Do the following to see if the information is normal:

[Root@zck bin]# java
[root@zck bin]# javac
[root@zck bin]# java-version
java Version "1.7.0"
Java (TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot (TM) 64-bit Server VM (build 21.0-b17, Mixed mode)

Configure Environment variables

I did not configure the JDK environment variables without configuring the environment variables to perform the JAVAC and java–version operations properly after my machine was installed jdk-7-linux-x64.rpm. But for future discomfort, here is still a record of how to configure, the operation is as follows:
modifying system environment variable files

VI +/etc/profile

Append the following content to the file:

java_home=/usr/java/jdk1.7.0
jre_home=/usr/java/jdk1.7.0/jre
path= $PATH: $JAVA _home/bin: $JRE _home/bin
classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib
export java_home jre_home PATH CLASSPATH

Make the changes take effect

[Root@zck local]# source/etc/profile//   make modification take effect immediately
[Root@zck local]#        echo $PATH   //view PATH value

View System Environment Status

[Root@zck ~]# echo $PATH
/usr/local/cmake/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin :/usr/sbin:/usr/bin:/usr/java/jdk1.7.0/bin:/usr/java/jdk1.7.0/jre/bin:/root/bin
two. tomcat7.0 Installation configuration

Software: apache-tomcat-7.0.29.tar.gz
Download Address: http://tomcat.apache.org/download-70.cgi

Install Tomcat:
Upload the apache-tomcat-7.0.29.tar.gz file to the/usr/local and perform the following actions:
The code is as follows:

[Root@admin local]# cd/usr/local  
[root@admin local]# wget /v7.0.57/bin/apache-tomcat-7.0.57.tar.gz  
[root@admin local]# tar-zxv-f apache-tomcat-7.0.29.tar.gz/Decompression Compression pack  
[root@admin local]# rm-rf apache-tomcat-7.0.29.tar.gz//delete zip pack  
[Root@admin local]# MV apache-tomcat-7.0.29 Tomcat  

Start Tomcat:

[Root@admin ~]#/usr/local/tomcat/bin/startup.sh//start tomcat  
using catalina_base:/usr/local/tomcat  
using Catalina_home:/usr/local/tomcat  
using Catalina_tmpdir:/usr/local/tomcat/temp  
using jre_home:/usr/java/ Jdk1.7.0/jre  

The above information appears to have started successfully.

Firewall open 8080 ports

Add 8080 ports to the firewall configuration and do the following:

[Root@admin ~]# VI +/etc/sysconfig/iptables  

Add the following code:

-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 8080-j ACCEPT  

Reboot the firewall:

[Root@admin java]# Service iptables restart

To verify the Tomcat installation run:
Check to see if Tomcat is functioning at the following address:
http://192.168.0.54:8080/
See the Tomcat system interface to indicate that the installation was successful.
Stop Tomcat

[Root@admin ~]#  /usr/local/tomcat/bin/shutdown.sh   
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.