How to Install Apache Maven on Linux: Step-by-Step Guide
HardReset.InfoJanuary 17, 20265 min16 views
11 connectionsΒ·17 entities in this videoβPrerequisites for Maven Installation
- π‘ Before installing Maven, ensure Java is installed on your Linux system by running
java -version. - π― Maven is a build automation and project management tool for Java, requiring a Java Development Kit (JDK) to function.
Method 1: Package Manager Installation
- π¦ For Ubuntu/Debian systems, use
sudo apt install maven. - π¦ For Fedora or similar distributions, use
sudo dnf install maven. - β οΈ This method is quick but might install an older version of Maven.
Method 2: Official Binary Installation
- π Navigate to the official Apache Maven website to download the latest binary distribution.
- ποΈ Download the
bin.tar.gzarchive for your Linux system. - π Extract the downloaded archive using the
tar -xvzf <archive_name>.tar.gzcommand in your Downloads folder.
Setting Up Environment Variables
- π Move the extracted Maven folder to a standard location like
/optusingsudo mv apache-maven-<version> /opt/maven. - βοΈ Edit your
~/.bashrcfile using a text editor (e.g.,nano ~/.bashrc) to add environment variables. - π Add the following lines to
~/.bashrc:export M2_HOME=/opt/mavenexport PATH=$M2_HOME/bin:$PATH
- πΎ Save the changes by pressing
Ctrl+O,Enter, and exit withCtrl+X.
Verification
- π Apply the changes to your current terminal session by running
source ~/.bashrc. - β
Verify the Maven installation by typing
mvn -versionin the terminal. - π― A successful output will display the installed Maven version and the Maven home directory.
Knowledge graph17 entities Β· 11 connections
How they connect
An interactive map of every person, idea, and reference from this conversation. Hover to trace connections, click to explore.
Hover Β· drag to explore
17 entities
Chapters3 moments
Key Moments
Transcript22 segments
Full Transcript
Topics14 themes
Whatβs Discussed
Apache MavenLinux InstallationJavaBuild AutomationProject ManagementPackage ManageraptdnfEnvironment VariablesPATHM2_HOMEmvn -versiontar.gzBinary Distribution
Smart Objects17 Β· 11 links
CompanyΒ· 1
ProductsΒ· 2
ConceptsΒ· 9
MediaΒ· 1
LocationsΒ· 4