爱博体育app手机版Java环境(JDK)+Tomcat 安装。Linux Tomcat 安装。

tomcat

一、 jdk的安装
    安装的jdk为:jdk-6u26-linux-x64-rpm.bin(linux下64位的)

玩汤姆猫(Tomcat)你得首先发出java编译运行条件。
吓于吃猫一个温暖的小窝。
好了,转正题。

 wget
http://download.[Oracle](http://www.linuxidc.com/topicnews.aspx?tid=12).com/otn-pub/java/jdk/6u26-b03/jdk-6u26-linux-x64-rpm.bin

最新的jdk下载地址

  wget
http://apache.etoak.com/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.tar.gz

  1. rpm结尾的jdk安装方式:
    <pre>rpm -ivh jdk-8u73-linux-x64.rpm</pre>

  2. tar.gz结尾的jdk安装方式:
    <pre>mkdir /usr/local/java
    tar xzvf jdk-8u73-linux-x64.tar.gz -C /usr/local/java</pre>

  3. 在/etc/profile尾部增(很要紧)
    <pre>export JAVA_HOME=/usr/local/java/jdk1.8.0_45
    export JRE_HOME=$JAVA_HOME/jre
    export PATH=$JAVA_HOME/bin:$PATH
    export
    CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar</pre>

  4. 使/etc/profile使配置文件就生效
    <pre>source /etc/profile</pre>

  5. 测试是否中标
    <pre>java -version</pre>
    <h6>bingo,小猫有地方停下了!得管猫带回家了。

      1. 用文件上传至linux
      2. 以当前目录输入
          sh jdk-6u26-linux-x64-rpm.bin
      3.以指令执行输入:
          vi /etc/profile
          在里头长如下内容
          export JAVA_HOME=/usr/java/jdk1.6.0_26
          export JAVA_BIN=/usr/java/jdk1.6.0_26/bin
          export PATH=$PATH:$JAVA_HOME/bin
          export
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
          export JAVA_HOME JAVA_BIN PATH CLASSPATH      
      4. 于命令执行输入
          java -version
          屏幕输出:
              java version “jdk1.6.0_17”
              Java(TM) 2 Runtime Environment, Standard Edition (build j
dk1.6.0_17)
              Java HotSpot(TM) Client VM (build jdk1.6.0_17, mixed
mode)
   安装JDK1.6完毕.
 
 
 
二、 Tomcat的安装
   安装的tomcat为:apache-tomcat-6.0.18.tar.gz
      1. #tar zxvf apach-tomcat-6.0.18.tar.gz
         #mv apach-tomcat-6.0.18/usr/local(移动tomcat的目录)
      2. 拓展tomcat环境的布(前提需要装jdk)
         #vi /etc/profile

<h4>Tomcat安装
<h6>1. 下载Tomcat源码包
<h6>2. 解压到/usr/local/tomcat
<pre>mkdir /usr/local/tomcat
tar zxf apache-tomcat-7.0.68.tar.gz -C /usr/local/tomcat</pre>

         export
JAVA_HOME=/usr/local/jdk1.6.0_17(jdk如果已配备了的口舌,这里就甭写了)
         export TOMCAT_HOME=/usr/local/apach-tomcat-6.0.18
  
         保存退出
     
          # source /etc/profile  //让当前安排立即生效
      3.启动tomcat服务器
          $ /usr/local/apach-tomcat-6.0.18/bin/startup.sh
          电脑上会起如下内容:
          Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.18
          Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.18
          Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.18/temp
          Using JRE_HOME:       /usr/local/jdk1.6.0_17
          在浏览器被输入http://localhost:8080/就可以看到tomcat的log了
   tomcat的安至这结束

<h6>3. 启动tomcat
<pre>sh -x /usr/local/tomcat/bin/startup.sh</pre>

<HTML>

<h6>4. 关闭tomcat
<pre>sh -x /usr/local/tomcat/bin/shutdown.sh</pre>

<HEAD>

<h6>5. 本地验证
<pre>curl 127.0.0.1:8080 #tomcat默认监听在8080端口
要以浏览器地址栏输入<code>127.0.0.1:8080</code>这时tomcat默认主页就下了</pre>

<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″
/>

<h4>一键装置JDK+Tomcat脚本
<pre>#!/bin/bash
read -p “start or stop: ” excute
case $excute in
start)

<TITLE>JSP测试页面—HelloWorld!</TITLE>

mkdir /usr/local/java
tar zxf jdk-8u73-linux-x64.tar.gz -C /usr/local/java

</HEAD>

echo “export JAVA_HOME=/usr/local/java/jdk1.8.0_45” >>
/etc/profile
echo “export JRE_HOME=$JAVA_HOME/jre” >> /etc/profile
echo “export PATH=$JAVA_HOME/bin:$PATH” >> /etc/profile
echo “export
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar” >>
/etc/profile
source /etc/profile

<BODY>

echo “jdk has been installed success”

<%

mkdir /usr/local/tomcat
tar zxf apache-tomcat-7.0.68.tar.gz -C /usr/local/tomcat
cp /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat
chmod 755 /etc/init.d/tomcat
sed -i ‘1a\JAVA_HOME=/usr/local/java/jdk1.8.0_45’
/etc/init.d/tomcat
sed -i ‘1a\CATALINA_HOME=/usr/local/tomcat’ /etc/init.d/tomcat
;;

out.println(“<h1>Hello World!<br>世界,你好!</h1>”);

stop)
/etc/init.d/tomcat $excute
;;
esac
</pre>

%>

结束啦!

</BODY>

</HTML>

爱博体育app手机版 1

相关文章