Installing MAVEN on Red Hat Enteprise Server 6.x (rhel6)
Just had to install maven on a rhel6 box… not sure why it is not in the yum / up2date repo.
First you need JDK7.x:
get it at: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
“Linux x64 116.91 MB jdk-7u45-linux-x64.rpm”
install the RPM using
rpm -Uvh jdk-7u45-linux-x64.rpm
then remove openJRE from the alternatives list:
alternatives --list java
alternatives --remove java /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
Double check the java version:
java -version
It should say:
java version "1.7.0_45"
Java(TM) SE Runtime Environment (Build 1.7.0_45-b18)
…
Now go to the Maven site:
and get the latest version of 2.x or 3.x (using 2.2.1 here)
wget http://apache.osuosl.org/maven/maven-2/2.2.1/binaries/apache-maven-2.2.1-bin.tar.gz
and install:
tar zxvf apache-maven-2.2.1-bin.tar.gz
mv apache-maven-2.2.1 /opt/
ln -s /opt/apache-maven-2.2.1 /opt/maven
nano /etc/profile.d/custom.sh
paste this:
#!/bin/bash
export JAVA_HOME=/usr/java/latest
export MAVEN_HOME=/opt/maven
export M2_HOME=$MAVEN_HOME
export PATH=$PATH:$MAVEN_HOME/bin
-save (ctrl-o)
-new session
test:
mvn --version
Should say:
…
Apache Maven 2.2.1
Reply