二、單機運行環境搭建之 --CentOS-6.5安裝配置Tomcat8

轉自(http://www.cnblogs.com/littlehb/archive/2013/04/02/2994683.htmlhtml

接上文。java

1、下載tomcatapache

cd /usr/local/src

wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.0.5/bin/apache-tomcat-8.0.5.zip
或者
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.0.5/bin/apache-tomcat-8.0.5.tar.gz

2、解壓安裝tomcattomcat

yum install unzip -y

unzip -d /usr/local apache-tomcat-8.0.5.zip
tar –zxvf apache-tomcat-8.0.5.tar.gz

cd /usr/local

mv apache-tomcat-8.0.5/ tomcat1

3、配置環境變量測試

vi /etc/profile

(1)在這個文件末尾加上code

export JAVA_HOME=/usr/java/jdk1.8.0
export JRE_HOME=/usr/java/jdk1.8.0/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:$JAVA_HOME/bin

(2)(暫未修改,不知這步用意)htm

cd /usr/local/tomcat1/binblog

vi catalina.ship

#!/bin/shv8

export TOMCAT_HOME=/usr/local/tomcat1

export CATALINA_HOME=/usr/local/tomcat1

(3)利用下面命令使文件有執行權限並使配置生效

# source /etc/profile

# cd /usr/local/tomcat1/bin

# chmod 777 *.*

4、配置tomcat

(1)將tomcat加入開機自啓動

echo "source /etc/profile" >>/etc/rc.d/rc.local


echo "/usr/local/tomcat1/bin/startup.sh" >>/etc/rc.d/rc.local



這裏有點要說明,rc.local先於/etc/profile執行,因此會得不到JAVA環境變量,因此在startup.sh前加入代碼:source /etc/profile 這樣就能夠

(2)關閉防火牆

chkconfig iptables off iptables
service iptables stop

5、測試

# cd /usr/local/tomcat1/bin
# ./startup.sh
相關文章
相關標籤/搜索