1. 下载JDK7和tomcat7
wget http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1482501616_32a66eb55e0068a48b6d490ae541b3b9
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.73/bin/apache-tomcat-7.0.73.tar.gz
2. 解压JDK7,移动到指定目录
tar -zxvf jdk-7u80-linux-x64.tar.gz
mv jdk1.7.0_80 /usr/local/jdk1.7.0_80
3. 配置环境变量
vi /etc/profile
export JAVA_HOME=/usr/local/jdk1.7.0_80
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
#更新环境变量
source /etc/profile
4. 解压tomcat7,移至指定目录
tar -zxvf apache-tomcat-7.0.73.tar.gz
mv apache-tomcat-7.0.73 /usr/local/apache-tomcat-7.0.73
5. 启动tomcat7
/usr/local/apache-tomcat-7.0.73/bin/catalina.sh start
6. tomcat7启动慢
1. 解决方案一(推荐)
vim $JAVA_HOME/jre/lib/security/java.security
securerandom.source=file:/dev/random
改为
securerandom.source=file:/dev/urandom
2. 解决方案二
vim $TOMCAT_HOME/bin/catalina.sh
if [[ "$JAVA_OPTS" != *-Djava.security.egd=* ]]; then
JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/urandom"
fi
3. 解决方案三
yum install rng-tools # 安装rngd服务(熵服务,增大熵池)
systemctl start rngd # 启动服务
7. 多个java进程启动时方面查看的命令
pwdx `pgrep java`