linux 安装tomcat jdk

 1 linux 安装tomcat jdk
 2
 3 ###挂载本地光盘
 4 umount /mnt
 5
 6 cd /etc/yum.repos.d/
 7
 8 mkdir test -p
 9
10 \mv *.repo test
11
12 echo '[local]
13
14 name=local
15
16 baseurl=file:///mnt
17
18 gpgcheck=0' >local.repo
19
20 mount /dev/cdrom /mnt
21
22 yum makecache
23
24
25
26 #准备工作
27 将 jdk-7u45-linux-x64.tar.gz apache-tomcat-7.0.72.tar.gz 这2个文件放在
28 /server/tools 文件夹下
29
30 #安装jdk
31 #创建目录
32 mkdir -p /usr/local/java
33 cp /server/tools/jdk-7u45-linux-x64.tar.gz /usr/local/java
34 cd /usr/local/java
35 tar xvf jdk-7u45-linux-x64.tar.gz
36 cd
37 #进行环境变量的修改
38 vim .bash_profile  &vi /etc/profile
39 export JAVA_HOME=/usr/local/java/jdk1.7.0_45
40 export JRE_HOME=/usr/local/java/jdk1.7.0_45/jre
41 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
42 export PATH=$JAVA_HOME/bin:$PATH
43 其他版本jdk
44 ====================
45 jdk1.8.0_221
46 export JAVA_HOME=/usr/local/java/jdk1.8.0_221
47 export JRE_HOME=/usr/local/java/jdk1.8.0_221/jre
48 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
49 export PATH=$JAVA_HOME/bin:$PATH
50 #令环境变量生效
51 source /etc/profile
52 #测试java
53 java -version
54
55 成功则显示如下
56
57 java version "1.7.0_45"
58 Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
59 Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
60
61 #安装tomcat
62 cd /server/tools/
63 tar xvf apache-tomcat-7.0.88.tar.gz
64 mv apache-tomcat-7.0.88 /usr/local/tomcat7
65 cd /usr/local/tomcat7/bin
66
67 ./startup.sh#开启Tomcat
68
69
70 测试:访问http://ip:8080   http://10.0.0.201:8080
71
72 #关闭Tomcat
73 /usr/local/tomcat7/bin/shutdown.sh  //停止tomcat
74
75 /usr/local/tomcat7/bin/startup.sh
02-13 08:05