Results 1 to 2 of 2

Thread: How to Install Java on CentOS

  1. #1
    Join Date
    May 2011
    Posts
    448

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

  2. #2
    Join Date
    Jul 2011
    Posts
    1,795

    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.

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,621,305.75823 seconds with 17 queries