系统环境:centos6 / centos7
安装配置jdk
查询当前系统安装是否有jdk,有的话则卸载掉
rpm -qa|grep java 卸载: rpm -e 包名称 加参数:--nodeps 忽略依赖关系卸载
百度网盘下载包(jdk 和tomcat ):http://pan.baidu.com/s/1bpsgXUf
mkdir -p /usr/local/java tar xf jdk-7u49-linux-x64.gz -C /usr/local/java/ mv jdk1.7.0_79/ jdk1.7
修改系统环境变量
vim /etc/profile 添加下面内容到最下面,保存退出 export JAVA_HOME=/usr/local/java/jdk1.7 export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar 重新读取系统变量 source /etc/profile
查看java 设置系统变量是否生效
[root@localhost ~]# java -version java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
安装配置 tomcat
解压安装包,移动并更名
[root@localhost ~]# tar xf apache-tomcat-7.0.42.tar.gz [root@localhost ~]# mv apache-tomcat-7.0.42 /usr/local/java/tomcat
启动tomcat
[root@localhost ~]# /usr/local/java/tomcat/bin/startup.sh Using CATALINA_BASE: /usr/local/java/tomcat Using CATALINA_HOME: /usr/local/java/tomcat Using CATALINA_TMPDIR: /usr/local/java/tomcat/temp Using JRE_HOME: /usr/local/java/jdk1.7.0_79/jre Using CLASSPATH: /usr/local/java/tomcat/bin/bootstrap.jar:/usr/local/java/tomcat/bin/tomcat-juli.jar
出现下面图则ok!
访问8080端口: