How to Install Apache Maven on Fedora CoreOS Latest
Apache Maven is a build automation tool used primarily for Java projects. It helps in managing dependencies, building and managing project releases, and generating documentation. Here is a step-by-step guide on how to install Apache Maven on Fedora CoreOS latest by following the below steps:
Prerequisites
Before installing Apache Maven, it is essential to make sure that the system is up-to-date. Run the following command to update the package list and upgrade system packages:
sudo dnf update -y
Step 1: Install Java
Maven is a Java-based tool, so it requires Java to be installed on the system. Fedora CoreOS comes with OpenJDK pre-installed, so run the following command to verify the installed version of java.
java -version
If java is not installed, run the following command to install it:
sudo dnf install java-1.8.0-openjdk
Step 2: Download Apache Maven
Visit the official website of Apache Maven at http://maven.apache.org/ to download the latest Maven version.
Open the terminal and download Apache Maven tar file using the following command:
wget https://apache.osuosl.org/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz
Step 3: Extract the Apache Maven tar file
Once the download has been completed, extract the tar file using the following command:
tar xvf apache-maven-3.8.1-bin.tar.gz
Step 4: Set Environment Variables
To use Apache Maven, we need to set environment variables. Add the following lines to the /etc/profile file:
export M2_HOME=/opt/maven
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
Save and exit the file and run the following command to reload the profile:
source /etc/profile
Step 5: Verify installation
Finally, run the following command to check the installed maven version:
mvn -version
This command will display Maven version and Java version details on the terminal.
Conclusion
Congratulations! You have successfully installed Apache Maven on Fedora CoreOS latest. You can use Maven now to build Java projects.