2.安装JDK1.7
从Oracle网站下载jdk-7u80-linux-x64.tar.gz,拷贝到centos上,并在centos上安装tar xzf jdk-7u80-linux-x64.tar.gz
mv jdk1.7.0_80 /usr/lib/jvm/
配置环境
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_80/bin/java 300 update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_80/bin/javac 300
vi ~/.bash_profile
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_803.安装Tomcat并配置自动启动
tar xzf apache-tomcat-7.0.63.tar.gz mv apache-tomcat-7.0.63 /usr/local/tomcat7 useradd -d /usr/share/tomcat7 tomcat7 chown -R tomcat7:tomcat7 /usr/local/tomcat7 cd /usr/local/tomcat7/bin/ tar xzf commons-daemon-native.tar.gz cd commons-daemon-1.0.15-native-src/unix/ yum -y install gcc-c++ ./configure --with-java=/usr/lib/jvm/jdk1.7.0_80 make cp jsvc ../.. cd ../.. ln -s /usr/local/tomcat7/bin/daemon.sh /etc/init.d/tomcat7
vim daemon.sh
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_80 CATALINA_HOME=/usr/local/tomcat7 TOMCAT_USER=tomcat7
start)分支下,CATALINA_OPTS后面添加$JPDA_OPTS,类似 "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS $JPDA_OPTS\ #JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
ARG0="$CATALINA_HOME"
chkconfig tomcat7 on
chkconfig --list tomcat7
设置JVM参数:
cd /usr/local/tomcat7/bin
vim setenv.sh
#!/bin/sh JAVA_OPTS="$JAVA_OPTS -Xms6g -Xmx6g -Xmn2g -Xss1024K -XX:PermSize=256M -XX:MaxPermSize=1g -Djava.awt.headless=true -XX:UseG1GC"chmod +x setenv.sh
重启tomcat7即可生效
service tomcat7 stop
service tomcat7 start