Red Hat Training

A Red Hat training course is available for Red Hat Fuse

Appendix B. Prerequisite Software

B.1. Install Open JDK on Red Hat Linux

This topic covers the steps to install Open JDK on RedHat Linux.
  1. Subscribe to the Base Channel Obtain the OpenJDK from the RHN base channel. (Your installation of Red Hat Enterprise Linux is subscribed to this channel by default.)
  2. Install the Package. Use the yum utility to install OpenJDK: yum install java-1.7.0-openjdk-devel
  3. Verify that Open JDK is now your system default. You can ensure the correct JDK is set as the system default by following the steps below.
    1. As a root user, run the alternatives command for java: /usr/sbin/alternatives --config java
    2. Select /usr/lib/jvm /jre-1.7.0-openjdk/bin/java .
    3. Apply the same for javac: /usr/sbin/alternatives --config javac
    4. Select /usr/lib/jvm /java-1.7.0-openjdk/bin/java.
Result

Open JDK is installed successfully on your machine.

B.2. Install Maven

Prerequisites

The following software must be installed:

  • An archiving tool for extracting the contents of compressed files.
  • Open JDK.

Procedure B.1. Install Maven

  1. Download Maven.

    1. Enter http://maven.apache.org/download.cgi in the address bar of a browser.
    2. Download apache-maven-3.0.5 ZIP file and save it to your hard drive.
  2. Install and configure Maven.

    • On Red Hat Enterprise Linux

      1. Extract the ZIP archive to the directory where you wish to install Maven.
      2. Open a terminal.
      3. Add the M2_HOME environment variable by entering the following command:
        export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.x
      4. Add the M2 environment variable by entering the following command:
        export M2=$M2_HOME/bin
      5. Add the M2 environment variable to your path by entering the following command:
        export PATH=$M2:$PATH
      6. Make sure that JAVA_HOME is set to the location of your JDK. For example:
        export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk.x86_64
      7. Make sure that $JAVA_HOME/bin is in your PATH environment variable.
      8. Run the following command to verify that Maven is installed successfully on your machine:
        mvn --version
    • On Microsoft Windows

      1. Extract the ZIP archive to the directory where you wish to install Maven. The subdirectory apache-maven-3.0.x is created from the archive.
      2. Press Start+Pause|Break. The System Properties dialog box is displayed.
      3. Click the Advanced tab and click Environment Variables.
      4. Under System Variables, select Path.
      5. Click Edit and add the two Maven paths using a semicolon to separate each entry.
        • Add the M2_HOME variable and set the path to C:\Program Files\Apache Software Foundation\apache-maven-3.0.X.
        • Add the M2 variable and set the value to %M2_HOME%\bin.
      6. Update or create the Path environment variable:
        • Add the %M2% variable to allow Maven to be executed from the command line.
        • Add the variable %JAVA_HOME%\bin to set the path to the correct Java installation.
      7. Click OK to close all the dialog boxes including the System Properties dialog box.
      8. Open Windows command prompt and run the following command to verify that Maven is installed successfully on your machine:
        mvn --version
Result

Maven is successfully installed and configured on your machine.