一、安装jdk

[root@tomcat ~]# yum -y list java* Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirror.bit.edu.cn * updates: mirrors.aliyun.com Available Packages java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.161-2.6.12.0.el6_9 updates java-1.7.0-openjdk-src.x86_64 1:1.7.0.161-2.6.12.0.el6_9 updates java-1.8.0-openjdk.x86_64 1:1.8.0.161-3.b14.el6_9 updates java-1.8.0-openjdk-debug.x86_64 1:1.8.0.161-3.b14.el6_9 updates [root@tomcat ~]# yum install java-1.8.0-openjdk.x86_64 -y [root@tomcat ~]# java -version openjdk version "1.8.0_161" OpenJDK Runtime Environment (build 1.8.0_161-b14) OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)

2)如果二进制解压包使用。配置环境变量

export JAVA_HOME=/opt/jdk1.8.0_211
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

source /etc/profile

二、安装Tomcat

[root@tomcat ~]# mkdir -p tools
[root@tomcat ~]# cd tools/
[root@tomcat tools]# ll
total 8780
-rw-r--r-- 1 root root 8989099 Feb 28 00:31 apache-tomcat-7.0.81.tar.gz
[root@tomcat tools]# tar xf apache-tomcat-7.0.81.tar.gz -C /usr/local/
[root@tomcat ~]# cd /usr/local/
[root@tomcat local]# mv apache-tomcat-7.0.81 tomcat

三、启动Tomcat

[root@tomcat local]# /usr/local/tomcat/bin/startup.sh configtest	# 检查配置文件是否正确
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@tomcat local]# /usr/local/tomcat/bin/startup.sh start			# 启动
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@tomcat ~]# netstat -lntup|grep java
tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      1612/java           
tcp        0      0 :::8009                     :::*                        LISTEN      1612/java           
tcp        0      0 :::8080                     :::*                        LISTEN      1612/java  

四、网页访问

[root@tomcat ~]# vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
[root@tomcat ~]# /etc/init.d/iptables restart

  

$scp -rp Python-3.6.2.tar.xz root@10.0.5.20:/root/tools/

五、tomcat优化参数
JAVA_OPTS="$JAVA_OPTS -Xms2g -Xmx2g -XX:PermSize=128m -XX:MaxPermSize=256m"

 

 

 

 

 

posted on 2018-08-03 11:11  可口_可乐  阅读(185)  评论(0编辑  收藏  举报