• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to install Apache Maven on Rocky Linux 9.2

  • 00:34 cat /etc/os-release
  • 00:56 dnf install -y java-17-openjdk wget tar
  • 01:55 java --version
  • 02:12 cd /tmp
  • 02:24 wget https://downloads.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
  • 02:39 tar xf apache-maven-3.8.8-bin.tar.gz -C /opt
  • 02:47 ls /opt
  • 03:04 ln -s /opt/apache-maven-3.8.8 /opt/maven
  • 03:36 vi /etc/profile.d/maven
  • 04:13 chmod +x /etc/profile.d/maven
  • 04:37 source /etc/profile.d/maven
  • 04:55 mvn --version
{{postValue.id}}

To install Apache Maven on Rocky Linux 9.2

Introduction:

Maven is a build automation tool used primarily for Java projects that can also be used to build and manage projects written in C#, Ruby, Scala, and other languages. The Maven project is hosted by the Apache Software Foundation, where it was formerly part of the Jakarta Project.

Installation steps

Step 1: Check the OS version by using the following command

[root@Linuxhelp ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.2 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.2"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.2 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.2"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.2"

Step 2: Install java along wget and tar software package by using the below command.

[root@Linuxhelp ~]# dnf install -y java-17-openjdk wget tar
Rocky Linux 9 - BaseOS                                                                    4.7 kB/s | 4.1 kB     00:00    
Rocky Linux 9 - BaseOS                                                                    1.5 MB/s | 1.9 MB     00:01    
Rocky Linux 9 - AppStream                                                                 5.6 kB/s | 4.5 kB     00:00    
Rocky Linux 9 - AppStream                                                                 4.2 MB/s | 7.1 MB     00:01    
Rocky Linux 9 - Extras                                                                    3.7 kB/s | 2.9 kB     00:00    
Rocky Linux 9 - Extras                                                                    7.6 kB/s |  11 kB     00:01    
Package wget-1.21.1-7.el9.x86_64 is already installed.
Package tar-2:1.34-6.el9_1.x86_64 is already installed.
Dependencies resolved.
==========================================================================================================================
 Package                               Architecture        Version                           Repository              Size
==========================================================================================================================
Installing:
 java-17-openjdk                       x86_64              1:17.0.8.0.7-2.el9                appstream              434 k
Installing dependencies:
 copy-jdk-configs                      noarch              4.0-3.el9                         appstream               27 k
 java-17-openjdk-headless              x86_64              1:17.0.8.0.7-2.el9                appstream               45 M
 javapackages-filesystem               noarch              6.0.0-4.el9                       appstream               11 k
 lksctp-tools                          x86_64              1.0.19-2.el9                      baseos                  90 k
 lua                                   x86_64              5.4.4-3.el9                       appstream              187 k
 lua-posix                             x86_64              35.0-8.el9                        appstream              131 k
 mkfontscale                           x86_64              1.2.1-3.el9                       appstream               31 k
 ttmkfdir                              x86_64              3.0.9-65.el9                      appstream               52 k
 tzdata-java                           noarch              2023c-1.el9                       appstream              149 k
 xorg-x11-fonts-Type1                  noarch              7.5-33.el9                        appstream              499 k

Transaction Summary
==========================================================================================================================
Install  11 Packages

Total download size: 47 M
Installed size: 199 M
Downloading Packages:
Rocky Linux 9 - BaseOS                   196% [===========================================================================(1/11): javapackages-filesystem-6.0.0-4.el9.noarch.rpm                                     22 kB/s |  11 kB     00:00    
(2/11): xorg-x11-fonts-Type1-7.5-33.el9.noarch.rpm                                        957 kB/s | 499 kB     00:00    
(3/11): lksctp-tools-1.0.19-2.el9.x86_64.rpm                                              164 kB/s |  90 kB     00:00    
(4/11): copy-jdk-configs-4.0-3.el9.noarch.rpm                                             323 kB/s |  27 kB     00:00    
(5/11): lua-posix-35.0-8.el9.x86_64.rpm                                                   1.4 MB/s | 131 kB     00:00    
(6/11): lua-5.4.4-3.el9.x86_64.rpm                                                        1.5 MB/s | 187 kB     00:00    
(7/11): ttmkfdir-3.0.9-65.el9.x86_64.rpm                                                  753 kB/s |  52 kB     00:00    
(8/11): tzdata-java-2023c-1.el9.noarch.rpm                                                896 kB/s | 149 kB     00:00    
(9/11): mkfontscale-1.2.1-3.el9.x86_64.rpm                                                406 kB/s |  31 kB     00:00    
(10/11): java-17-openjdk-17.0.8.0.7-2.el9.x86_64.rpm                                      2.8 MB/s | 434 kB     00:00    
(11/11): java-17-openjdk-headless-17.0.8.0.7-2.el9.x86_64.rpm                              25 MB/s |  45 MB     00:01    
--------------------------------------------------------------------------------------------------------------------------
Total                                                                                      12 MB/s |  47 MB     00:03     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: copy-jdk-configs-4.0-3.el9.noarch                                                                1/1 
  Running scriptlet: java-17-openjdk-headless-1:17.0.8.0.7-2.el9.x86_64                                               1/1 
  Preparing        :                                                                                                  1/1 
  Installing       : mkfontscale-1.2.1-3.el9.x86_64                                                                  1/11 
  Installing       : ttmkfdir-3.0.9-65.el9.x86_64                                                                    2/11 
  Installing       : xorg-x11-fonts-Type1-7.5-33.el9.noarch                                                          3/11 
  Running scriptlet: xorg-x11-fonts-Type1-7.5-33.el9.noarch                                                          3/11 
  Installing       : tzdata-java-2023c-1.el9.noarch                                                                  4/11 
  Installing       : lua-posix-35.0-8.el9.x86_64                                                                     5/11 
  Installing       : lua-5.4.4-3.el9.x86_64                                                                          6/11 
  Installing       : copy-jdk-configs-4.0-3.el9.noarch                                                               7/11 
  Installing       : javapackages-filesystem-6.0.0-4.el9.noarch                                                      8/11 
  Installing       : lksctp-tools-1.0.19-2.el9.x86_64                                                                9/11 
  Installing       : java-17-openjdk-headless-1:17.0.8.0.7-2.el9.x86_64                                             10/11 
  Running scriptlet: java-17-openjdk-headless-1:17.0.8.0.7-2.el9.x86_64                                             10/11 
  Installing       : java-17-openjdk-1:17.0.8.0.7-2.el9.x86_64                                                      11/11 
  Running scriptlet: java-17-openjdk-1:17.0.8.0.7-2.el9.x86_64                                                      11/11 
  Running scriptlet: copy-jdk-configs-4.0-3.el9.noarch                                                              11/11 
  Running scriptlet: java-17-openjdk-headless-1:17.0.8.0.7-2.el9.x86_64                                             11/11 
  Running scriptlet: java-17-openjdk-1:17.0.8.0.7-2.el9.x86_64                                                      11/11 
  Verifying        : lksctp-tools-1.0.19-2.el9.x86_64                                                                1/11 
  Verifying        : javapackages-filesystem-6.0.0-4.el9.noarch                                                      2/11 
  Verifying        : xorg-x11-fonts-Type1-7.5-33.el9.noarch                                                          3/11 
  Verifying        : copy-jdk-configs-4.0-3.el9.noarch                                                               4/11 
  Verifying        : lua-5.4.4-3.el9.x86_64                                                                          5/11 
  Verifying        : lua-posix-35.0-8.el9.x86_64                                                                     6/11 
  Verifying        : tzdata-java-2023c-1.el9.noarch                                                                  7/11 
  Verifying        : ttmkfdir-3.0.9-65.el9.x86_64                                                                    8/11 
  Verifying        : mkfontscale-1.2.1-3.el9.x86_64                                                                  9/11 
  Verifying        : java-17-openjdk-headless-1:17.0.8.0.7-2.el9.x86_64                                             10/11 
  Verifying        : java-17-openjdk-1:17.0.8.0.7-2.el9.x86_64                                                      11/11 

Installed:
  copy-jdk-configs-4.0-3.el9.noarch                               java-17-openjdk-1:17.0.8.0.7-2.el9.x86_64              
  java-17-openjdk-headless-1:17.0.8.0.7-2.el9.x86_64              javapackages-filesystem-6.0.0-4.el9.noarch             
  lksctp-tools-1.0.19-2.el9.x86_64                                lua-5.4.4-3.el9.x86_64                                 
  lua-posix-35.0-8.el9.x86_64                                     mkfontscale-1.2.1-3.el9.x86_64                         
  ttmkfdir-3.0.9-65.el9.x86_64                                    tzdata-java-2023c-1.el9.noarch                         
  xorg-x11-fonts-Type1-7.5-33.el9.noarch                         

Complete!

Step 3: Check the java version by using the below command.

[root@Linuxhelp ~]# java --version
openjdk 17.0.8 2023-07-18 LTS
OpenJDK Runtime Environment (Red_Hat-17.0.8.0.7-1) (build 17.0.8+7-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.8.0.7-1) (build 17.0.8+7-LTS, mixed mode, sharing)

Step 4: Move to the /tmp directory by using the below command.

[root@Linuxhelp ~]# cd /tmp

Step 5: Download the Apache Maven software from their official website by using the below command.

[root@Linuxhelp tmp]# wget https://downloads.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
--2023-09-21 02:56:16--  https://downloads.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
Resolving downloads.apache.org (downloads.apache.org)... 88.99.95.219, 135.181.214.104, 2a01:4f8:10a:201a::2, ...
Connecting to downloads.apache.org (downloads.apache.org)|88.99.95.219|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8296049 (7.9M) [application/x-gzip]
Saving to: ‘apache-maven-3.8.8-bin.tar.gz’

apache-maven-3.8.8-bin.tar.gz  100%[==================================================>]   7.91M  5.44MB/s    in 1.5s    

2023-09-21 02:56:19 (5.44 MB/s) - ‘apache-maven-3.8.8-bin.tar.gz’ saved [8296049/8296049]

Step 6: After download, extract the tar file into /opt directory by using the below command.

[root@Linuxhelp tmp]# tar xf apache-maven-3.8.8-bin.tar.gz -C /opt

Step 7: List the /opt directory by using ls command.

[root@Linuxhelp tmp]# ls /opt
apache-maven-3.8.8

Step 8: Create a soft link for easy accessibility and management by using the below command.

[root@Linuxhelp tmp]# ln -s /opt/apache-maven-3.8.8 /opt/maven

Step 9: Set the environment variables as required by Apache Maven software For that, create a file in /etc/profile.d directory by using vim text editor.

[root@Linuxhelp tmp]# vi /etc/profile.d/maven
Add the following commands in this file.
export JAVA_HOME=/usr/lib/jvm/jre-openjdk
export M2_HOME=/opt/maven
export MAVEN_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}

Step 10: Set the executable permissions to /etc/profile.d/maven file.

[root@Linuxhelp tmp]# chmod +x /etc/profile.d/maven

Step 11: Execute the following script to setup Maven environment for our Linux shell.

[root@Linuxhelp tmp]# source /etc/profile.d/maven

Step 12: Check the version of Apache Maven software by using the following command

[root@Linuxhelp tmp]# mvn --version
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: /opt/maven
Java version: 17.0.8, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-17-openjdk-17.0.8.0.7-2.el9.x86_64
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "5.14.0-284.25.1.el9_2.x86_64", arch: "amd64", family: "unix"

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install Apache Maven on Rocky Linux 9.2. Your feedback is much welcome.

Tags:
matthew
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What do you mean by Maven?

A

Maven is a project management tool (introduced by Apache Software Foundation) that provides an entire framework for the build cycle. It is open-source and is mainly used for the project developed in Java.

Q

How do we determine the version of Maven in our system?

A

To determine the version of Maven we are using in our system, we need to enter the below command in the console.
mvn –version

Q

What are the differences between Maven and Ant?

A

Ant is procedural, you need to provide information about what to do and when to do it through code. You need to provide an order. Whereas Maven is declarative, everything you define in the pom.xml file.

Q

What is POM XML?

A

A Project Object Model or POM is Maven's fundamental unit of work. It is an XML file that contains information about the project and configuration details used by Maven to build the project

Q

What do you mean by a Maven Repository?

A

The Maven repository is the location of a directory where all the related project artifacts, jars, libraries, and plugins are kept and can be utilized by Maven efficiently.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luk Van De Looverbosch ?
How to create a root ?

Hello,
How to create root@linuxhelp in Linux Mint 20.1 64-bit ?
Thanks in advance for your reply.
Best regards.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.