Maven installation on AWS Linux:
1. Pre requisite : java
First you have to install java then maven
If you want to check use below command.
java -version
2. Let me login to my AWS account and start your instance
3. Connect your AWS instance using ssh command
click connect on top of your instance then copy ssh command.
ssh -i "JenkinsServer.pem" ec2-user@ec2-13-127-1-46.ap-south-1.compute.amazonaws.com
4. If it prompts type yes and continue
5. After connecting to your ec2 instacen type uname/pwd
uname
it will give the output as Linux i.e u r successfully connected to linux server
then type pwd( print working directory)
pwd
/home/ec2-user
6. Now you have to login with root user using the cmd
sudo su -
7 You are connected to root user
if you want to check type
whoami
pwd
/root
8. Get inside the opt directory from there you have to dowload
cd /opt
[root@ip-172-31-44-87 opt]#
9. Now i want to download maven software
google it maven software
select offcila link
there you will find binary or source files
utilize exisiting features select binary else source
10. Commonly any software in linux environment we can download using wget cmd.
Right click on hyperlink copy and paster after wget cmd in linux
wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip
11. It will download the zipped bundle of maven
Now you want to extract that file using unzip command.
unzip apache-maven-3.6.3-bin.zip
12. Go inside the Apache maven
cd apache-maven-3.6.3
13. Now we have to set the environment variable for maven in .bash_profile.
vi ~/.bash_profile
-i
add these lines of code to your .bash-profile file.
export M2_HOME="/opt/apache-maven-3.6.3"
export PATH=$PATH:$M2_HOME/bin
14. Now you can check maven installed properly or not using
mvn -version
it will give cmd not found.
because you need to execute
source ~/.bash_profile
Now maven installed & configured successfully on AWS ec2