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:
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 ./
Bookmarks