23decxf 发表于 2018-11-22 11:52:17

centos6.5_x64 安装配置java+tomcat+apache

  

  

  1.下载:
  # wget http://download.oracle.com/otn-pub/java/jdk/6u31-b04/jdk-6u31-linux-x64-rpm.bin
  2.赋权限:
  # ls -l jdk-6u31-linux-x64-rpm.bin
  -rw-r--r-- 1 root root 81071431 Jun 26 14:00 jdk-6u31-linux-x64-rpm.bin
  # chmod +x jdk-6u31-linux-x64-rpm.bin
  

  3.安装:
  #./jdk-6u31-linux-x64-rpm.bin
  

  

  # ./jdk-6u31-linux-x64-rpm.bin
  Unpacking...
  Checksumming...
  Extracting...
  UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: jdk-6u31-linux-amd64.rpm
  inflating: sun-javadb-common-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-core-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-client-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm
  Preparing...                ###########################################
  1:jdk                  ###########################################
  Unpacking JAR files...
  rt.jar...
  jsse.jar...
  charsets.jar...
  tools.jar...
  localedata.jar...
  plugin.jar...
  javaws.jar...
  deploy.jar...
  Installing JavaDB
  Preparing...                ###########################################
  1:sun-javadb-common      ########################################### [ 17%]
  2:sun-javadb-core      ########################################### [ 33%]
  3:sun-javadb-client      ########################################### [ 50%]
  4:sun-javadb-demo      ########################################### [ 67%]
  5:sun-javadb-docs      ########################################### [ 83%]
  6:sun-javadb-javadoc   ###########################################
  

  Java(TM) SE Development Kit 6 successfully installed.
  

  Product Registration is FREE and includes many benefits:
  * Notification of new versions, patches, and updates
  * Special offers on Oracle products, services and training
  * Access to early releases and documentation
  

  Product and system data will be collected. If your configuration
  supports a browser, the JDK Product Registration form will
  be presented. If you do not register, none of this information
  will be saved. You may also register your JDK later by
  opening the register.html file (located in the JDK installation
  directory) in a browser.
  

  For more information on what data Registration collects and
  how it is managed and used, see:
  http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html
  

  Press Enter to continue.....
  

  Done.
  

  3.查看文件指向
  # ls -l
  total 4
  lrwxrwxrwx 1 root root   16 Jun 26 14:02 default -> /usr/java/latest
  drwxr-xr-x 9 root root 4096 Jun 26 14:02 jdk1.6.0_31
  lrwxrwxrwx 1 root root   21 Jun 26 14:02 latest -> /usr/java/jdk1.6.0_31
  

  

  4.设置java环境:/etc/profile.d/在最后添加如下内容,然后上传
  root@rrcy tomcat]# vim /etc/profile.d/java.sh
  export JAVA_HOME=/usr/java/jdk1.6.0_31
  export PATH=$PATH:$JAVA_HOME/bin
  

  5.执行环境变量:
  # . /etc/profile.d/java.sh
  

  6.查看版本:
  # java -version
  java version "1.5.0"
  gij (GNU libgcj) version 4.4.7 20120313 (Red Hat 4.4.7-4)
  

  Copyright (C) 2007 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  

  7.是否成功安装JDK验证:
  # java
  Usage: java [-options] class
  (to execute a class)
  orjava [-options] -jar jarfile
  (to execute a jar file)
  where options include:
  -d32          use a 32-bit data model if available
  -d64          use a 64-bit data model if available
  -server       to select the "server" VM
  

  
  二、安装配置tomcat+apache
  
  1.下载安装包
  apache-tomcat-7.0.54.tar.gz
  2.解压安装包
  tar -xf apache-tomcat-7.0.54.tar.gz -C /usr/local
  3.创建tomcat连接
  cd /usr/local
  ln -sv apache-tomcat-7.0.54 tomcat
  4.查看连接是否成功
  # ll
  lrwxrwxrwx   1 root root      20 Jun 26 12:56 tomcat -> apache-tomcat-7.0.54
  

  5.创建tomcat环境变量文件
  # vim /etc/profile.d/tomcat.sh
  export CATALINA_HOME=/usr/local/tomcat
  export PATH=$PATH:$CATALINA_HOME/bin
  

  6.运行环境变量
  

  # . /etc/profile.d/tomcat.sh
  

  # catalina.sh version
  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
  Server version: Apache Tomcat/7.0.54
  Server built:   May 19 2014 10:26:15
  Server number:7.0.54.0
  OS Name:      Linux
  OS Version:   2.6.32-431.17.1.el6.x86_64
  Architecture:   x86_64
  JVM Version:    1.5.0
  JVM Vendor:   Free Software Foundation, Inc.
  #
  

  7.开起tomcat服务
  # catalina.sh start
  

  8.查看8080 8009 端口
  # netstat -tnlp
  Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
  tcp      0      0 192.168.1.208:53            0.0.0.0:*                   LISTEN      10603/named
  tcp      0      0 127.0.0.1:53                0.0.0.0:*                   LISTEN      10603/named
  tcp      0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      897/sshd
  tcp      0      0 127.0.0.1:953               0.0.0.0:*                   LISTEN      10603/named
  tcp      0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1182/master
  tcp      0      0 127.0.0.1:6010            0.0.0.0:*                   LISTEN      11219/sshd
  tcp      0      0 127.0.0.1:6011            0.0.0.0:*                   LISTEN      11656/sshd
  tcp      0      0 127.0.0.1:9000            0.0.0.0:*                   LISTEN      1193/php-fpm
  tcp      0      0 127.0.0.1:3306            0.0.0.0:*                   LISTEN      1090/mysqld
  tcp      0      0 :::8080                     :::*                        LISTEN      12338/java
  tcp      0      0 :::80                     :::*                        LISTEN      2753/httpd
  tcp      0      0 :::22                     :::*                        LISTEN      897/sshd
  tcp      0      0 ::1:25                      :::*                        LISTEN      1182/master
  tcp      0      0 ::1:6010                  :::*                        LISTEN      11219/sshd
  tcp      0      0 ::1:6011                  :::*                        LISTEN      11656/sshd
  tcp      0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      12087/java
  tcp      0      0 :::8009                     :::*                        LISTEN      12338/java
  

  9.创建启动服务
  

  # vim /etc/init.d/tomcat
  JAVA_HOME=/usr/java/latest
  CATALINA_HOME=/usr/local/tomcat
  export JAVA_HOME CATALINA_HOME
  exec $CATALINA_HOME/bin/catalina.sh $*
  

  # chmod +x /etc/init.d/tomcat
  

  # service tomcat start
  Using CATALINA_BASE:   /usr/local/tomcat
  Using CATALINA_HOME:   /usr/local/tomcat
  Using CATALINA_TMPDIR: /usr/local/tomcat/temp
  Using JRE_HOME:      /usr/java/latest
  Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
  Tomcat started.
  

  11. IE访问http://ip:8080
  




页: [1]
查看完整版本: centos6.5_x64 安装配置java+tomcat+apache