注册 登录
  • 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

Linux/centos的VPS用YUM安装Java和JDK环境yum安装jdk

Linux 开心洋葱 1284次浏览 已收录 0个评论 手机上查看

有些客户需要在VPS安装java/jdk6,但是一个一个下载和编译安装十分话时间,那么,Linux/centos如何YUM安装Java和JDK环境?

首先,我们来看看yum库是否有java安装包

[root@233797 www.awzsr.com]yum -y list java*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.grikare.com
 * extras: centos.mirror.facebook.net
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirror.grikare.com
Excluding Packages in global exclude list
Finished
Available Packages
java-1.4.2-gcj-compat.i386                                                              1.4.2.0-40jpp.115                                                                base  
java-1.4.2-gcj-compat-devel.i386                                                        1.4.2.0-40jpp.115                                                                base  
java-1.4.2-gcj-compat-javadoc.i386                                                      1.4.2.0-40jpp.115                                                                base  
java-1.4.2-gcj-compat-src.i386                                                          1.4.2.0-40jpp.115                                                                base  
java-1.6.0-openjdk.i386                                                                 1:1.6.0.0-1.23.1.9.10.el5_7                                                      updates
java-1.6.0-openjdk-demo.i386                                                            1:1.6.0.0-1.23.1.9.10.el5_7                                                      updates#p#分页标题#e#
java-1.6.0-openjdk-devel.i386                                                           1:1.6.0.0-1.23.1.9.10.el5_7                                                      updates
java-1.6.0-openjdk-javadoc.i386                                                         1:1.6.0.0-1.23.1.9.10.el5_7                                                      updates
java-1.6.0-openjdk-src.i386                                                             1:1.6.0.0-1.23.1.9.10.el5_7                                                      updates
java_cup.i386                                                                           1:0.10-0.k.6jpp.1                                                                base  
java_cup-javadoc.i386                                                                   1:0.10-0.k.6jpp.1                                                                base  
java_cup-manual.i386                                                                    1:0.10-0.k.6jpp.1                                                                base  
javacc.i386                                                                             4.0-3jpp.3                                                                       base  #p#分页标题#e#
javacc-demo.i386                                                                        4.0-3jpp.3                                                                       base  
javacc-manual.i386                                                                      4.0-3jpp.3    

 

然后我们安装java1.6.x,怎样使用yum安装java? 怎么用yum安装jdk?

[root@233797 www.awzsr.com]yum -y install  java-1.6.0-openjdk*

 

查看yum安装java的结果,安装完成后,执行java -version

[root@233797 www.awzsr.com]java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.10) (rhel-1.23.1.9.10.el5_7-i386)
OpenJDK Client VM (build 19.0-b09, mixed mode)

 

 执行java的时候,遇到错误:

Could not reserve enough space for object heap

Could not create the Java virtual machine.

解决办法:

在ssh下用root执行

export _JAVA_OPTIONS="-Xms32m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled"

 还有错误的话,请参考
http://forums.vpslink.com/linux/1327-java-could-not-reserve-enough-space-object-heap.html

http://forum.openvz.org/index.php?t=msg&goto=7061


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明Linux/centos的VPS用YUM安装Java和JDK环境yum安装jdk
喜欢 (0)
[开心洋葱]
分享 (0)
关于作者:
开心洋葱,开心洋葱头,水墨

您必须 登录 才能发表评论!

……
加载中……