Note: When originally posted I was trying to install maven2. Since the main answer is for maven3 I have updated the title. The rest of the question remains as it was originally posted.
I'm trying to install maven2 on a redhat linux box using the command
yum install maven2
but yum doesn't seem to be able to find maven2.
No package maven2 available
I've run across other posts about this topic, but the answer to the following post suggests to add repos. I add said repos, but run into errors after adding them.
How to install Maven into Red Hat Enterprise Linux 6?
I can only access this box via command line so simply downloading maven from their website is difficult for me.
Go to mirror.olnevhost.net/pub/apache/maven/binaries/ and check what is the latest tar.gz file
Supposing it is e.g. apache-maven-3.2.1-bin.tar.gz, from the command line; you should be able to simply do:
wget http://mirror.olnevhost.net/pub/apache/maven/binaries/apache-maven-3.2.1-bin.tar.gz
And then proceed to install it.
UPDATE: Adding complete instructions (copied from the comment below)
run the following to extract the tar:
tar xvf apache-maven-3.2.1-bin.tar.gz
Next add the env varibles such as
export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.1
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
Verify
mvn -version