1. renewal
1,
Http://www.oracle.com/technetwork/java/javase/downloads/index.html
If a 32-bit system is installed, download the jdk-7u21-linux-i586.rpm;
If a 64-bit system is installed, download the jdk-7u21-linux-x64.rpm;
2. install JDK
Log on with root and execute
rpm -ivh jdk-7u21-linux-i586.rpm
The 64-bit system is:
rpm -ivh jdk-7u21-linux-x64.rpm
The default installation path is/usr/java/jdk1.7.0 _ 21.
3. configure JDK
vi /etc/profile
Append the following information under the profile file:
export JAVA_HOME=/usr/java/jdk1.7.0_21export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport PATH=$PATH:$JAVA_HOME/bin
Save and exit. execute:
source /etc/profile
Update alternatives and select JDK Version
Run:
update-alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_21/bin/java 60
Configure JDK and run the following command:
update-alternatives --config java
There are 2 programs which provide 'java '.
Selection Command
----------------
* 1/usr/lib/jvm/jre-1.5.0-gcj/bin/java
+ 2/usr/java/jdk1.7.0 _ 21/bin/java
Enter to keep the current selection [+], or type selection number: 2
Select the latest installed/usr/java/jdk1.7.0 _ 21/bin/java, and press enter.
Next, enter java-version to see:
Java version "1.7.0 _ 21 ″
Java (TM) SE Runtime Environment (build 1.7.0 _ 21-b11)
Java HotSpot (TM) Client VM (build 23.7-b11, mixed mode, sharing)
4. download tomcat
Http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.34/bin/apache-tomcat-7.0.34.tar.gz
Decompress the file and execute:
tar -zxvf apache-tomcat-7.0.34.tar.gz
Rename the folder and execute:
mv apache-tomcat-7.0.34 tomcat
Move the decompressed folder. Here I move to the/data/www directory.
5. configure tomcat
vi /etc/profile
Append the following information under the profile file:
export TOMCAT_HOME=/data/www/tomcat/
Save and exit. execute:
source /etc/profile
6. start tomcat
cd /data/www/tomcat/bin/chmod +x *.sh./ catalina.sh start
7. configure firewall rules and enable port 8080
Vi/etc/sysconfig/iptables-a input-m state -- state NEW-m tcp-p tcp -- dport 8080-j ACCEPT # Allow port 8080 to pass the firewall
Note: This rule should be added to the default port 22 rule.
/Etc/init. d/iptables restart # restart the firewall to make the configuration take effect.
Finally, enter the server ip address 8080 in the browser as follows: http: // 192.168.1.36: 8080 to open the default tomcat page.