首页 > 代码库 > centos6中jdk和tomcat安装
centos6中jdk和tomcat安装
虽然通过yum也可以安装jdk和tomccat但是我们还是建议去官网下载需要的版本安装。
1:jdk的安装
在这我们选择tar.gz压缩包,当然你也可以选择rpm包,因为我们的操作系统用的64位所以相应的我们也选择64位的软件包
[root@centos6_64 ~]# tar -zxvf jdk-7u67-linux-x64.gz
[root@centos6_64 ~]# mkdir /usr/local/jdk
[root@centos6_64 ~]# cp -R jdk1.7.0_67 /usr/local/jdk/
如果只是做提供给tomcat之用可以不用设置环境变量
2:tomcat下载http://tomcat.apache.org/,在这我们下载tomcat7.0,在这我们用wget命令下载tomcat
下载tar.gz,下图是我们通过sougo浏览器直接复制tomcat的地址,如果是ie就看看属性。
[root@centos6_64 ~]# wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-7/v7.0.55/bin/apache-tomcat-7.0.55.tar.gz
[root@centos6_64 ~]# tar -zxvf apache-tomcat-7.0.55.tar.gz
[root@centos6_64 ~]# mkdir /usr/local/tomcat
[root@centos6_64 ~]# cp -R apache-tomcat-7.0.55 /usr/local/tomcat/7-1
[root@centos6_64 ~]# cd /usr/local/tomcat/7-1/bin
[root@centos6_64 ~]# vi catalina.sh
找到cygwin=false这行,在这行的上面添加 JAVA_HOME=/usr/local/jdk/jdk1.7.0_67,然后保存退出
[root@centos6_64 ~]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat/7-1
Using CATALINA_HOME: /usr/local/tomcat/7-1
Using CATALINA_TMPDIR: /usr/local/tomcat/7-1/temp
Using JRE_HOME: /usr/local/jdk/jdk1.7.0_67
Using CLASSPATH: /usr/local/tomcat/7-1/bin/bootstrap.jar:/usr/local/tomcat/7-1/bin/tomcat-juli.jar
Tomcat started.
[root@centos6_64 ~]# ps -ef|grep java
root 2088 1 38 21:37 pts/1 00:00:09 /usr/local/jdk/jdk1.7.0_67/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/7-1/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/7-1/endorsed -classpath /usr/local/tomcat/7-1/bin/bootstrap.jar:/usr/local/tomcat/7-1/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat/7-1 -Dcatalina.home=/usr/local/tomcat/7-1 -Djava.io.tmpdir=/usr/local/tomcat/7-1/temp org.apache.catalina.startup.Bootstrap start
root 2109 2047 0 21:37 pts/1 00:00:00 grep java
进程有了
[root@centos6_64 bin]# netstat -anlp|grep java
tcp 0 0 :::8080 :::* LISTEN 2088/java
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 2088/java
tcp 0 0 :::8009 :::* LISTEN 2088/java
unix 2 [ ] STREAM CONNECTED 14581 2088/java
8080 端口监听了说明服务正常运行
centos6中jdk和tomcat安装