centos6.5 源码安装tomcat

标题 源码安装tomcat

1.准备java环境

[root@wss ~]# ls
anaconda-ks.cfg              install.log         jdk-8u20-linux-x64.rpm  模板  图片  下载  桌面
apache-tomcat-7.0.47.tar.gz  install.log.syslog  公共的                  视频  文档  音乐
[root@wss ~]# 

2.安装java

[root@wss ~]# rpm -ivh jdk-8u20-linux-x64.rpm 
Preparing...                ########################################### [100%]
   1:jdk1.8.0_20            ########################################### [100%]
Unpacking JAR files...
 rt.jar...
 jsse.jar...
 charsets.jar...
 tools.jar...
 localedata.jar...
 jfxrt.jar...
[root@wss ~]# 

3.配置java环境

[root@wss ~]# vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_20
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

4.刷新java环境,查看版本

[root@wss ~]# source /etc/profile
[root@wss ~]# java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
[root@wss ~]# 

5.解压tomcat源码包

[root@wss ~]# tar zxf apache-tomcat-7.0.47.tar.gz 
[root@wss ~]# mkdir /usr/local/tomcat
[root@wss ~]# mv apache-tomcat-7.0.47 /usr/local/tomcat/
[root@wss ~]# cd /usr/local/tomcat/
[root@wss tomcat]# ls
apache-tomcat-7.0.47
[root@wss tomcat]# 

6.启动tomcat

[root@wss tomcat]# cd /usr/local/tomcat/apache-tomcat-7.0.47/bin/
[root@wss bin]# ./startup.sh
Using CATALINA_BASE:   /usr/local/tomcat/apache-tomcat-7.0.47
Using CATALINA_HOME:   /usr/local/tomcat/apache-tomcat-7.0.47
Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-7.0.47/temp
Using JRE_HOME:        /usr/java/jdk1.8.0_20
Using CLASSPATH:       /usr/local/tomcat/apache-tomcat-7.0.47/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-7.0.47/bin/tomcat-juli.jar
[root@wss bin]# 

7.关闭防火墙和selinux

[root@wss bin]# service iptables stop
iptables:将链设置为政策 ACCEPT:filter                    [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]
[root@wss bin]# setenforce 0
[root@wss bin]# 

8.测试tomcat是否安装成功
centos6.5 源码安装tomcat_第1张图片

你可能感兴趣的:(centos6.5 源码安装tomcat)