Help on installing Apache maven

The error indicates that the wget command is unable to download the file from https://mirrors.estointernet.in because the connection to the server is either refused or times out. This could be due to:

  1. Server Issues: The mirror server may be down or temporarily unavailable.
  2. Network Issues: Your network might be blocking access to the server.
  3. Firewall Restrictions: A firewall could be preventing connections to that specific server or port.

Suggestions on how to fix the issue:

  1. You can find alternative mirrors from the Apache Maven download page by running this command wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

  2. If your network blocks certain servers, try downloading the file using a proxy or VPN to bypass restrictions by running this command wget -e use_proxy=yes -e http_proxy=your_proxy_url https://mirrors.estointernet.in/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

  3. Manually Download the File

navigate to the /tmp directory download the zip file using the command below

#wget https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz -P /tmp

Navigate to the /opt directory with cd then extract the zip file

sudo tar xf /tmp/apache-maven-*.tar.gz -C /opt

Create a Symbolic Link by running the command below

sudo ln -s /opt/apache-maven-3.9.6 /opt/maven

Configure Environment Variables

Go to the /etc/profile.d/ directory, create and open the maven.sh script file in your preferred text editor and run the command

sudo vi /etc/profile.d/maven.sh

Add the following export statement lines in the maven.sh file to make the script executable:

export JAVA_HOME=/usr/lib/jvm/default-java

export M2_HOME=/opt/maven

export MAVEN_HOME=/opt/maven

export PATH=${M2_HOME}/bin:${PATH}

Next, use the chmod command to give the maven.sh file executable permission:

sudo chmod +x /etc/profile.d/maven.sh

Finally, run the following source command to load the configuration from the maven.sh file:

source /etc/profile.d/maven.sh

Print the Maven version information to verify the installation.

# mvn -version

Thanks problem fixed

1 Like

Am happy you never gave up.