01 Java 环境安装

注意,不要使用root用户来安装软件,会直接安装在root用户的目录下,其他用户无权限访问。

使用Jenv环境安装工具来搭建Java运行环境,以下是各个命令使用指南。

创建目录结构

mkdir -p /usr/local

安装zip | unzip

yum install zip unzip  

01-1 安装Jenv

curl -L -s get.jenv.io | bash

Thanks for using                                                     
                                                                 
    ___   _______  _____  ___  ___      ___                      
   |"  | /"     "|(\"   \|"  \|"  \    /"  |                     
   ||  |(: ______)|.\\   \    |\   \  //  /                      
   |:  | \/    |  |: \.   \\  | \\  \/. ./                       
___|  /  // ___)_ |.  \    \. |  \.    //                        
   /  :|_/ )(:      "||    \    \ |   \\   /                         
  (_______/  \_______) \___|\____\)    \__/                          
                                                                 
                                   Will now attempt installing...
                                                                 
Looking for a previous installation of JENV...
Looking for unzip...
Looking for curl...
Installing jenv scripts...
Download script archive...
Extract script archive...
Download Central repository...
Attempt update of bash profiles...
Updated existing /home/jenv/.bash_profile
Updated existing /home/jenv/.bashrc
Attempt create zsh profiles...

All done!


Please open a new terminal, or run the following in the existing one:

source /home/jenv/.jenv/bin/jenv-init.sh 

Then issue the following command:

jenv help

Enjoy!!!

01-1.1 执行source命令,初始化jenv

[jenv@localhost ~]$ source /home/jenv/.jenv/bin/jenv-init.sh

01-1.2 更新jenv

[fengwuze@localhost local]$ jenv selfupdate

Updating jenv...
Purge existing scripts...
Download new scripts to: /home/fengwuze/.jenv/tmp/jenv-0.1.0.zip
Extract script archive...

jenv upgraded successfully!
Updating all repositories
Begin to update central
central updated!
Repositories upgraded!

01-1.3 查看某个软件的版本

[fengwuze@localhost local]$ jenv list java
Available java Versions
=========================
   1.8.0_77
   1.8.0_71
   1.8.0_60
   1.8.0_51
   1.8.0_45

01-1.4 更新jenv仓库

[fengwuze@localhost local]$ jenv repo update
Updating all repositories
Begin to update central
central updated!
Repositories upgraded!

01-1.5 缺省指定软件版本

jenv default java 1.8.0_71

01-2 安装jdk

[root@localhost ~]$ mkdir -p /user/local/jdk1.6.45

[fengwuze@localhost ~]$ jenv install java 1.6.0_45

Downloading: java 1.6.0_45

Downloading http://get.jenv.mvnsearch.org/download/java/java-1.6.0_45-x64.zip
% Total    %     Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
100 84.8M  100 84.8M    0     0   528k      0  0:02:44  0:02:44 --:--:--  604k

Do you want java 1.6.0_45 to be set as default? (Y/n): Y
Setting java 1.6.0_45 as default.
Done installing!

01-2.1 检查jdk的版本

[fengwuze@localhost ~]$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

02-1.1 安装tomcat

[fengwuze@localhost ~]$ jenv install tomcat 7.0.68
Installing: tomcat 7.0.68
Parsing http://jenv.mvnsearch.org/candidate/tomcat/download/7.0.68/Linux/x86_64

Found a previously downloaded tomcat 7.0.68 archive. Not downloading it again...

Do you want tomcat 7.0.68 to be set as default? (Y/n): y
Setting tomcat 7.0.68 as default.
Done installing!
[fengwuze@localhost ~]$

02-1.2 创建多个tomcat目录

mkdir -p /user/local/{tomcat_1,tomcat_2,tomcat_3,tomcat_4}

02-1.3 复制多份tomcat

cp -r /home/fengwuze/.jenv/candidates/tomcat/7.0.68/*.* /user/local/tomcat_1
cp -r /home/fengwuze/.jenv/candidates/tomcat/7.0.68/*.* /user/local/tomcat_2
cp -r /home/fengwuze/.jenv/candidates/tomcat/7.0.68/*.* /user/local/tomcat_3
cp -r /home/fengwuze/.jenv/candidates/tomcat/7.0.68/*.* /user/local/tomcat_4

QA##

安装zip、unzip###

yum install zip unzip  

Tomcat启动慢的问题解决方案

https://blog.csdn.net/youngage/article/details/43020711
修改$CATALINA_BASE/conf/catalina.properties文件,添加org.apache.el.parser.SKIP_IDENTIFIER_CHECK=true选项。

你可能感兴趣的:(01 Java 环境安装)