一、安装JDK7
1.从Oracle下载JDK7到Centos桌面:jdk-7u71-linux-x64.rpm
2.将其拷贝到/usr目录下:
cp ‘/home/shenzhun/Desktop/jdk-7u71-linux-x64.rpm’ /usr/
3.进入/usr目录,赋予其权限,运行安装:
cd /usr
chmod 777 jdk-7u71-linux-x64.rpm
rpm -ivh jdk-7u71-linux-x64.rpm
运行截图:
4.配置环境变量:
vi /etc/profile
追加以下内容:
export JAVA_HOME=/usr/java/jdk1.7.0_71
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
5.移除默认安装的JDK:
rpm -qa|grep jdk
yum -y remove java java-1.6.0-openjdk-1.6.0.0-1.24.1.10.4.el5
结果截图:
6.运行javac、java及java -version,验证JDK7是否成功安装。
二、安装Tomcat7
1.去apache下载apache-tomcat-7.0.57.tar.gz到桌面
2.解压tar zxvf apache-tomcat-7.0.29.tar.gz
3.移动目录到/tomcat下:mv ‘/home/shenzhun/Desktop/apache-tomcat-7.0.57’ /tomcat
4.重命名为tomcat7:mv apache-tomcat-7.0.57/ tomcat7
5.进入tomcat7/bin目录下,运行”sh startup.sh”或者”./startup.sh”即可启动tomcat: