由于redhat自带安装了jdk,我们需要现将其进行卸载 卸载系统自带的jdk版本:
查看自带的jdk:
输入命令:rpm -qa|grep gcj
可能看到如下类似的信息:
libgcj-4.1.2-44.el5 java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
使用rpm -e --nodeps 命令删除上面查找的内容: rpm -e --nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
卸载之后重新安装
建目录存放软件 mkdir /soft/
切换至该目录 cd /soft/
上传文件至该目录
解压JDK tar -zxvf jdk-7u65-linux-i586.tar.gz
先备份一下 cp -R /etc/profile /etc/profile_ec
配置环境变量 vi /etc/profile
在文件最后添加如下内容:
JAVA_HOME=/soft/jdk1.7.0_65 CLASSPATH=$JAVA_HOME/lib/ PATH=$PATH:$JAVA_HOME/bin export PATH JAVA_HOME CLASSPATH
保存退出: ESC ---> shift + : wq
使修改的内容立即生效 source /etc/profile
解压tomcat tar -zxvf apache-tomcat-7.0.88.tar.gz
进入到tomcat目录 cd /soft/apache-tomcat-7.0.88/bin/
开启tomcat ./startup.sh
在浏览器中访问 http://ip:8080 至此tomcat与java环境搭建完成
存放软件包 tomcat目录结构如下:
bin用来存放tomcat的命令的地方 webapps用来存放软件包的目录
上传软件包至tomcat/webapps目录/soft/apache-tomcat-7.0.88/webapps/下
停止tomcat服务
cd /soft/apache-tomcat-7.0.88/bin/ ./shutdown.sh
解压项目包
cd /soft/apache-tomcat-7.0.88/webapps/ unzip exam.zip
运行tomcat服务
cd /soft/apache-tomcat-7.0.88/bin/ ./startup.sh
5.在浏览器中访问http://ip:8080/exam