• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

How to Install Apache Maven on Ubuntu 16.04

How VPS by How VPS
January 1, 2020
in Linux
0
0
SHARES
15
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Introduction
  2. Prerequisites
  3. Step 1: Update your server
  4. Step 2: Install Java
  5. Step 3: Install Apache Maven
  6. Step 4: Setup environment variables
  7. Step 5: Verify installation
  8. Want to contribute?


Introduction

Apache Maven is a free and open source project management tool used for Java projects. You can easily manage a project’s build, reporting, and documentation from a central piece of information using Apache Maven. Apache Maven provides a complete framework to automate the project’s build infrastructure.

In this tutorial, you will learn how to install Apache Maven on Ubuntu 16.04.

Prerequisites

  • A newly deployed Vultr Ubuntu 16.04 server.
  • A non-root user with sudo privileges created on your server.

Step 1: Update your server

First, update your system to the latest stable version by running the following command:

sudo apt-get update -y
sudo apt-get upgrade -y

Step 2: Install Java

Apache Maven requires Java to be installed on your server. By default, Java is not available in Ubuntu’s repository. Add the Oracle Java PPA to Apt with the following command:

sudo add-apt-repository ppa:webupd8team/java

Next, update your Apt package database with the following command:

sudo apt-get update -y

Install the latest stable version of Oracle Java 8.

sudo apt-get install oracle-java8-installer

Verify the Java version by running the following command:

java -version

Output:

java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Step 3: Install Apache Maven

You can download the latest stable version of Apache Maven from its official website, otherwise you can download it directly with the following command:

cd /opt/
wget http://www-eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz

Once the download has completed, extract the downloaded archive.

sudo tar -xvzf apache-maven-3.3.9-bin.tar.gz

Next, rename the extracted directory.

sudo mv apache-maven-3.3.9 maven 

Step 4: Setup environment variables

Next, you will need to setup the environment variables such as M2_HOME, M2, MAVEN_OPTS, and PATH. You can do this by creating a mavenenv.sh file inside of the /etc/profile.d/ directory.

sudo nano /etc/profile.d/mavenenv.sh

Add the following lines:

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

Save and close the file, update its permissions, then load the environment variables with the following command:

sudo chmod +x /etc/profile.d/mavenenv.sh
sudo source /etc/profile.d/mavenenv.sh

Step 5: Verify installation

Once everything has been successfully configured, check the version of the Apache Maven.

mvn --version

You should see the following output:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:47+05:30)
Maven home: /opt/maven
Java version: 1.8.0_101, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.13.0-32-generic", arch: "amd64", family: "unix"

Congratulations! You have successfully installed Apache Maven on your Ubuntu 16.04 server.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How to Install and Use ArangoDB on Ubuntu 16.04

Next Post

Installing Golang on Ubuntu 14.04

Next Post

Installing Golang on Ubuntu 14.04

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet