-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy path003. Maven and Java on Amazon Linux VM.txt
60 lines (43 loc) · 1.28 KB
/
003. Maven and Java on Amazon Linux VM.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Installation and Configuration of Maven and Java on Amazon Linux EC2 instance
======================================================================================================
Step1:
**********
Update the packages
sudo yum update -y
Step2:
**********
Install Java
sudo amazon-linux-extras install java-openjdk11 -y
java -version
Step3:
**********
Install Maven
Download and extract Maven
cd /opt
sudo wget https://downloads.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz
sudo tar -xzvf apache-maven-3.8.4-bin.tar.gz
sudo mv apache-maven-3.8.4 /opt/maven
Step4:
**********
Configure Environment Variables
Open the environment profile file:
sudo nano /etc/profile.d/maven.sh
Add the following lines to configure JAVA_HOME, MAVEN_HOME, and update the PATH:
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
export MAVEN_HOME=/opt/maven
export PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
Save and close the file
Step5:
**********
Apply the Environment Variables
Load the new environment variables into the current session:
source /etc/profile.d/maven.sh
Step6
**********
Verify the Installation
Verify the Java installation:
echo $JAVA_HOME
java -version
Verify the Maven installation:
echo $MAVEN_HOME
mvn -version