本文共 4278 字,大约阅读时间需要 14 分钟。
yum search java | grep -i --color JDK
ldapjdk-javadoc.noarch : Javadoc for ldapjdk icedtea-web.x86_64 : Additional Java components for OpenJDK - Java browser java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment java-1.7.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment java-1.7.0-openjdk-headless.x86_64 : The OpenJDK runtime environment without java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle java-1.8.0-openjdk.i686 : OpenJDK Runtime Environment java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment java-1.8.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector java-1.8.0-openjdk-accessibility-debug.x86_64 : OpenJDK accessibility connector java-1.8.0-openjdk-debug.i686 : OpenJDK Runtime Environment with full debug on java-1.8.0-openjdk-debug.x86_64 : OpenJDK Runtime Environment with full debug on java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos java-1.8.0-openjdk-demo-debug.x86_64 : OpenJDK Demos with full debug on java-1.8.0-openjdk-devel.i686 : OpenJDK Development Environment java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment java-1.8.0-openjdk-devel-debug.i686 : OpenJDK Development Environment with full java-1.8.0-openjdk-devel-debug.x86_64 : OpenJDK Development Environment with java-1.8.0-openjdk-headless.i686 : OpenJDK Runtime Environment java-1.8.0-openjdk-headless.x86_64 : OpenJDK Runtime Environment java-1.8.0-openjdk-headless-debug.i686 : OpenJDK Runtime Environment with full java-1.8.0-openjdk-headless-debug.x86_64 : OpenJDK Runtime Environment with full java-1.8.0-openjdk-javadoc.noarch : OpenJDK API Documentation java-1.8.0-openjdk-javadoc-debug.noarch : OpenJDK API Documentation for packages java-1.8.0-openjdk-javadoc-zip.noarch : OpenJDK API Documentation compressed in java-1.8.0-openjdk-javadoc-zip-debug.noarch : OpenJDK API Documentation java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle java-1.8.0-openjdk-src-debug.x86_64 : OpenJDK Source Bundle for packages with ldapjdk.noarch : The Mozilla LDAP Java SDK openprops.noarch : An improved java.util.Properties from OpenJDK
yum install java-1.7.0-openjdk-devel.x86_64
[root@localhost ~]# vi /etc/profile
#set java environment JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64(java的安装路径)JRE_HOME=$JAVA_HOME/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME CLASS_PATH PATH
java -versionecho $JAVA_HOMEecho $JRE_HOMEecho $CLASSPATHecho $PATH
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.tar.gz
/usr/local
目录下 tar -zxvf apache-tomcat-7.0.57.tar.gzmv apache-tomcat-7.0.69/ /usr/local/tomcat
在tomcat的bin目录下打开catalina.sh文件,vi /usr/local/tomcat/bin/catalina.sh
,添加以下信息:
JAVA_OPTS="-Xms512m -Xmx1024m -Xss1024K -XX:PermSize=512m -XX:MaxPermSize=1024m"export TOMCAT_HOME=/usr/local/tomcatexport CATALINA_HOME=/usr/local/tomcatexport JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el7_3.x86_64export JRE_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el7_3.x86_64/jre
启动/usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcatUsing CATALINA_HOME: /usr/local/tomcatUsing CATALINA_TMPDIR: /usr/local/tomcat/tempUsing JRE_HOME: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el7_3.x86_64/jreUsing CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jarTomcat started.
关闭/usr/local/tomcat/bin/shutdown.sh
在conf目录的server.xml中的,找到<host>节点,添加如下标签:
在conf/Catalina/localhost
目录下创建xml配置文件,文件容易如下:
此法有个优点,可以定义别名。服务器端运行的项目名称为path,外部访问的URL则使用XML的文件名。这个方法很方便的隐藏了项目的名称,对一些项目名称被固定不能更换,但外部访问时又想换个路径,非常有效。
转载地址:http://irrda.baihongyu.com/