Atlantic.Net Blog

How to Install Apache Maven on Oracle Linux 8

Hitesh Jethva
by Atlantic.Net (414 posts) under Tutorials, VPS Hosting
0 Comments

Apache Maven is a free, open-source, POM-based Java project management tool. It is written in Java and used to build projects written in C#, Scala, Ruby, etc. Apache Maven is designed for Java developers to help them to develop reports, check, build and test automation setups. The tool was developed by the Apache Group to build, publish, and deploy multiple Java projects at once for better performance. Apache Maven uses XML files to define configuration details, project dependencies, and other data.

Features

  • Dependency management
  • Large repository
  • Extensible via plug-ins
  • Model-based builds
  • Release management and distribution publication
  • Backward compatibility
  • Easy to test, deploy and manage upgrades

In this post, we will show you how to install Apache Maven on OracleLinux 8.

Prerequisites

  • A server running OracleLinux 8 on the Atlantic.Net Cloud Platform
  • A root password is configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Oracle Linux as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install Maven via AppStream Repository

By default, the Apache Maven package is included in the OracleLinux AppStream repository. You can check it using the following command:

dnf info maven

You should get the following output:

Last metadata expiration check: 1:43:10 ago on Thursday 19 May 2022 02:02:55 AM EDT.
Available Packages
Name         : maven
Epoch        : 1
Version      : 3.5.4
Release      : 5.module+el8+5161+5cac467c
Architecture : noarch
Size         : 27 k
Source       : maven-3.5.4-5.module+el8+5161+5cac467c.src.rpm
Repository   : ol8_appstream
Summary      : Java project management and project comprehension tool
URL          : http://maven.apache.org/
License      : ASL 2.0 and MIT
Description  : Maven is a software project management and comprehension tool. Based on the
             : concept of a project object model (POM), Maven can manage a project's build,
             : reporting and documentation from a central piece of information.

Now, install Apache Maven using the following command:

dnf install maven -y

After the installation, verify the Maven version using the following command:

mvn --version

You should get the following output:

Apache Maven 3.5.4 (Red Hat 3.5.4-5)
Maven home: /usr/share/maven
Java version: 1.8.0_332, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-2.el8_6.x86_64/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "4.18.0-348.12.2.el8_5.x86_64", arch: "amd64", family: "unix"

Step 3 – Install Maven From Source

It is a good idea to install Apache Maven from the source if you want to install the latest version of Maven. Apache Maven is Java-based software. so you will need to install OpenJDK on your system.

Run the following command to install OpenJDK to your server.

dnf install java-11-openjdk -y

After the successful installation, verify the Java version using the following command:

java --version

Sample output:

openjdk 11.0.15 2022-04-19 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.15+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.15+10-LTS, mixed mode, sharing)

Next, go to the Apache Maven download page and download the latest version of Maven:

wget https://dlcdn.apache.org/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.tar.gz

Next, create a directory for Apache Maven with the following command:

mkdir /usr/local/maven

Next, extract the downloaded file to the Maven directory with the following command:

tar xzf apache-maven-3.8.5-bin.tar.gz -C /usr/local/maven/ --strip-components=1

Next, you will need to add the Maven binary location to the system path. You can add it with the following command:

echo export 'PATH=$PATH:/usr/local/maven/bin/' > /etc/profile.d/maven.sh
echo 'export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.15.0.10-2.el8_6.x86_64' >> /etc/profile.d/maven.sh

Next, set proper permissions to the maven.sh file with the following command:

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

Next, activate the Maven system path with the following command:

source /etc/profile.d/maven.sh

Next, verify the Maven version using the following command:

mvn --version

You should get the following output:

Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
Maven home: /usr/local/maven
Java version: 11.0.15, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.15.0.10-2.el8_6.x86_64
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "4.18.0-348.12.2.el8_5.x86_64", arch: "amd64", family: "unix"

Conclusion

In the above guide, we explained two methods to install Apache Maven on OracleLinux 8. You can now start using Apache Maven to manage your Java project. Get started on VPS hosting from Atlantic.Net.

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Top 10 Best Cybersecurity Training Services
How to Install Ansible on Oracle Linux 8
How to Install LEMP Server on Oracle Linux 8
How to Install and Configure Apache Webserver on Oracle Linux 8
How to Install and Configure Nginx Webserver on Oracle Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Dallas, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources