Go Back   TechArena Community > Software > Tips & Tweaks
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to Install Java on CentOS

Tips & Tweaks


Reply
 
Thread Tools Search this Thread
  #1  
Old 23-04-2012
Member
 
Join Date: May 2011
Posts: 446
How to Install Java on CentOS
  

By default, CentOS 5 include version 1.4.2 and 1.6.0 of OpenJDK , is the free version of the Java development platform, which now belongs to Oracle, distributed under the terms of the license GNU/GPLv2. However, some developments, particularly commercial applications for Apache Tomcat, may require using a different version of Java. This document explains how to install JDK 1.6.0, Java implementation of Oracle business and deprivation in CentOS 5.

Installing the necessary software equipment.

Installation through yum.
If you use CentOS 5, you need to do the following to install or update the necessary packages:
Code:
yum -y install rpm-build gcc gcc-c++ redhat-rpm-config automake autoconf 
yum -y install xorg-x11-font-utils chkfontpath ttmkfdir
Procedures.

Creating user to use rpmbuild.
Is inconvenient and poses a high irrigation use rpmbuild as root. Therefore it is recommended to create a user account devoted exclusively to use the rpmbuild command.
Code:
  su - root
 useradd rpmbuilduser
 passwd rpmbuilduser
Creating directory structure for rpmbuild.
In order to work comfortably, you will create a suite of user directories that will be used to create RPM package.
Code:
su - rpmbuilduser
 mkdir-p ~ / rpmbuild / {SOURCES, SRPMS, SPECS, RPMS, TMP, BUILD}
Using vi or other editor detexto, configure your ~ /. Rpmmacros with the following contents:
Code:
% _topdir / Home / rpmbuilduser / rpmbuild
 % _tmppath% {_topdir} / TMP
 % _unpackaged_files_terminate_build 0
 % Packager My Name 
 % Distribution My distribution or workspace.
 % My company vendor.
Download the java-1.6.0-sun-1.6.0.14-1jpp.nosrc.rpm or a later version
Then you must download the Oracle JDK.

If you are using a x86 architecture, you must make the downloaded file executable using the following command:
Code:
  chmod + x jdk-6u14-linux-i586.bin
And the latter move into ~ / rpmbuild / SOURCES /
Code:
 mv jdk-6u14-linux-i586.bin ~ / rpmbuild / SOURCES /
Yes using a x86_64 architecture, you must download the file executable using the following command:
Code:
 chmod + x jdk-6u14-linux-x64.bin
And the latter move into ~ / rpmbuild / SOURCES /
Code:
mv jdk-6u14-linux-x64.bin ~ / rpmbuild / SOURCES /
Rebuild the package java-1.6.0-sun-1.6.0.14-paquetges 1jpp.nosrc.rpm to generate the Java 1.6.
Code:
rpmbuild - rebuild java-1.6.0-sun-1.6.0.14-1jpp.nosrc.rpm
If you use x 86 architecture, the above will generate the following packages in the directory ~ / rpmbuild/RPMS/i586 /:
Code:
java-1.6.0-sun-1.6.0.14-1jpp.i586.rpm 
java-1.6.0-sun-alsa-1.6.0.14-1jpp.i586.rpm 
java-1.6.0-sun-demo-1.6.0.14-1jpp.i586.rpm 
java-1.6.0-sun-devel-1.6.0.14-1jpp.i586.rpm 
java-1.6.0-sun-fonts-1.6.0.14-1jpp.i586.rpm 
java-1.6.0-sun-jdbc-1.6.0.14-1jpp.i586.rpm 
java-1.6.0-sun-plugin-1.6.0.14-1jpp.i586.rpm 
java-1.6.0-sun-src-1.6.0.14-1jpp.i586.rpm
To install, change the directory ~ / rpmbuild/RPMS/i586 / and install only the packages required. Example:
Code:
cd ~/rpmbuild/RPMS/i586/ 
su 
rpm -Uvh java-1.6.0-sun-1.6.0.14-1jpp.i586.rpm java-1.6.0-sun-alsa-1.6.0.14-1jpp.i586.rpm java-1.6.0-sun-fonts-1.6.0.14-1jpp.i586.rpm java-1.6.0-sun-plugin-1.6.0.14-1jpp.i586.rpm 
exit
If you use an x86_64 architecture, the above will generate the following packages in the directory ~ / rpmbuild/RPMS/x86_64 /:
Code:
java-1.6.0-sun-1.6.0.14-1jpp.x86_64.rpm 
java-1.6.0-sun-alsa-1.6.0.14-1jpp.x86_64.rpm 
java-1.6.0-sun-demo-1.6.0.14-1jpp.x86_64.rpm 
java-1.6.0-sun-devel-1.6.0.14-1jpp.x86_64.rpm 
java-1.6.0-sun-fonts-1.6.0.14-1jpp.x86_64.rpm 
java-1.6.0-sun-jdbc-1.6.0.14-1jpp.x86_64.rpm 
java-1.6.0-sun-plugin-1.6.0.14-1jpp.x86_64.rpm 
java-1.6.0-sun-src-1.6.0.14-1jpp.x86_64.rpm
To install, change the directory ~ / rpmbuild/RPMS/x86_64 / and install only the packages required. Example:
Code:
cd ~/rpmbuild/RPMS/x86_64/ 
su 
rpm -Uvh java-1.6.0-sun-1.6.0.14-1jpp.x86_64.rpm java-1.6.0-sun-alsa-1.6.0.14-1jpp.x86_64.rpm java-1.6.0-sun-fonts-1.6.0.14-1jpp.x86_64.rpm java-1.6.0-sun-plugin-1.6.0.14-1jpp.x86_64.rpm 
exit
By default, the system uses version 1.4.2 of GNU.org.Se can be defined from the terminal version of Java used by delmandato alternatives with the - config java.
Code:
/ Usr / sbin / alternatives - config java
This results in output similar to the following:
Code:
There are 2 programs which provide 'java'.

   Selection Command
 -----------------------------------------------
 * + 1 / usr/lib/jvm/jre-1.4.2-gcj/bin/java
    2 / usr/lib/jvm/jre-1.6.0-sun/bin/java

 Press Enter to keep the current selection [+], or type the
 selection number:
Select the version 1.6 of Sun Microsystems by pressing the number 2 and then press ENTER.
To verify that the version of Java 1.6 has been installed correctly, just simply run the following command:
Code:
  java-version
Finally, if your system has Mozilla Firefox, you can configure the Java plug-in (Java Plugin) by creating a symbolic link from / usr/lib/jvm/java-1.6.0-sun-1.6.0.14/jre/lib / * / libjavaplugin_jni.so in / usr / lib / mozilla / plugins / as follows:
Code:
cd /usr/lib/mozilla/plugins/ 
ln -s /usr/lib/jvm/java-1.6.0-sun-1.6.0.14/jre/lib/*/libjavaplugin_jni.so ./

Reply With Quote
  #2  
Old 27-04-2012
Member
 
Join Date: Jul 2011
Posts: 1,787
Re: How to Install Java on CentOS

Lately I've been working on a CentOS server for its cloning of another 13 nodes of our computing cluster and found myself struggling with the 'installation of Java on this distribution derived from Red Hat. Unfortunately, although the Sun has recently released its entire Ambaradan Java under a free license, this came too late for the project CentOS (but also other distributions) could include their packages in the release phase of the release of the family 5. This, however, should be resolved when CentOS 6 will be released.
Reply With Quote
Reply

  TechArena Community > Software > Tips & Tweaks
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to Install Java on CentOS"
Thread Thread Starter Forum Replies Last Post
How to install rpm in CentOS 5.5? Man-Than Operating Systems 5 06-05-2011 10:39 AM
How to Install New Server with centos 5 Paheli Networking & Security 5 02-05-2011 10:39 PM
How to install VLC on CentOS 5.4 Ashert Windows Software 4 18-09-2010 09:13 PM
Install GIT on CentOS 5 CentOS-DollarUser Operating Systems 3 18-08-2009 11:03 PM
Install CentOS using vmware SusE-SoNi Operating Systems 3 30-07-2009 09:10 PM


All times are GMT +5.5. The time now is 02:22 PM.