如何使用yum命令安装 tomcat ?


1, 查看能够安装的java相关软件列表

指令 : [root@VM_49_106_centos bin]# yum -y list java*

执行结果 :

root@VM_49_106_centos bin]# yum -y list java*
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Installed Packages
java-1.5.0-gcj.x86_64                                                                      1.5.0.0-29.1.el6                                                             @os     
java-1.7.0-openjdk.x86_64                                                                  1:1.7.0.141-2.6.10.1.el6_9                                                   @updates
java-1.7.0-openjdk-demo.x86_64                                                             1:1.7.0.141-2.6.10.1.el6_9                                                   @updates
java-1.7.0-openjdk-devel.x86_64                                                            1:1.7.0.141-2.6.10.1.el6_9                                                   @updates
java-1.7.0-openjdk-javadoc.noarch                                                          1:1.7.0.141-2.6.10.1.el6_9                                                   @updates
java-1.7.0-openjdk-src.x86_64                                                              1:1.7.0.141-2.6.10.1.el6_9                                                   @updates
java_cup.x86_64                                                                            1:0.10k-5.el6                                                                @os     
Available Packages
java-1.5.0-gcj-devel.x86_64                                                                1.5.0.0-29.1.el6                                                             os      
java-1.5.0-gcj-javadoc.x86_64                                                              1.5.0.0-29.1.el6                                                             os      
java-1.5.0-gcj-src.x86_64                                                                  1.5.0.0-29.1.el6                                                             os      
java-1.6.0-openjdk.x86_64                                                                  1:1.6.0.41-1.13.13.1.el6_8                                                   os      
java-1.6.0-openjdk-demo.x86_64                                                             1:1.6.0.41-1.13.13.1.el6_8                                                   os      
java-1.6.0-openjdk-devel.x86_64                                                            1:1.6.0.41-1.13.13.1.el6_8                                                   os      
java-1.6.0-openjdk-javadoc.x86_64                                                          1:1.6.0.41-1.13.13.1.el6_8                                                   os      
java-1.6.0-openjdk-src.x86_64                                                              1:1.6.0.41-1.13.13.1.el6_8                                                   os      
java-1.8.0-openjdk.x86_64                                                                  1:1.8.0.131-0.b11.el6_9                                                      updates 
java-1.8.0-openjdk-debug.x86_64                                                            1:1.8.0.131-0.b11.el6_9                                                      updates 
java-1.8.0-openjdk-demo.x86_64                                                             1:1.8.0.131-0.b11.el6_9                                                      updates 
java-1.8.0-openjdk-demo-debug.x86_64                                                       1:1.8.0.131-0.b11.el6_9                                                      updates 
java-1.8.0-openjdk-devel.x86_64                                                            1:1.8.0.131-0.b11.el6_9                                                      updates 
java-1.8.0-openjdk-devel-debug.x86_64                                                      1:1.8.0.131-0.b11.el6_9                                                      updates 
java-1.8.0-openjdk-headless.x86_64                                                         1:1.8.0.131-0.b11.el6_9                                                      updates 
java-1.8.0-openjdk-headless-debug.x86_64                                                   1:1.8.0.131-0.b11.el6_9                                                      updates 
java-1.8.0-openjdk-javadoc.noarch                                                          1:1.8.0.131-0.b11.el6_9                                                      updates 
java-1.8.0-openjdk-javadoc-debug.noarch                                                    1:1.8.0.131-0.b11.el6_9                                                      updates 
java-1.8.0-openjdk-src.x86_64                                                              1:1.8.0.131-0.b11.el6_9                                                      updates 
java-1.8.0-openjdk-src-debug.x86_64  


2.使用root用户安装
安装时提醒必须使用root用户,sudo都不行。

[root@VM_49_106_centos bin]# yum -y install java-1.7.0-openjdk*

  Installing : tzdata-java-2017b-1.el6.noarch                                                                                                                             27/42 
  Installing : sgml-common-0.6.3-33.el6.noarch                                                                                                                            28/42 
  Installing : GConf2-2.28.0-7.el6.x86_64                                                                                                                                 29/42 
  Installing : 1:java-1.7.0-openjdk-devel-1.7.0.141-2.6.10.1.el6_9.x86_64                                                                                                 30/42 
  Installing : 1:java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el6_9.x86_64                                                                                                       31/42 
  Installing : 1:java-1.7.0-openjdk-src-1.7.0.141-2.6.10.1.el6_9.x86_64                                                                                                   32/42 
  Installing : 1:java-1.7.0-openjdk-demo-1.7.0.141-2.6.10.1.el6_9.x86_64                                                                                                  33/42 
  Installing : 1:java-1.7.0-openjdk-javadoc-1.7.0.141-2.6.10.1.el6_9.noarch                                                                                               34/42 
  Updating   : nss-softokn-freebl-3.14.3-23.3.el6_8.i686                                                                                                                  35/42 
  Cleanup    : nss-softokn-freebl-3.12.9-11.el6                                                                                                                           36/42 
  Cleanup    : nss-3.12.10-16.el6.x86_64                                                                                                                                  37/42 
  Cleanup    : nss-sysinit-3.12.10-16.el6.x86_64                                                                                                                          38/42 
  Cleanup    : nss-softokn-3.12.9-11.el6.x86_64                                                                                                                           39/42 
  Cleanup    : nss-util-3.12.10-2.el6.x86_64                                                                                                                              40/42 
  Cleanup    : nspr-4.8.8-3.el6.x86_64                                                                                                                                    41/42 
  Cleanup    : nss-softokn-freebl-3.12.9-11.el6                                                                                                                           42/42 

Installed:
  java-1.7.0-openjdk.x86_64 1:1.7.0.141-2.6.10.1.el6_9                                  java-1.7.0-openjdk-demo.x86_64 1:1.7.0.141-2.6.10.1.el6_9                              
  java-1.7.0-openjdk-devel.x86_64 1:1.7.0.141-2.6.10.1.el6_9                            java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.141-2.6.10.1.el6_9                           
  java-1.7.0-openjdk-src.x86_64 1:1.7.0.141-2.6.10.1.el6_9                             

Dependency Installed:
  ConsoleKit.x86_64 0:0.4.1-6.el6        ConsoleKit-libs.x86_64 0:0.4.1-6.el6          GConf2.x86_64 0:2.28.0-7.el6                   ORBit2.x86_64 0:2.14.17-6.el6_8           
  eggdbus.x86_64 0:0.6-3.el6             flac.x86_64 0:1.2.1-7.el6_6                   giflib.x86_64 0:4.1.6-3.1.el6                  libIDL.x86_64 0:0.8.13-2.1.el6            
  libXfont.x86_64 0:1.5.1-2.el6          libasyncns.x86_64 0:0.8-1.1.el6               libfontenc.x86_64 0:1.1.2-3.el6                libogg.x86_64 2:1.1.4-2.1.el6             
  libsndfile.x86_64 0:1.0.20-5.el6       libvorbis.x86_64 1:1.2.3-4.el6_2.1            lksctp-tools.x86_64 0:1.0.10-7.el6             pcsc-lite-libs.x86_64 0:1.5.2-16.el6      
  polkit.x86_64 0:0.96-11.el6            pulseaudio-libs.x86_64 0:0.9.21-26.el6        sgml-common.noarch 0:0.6.3-33.el6              ttmkfdir.x86_64 0:3.0.9-32.1.el6          
  tzdata-java.noarch 0:2017b-1.el6       xorg-x11-font-utils.x86_64 1:7.2-11.el6       xorg-x11-fonts-Type1.noarch 0:7.2-11.el6      

Dependency Updated:
  nspr.x86_64 0:4.13.1-1.el6                      nss.x86_64 0:3.28.4-3.el6_9           nss-softokn.x86_64 0:3.14.3-23.3.el6_8   nss-softokn-freebl.i686 0:3.14.3-23.3.el6_8  
  nss-softokn-freebl.x86_64 0:3.14.3-23.3.el6_8   nss-sysinit.x86_64 0:3.28.4-3.el6_9   nss-util.x86_64 0:3.28.4-1.el6_9        

Complete!

3,  确认是否安装成功

[root@VM_49_106_centos bin]# java
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (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
                  The default VM is server.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

执行 javac

[root@VM_49_106_centos bin]# javac
Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is doing
  -deprecation               Output source locations where deprecated APIs are used
  -classpath <path>          Specify where to find user class files and annotation processors
  -cp <path>                 Specify where to find user class files and annotation processors
  -sourcepath <path>         Specify where to find input source files
  -bootclasspath <path>      Override location of bootstrap class files
  -extdirs <dirs>            Override location of installed extensions
  -endorseddirs <dirs>       Override location of endorsed standards path
  -proc:{none,only}          Control whether annotation processing and/or compilation is done.
  -processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process
  -processorpath <path>      Specify where to find annotation processors
  -d <directory>             Specify where to place generated class files
  -s <directory>             Specify where to place generated source files
  -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files
  -encoding <encoding>       Specify character encoding used by source files
  -source <release>          Provide source compatibility with specified release
  -target <release>          Generate class files for specific VM version
  -version                   Version information
  -help                      Print a synopsis of standard options
  -Akey[=value]              Options to pass to annotation processors
  -X                         Print a synopsis of nonstandard options
  -J<flag>                   Pass <flag> directly to the runtime system
  -Werror                    Terminate compilation if warnings occur

执行 java -version

[root@VM_49_106_centos bin]# java -version
java version "1.7.0_141"
OpenJDK Runtime Environment (rhel-2.6.10.1.el6_9-x86_64 u141-b02)
OpenJDK 64-Bit Server VM (build 24.141-b02, mixed mode)

安装成功

转自 : http://blog.chinaunix.net/uid-15463753-id-4252690.html



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值