[AWS EC2] How to install Maven on Amazon Linux 2

Overview

Install Maven on AWS EC2 (AMI: Amazon Linux 2) to use the mvn command

environment

Construction procedure

1. Install JDK 8

--Amazon Linux 2 does not include Java by default, so install it --JDK 1.7 or higher is required for Apache Maven 3.3 or later

$ sudo yum install -y java-1.8.0-openjdk-devel.x86_64
$ sudo alternatives --config java
$ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)

2. Download Maven

--Download destination: Downloading Apache Maven --Copy the URL of the Link of Binary tar.gz archive and download it with wget

$ cd /usr/local/lib/
$ sudo wget http://ftp.meisei-u.ac.jp/mirror/apache/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

Saving to: ‘apache-maven-3.6.3-bin.tar.gz’  
2020-03-27 11:23:54 (23.6 MB/s) - ‘apache-maven-3.6.3-bin.tar.gz’ saved [9506321/9506321]

3. Unfold and deploy Maven

--Unzip the downloaded file and place it in / opt / --Put the symbolic link of ʻapache-maven on the expanded ʻapache-maven-3.6.3

$ sudo tar -xzvf apache-maven-3.6.3-bin.tar.gz
$ sudo mv apache-maven-3.6.3 /opt/
$ cd /opt/
$ sudo ln -s /opt/apache-maven-3.6.3 apache-maven
$ ls -l
lrwxrwxrwx 1 root root 23 Mar 27 11:36 apache-maven -> /opt/apache-maven-3.6.3
drwxr-xr-x 6 root root 99 Mar 27 11:28 apache-maven-3.6.3

4. Add PATH to Maven

--Add MVN_HOME to .bash_profile --Add MVN_HOME / bin to PATH --Reflect .bash_profile

$ cd
$ vi .bash_profile
MVN_HOME=/opt/apache-maven
PATH=$MVN_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin

$ source .bash_profile

5. Make sure you can use the mvn command

$ mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/apache-maven
Java version: 1.8.0_242, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.amzn2.0.1.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.14.171-136.231.amzn2.x86_64", arch: "amd64", family: "unix"

Impressions

I was a little confused about where to make Maven home

reference

-Maven on CentOS 7 Tutorial -UNIX OS directory structure table (CentOS 7.3)

Recommended Posts

[AWS EC2] How to install Maven on Amazon Linux 2
How to install Anisble on Amazon Linux 2
[2020 version] How to install Python3 on AWS EC2
[AWS EC2] How to install only MySQL client on Amazon Linux 2 and connect to RDS
How to install VMware-Tools on Linux
Install pyenv on EC2 (Amazon Linux)
How to install git on Linux such as EC2
How to install Maven on CentOS
[AWS] How to expand disk space on Amazon linux
[AWS EC2] Settings you want to do on Amazon Linux 2
I'll install Ruby on EC2 (Amazon Linux2) 2020
How to install aws-session-manager-plugin on Manajro Linux
How to update php on Amazon linux 2
How to install packages on Alpine Linux
How to install php7.4 on Linux (Ubuntu)
Install Python 3.8, Pip 3.8 on EC2 (Amazon Linux 2)
How to install Camunda Modeler on Manjaro Linux
Install tomcat 5.5 on Amazon Linux.
Install Homebrew on Amazon Linux 2
Install strongSwan 5.9.1 on Amazon Linux 2
AWS EC2 2nd SSH connection to EC2 Instance (Amazon Linux2)
How to build a Python environment on amazon linux 2
Install Python Pillow on Amazon Linux
Install oracle java8 on amazon linux2
How to install pycrypto on Windows
How to install OpenCV on Mac
How to install MBDyn (Linux Ubuntu)
How to install PyPy on CentOS
How to install TensorFlow on CentOS 7
[Note] Install Imagick on Amazon Linux2
How to install Go on Ubuntu
How to install music 21 on windows
Launch NEM Symbol testnet node on AWS EC2 (Amazon Linux2)
How to install drobertadams / toggl-cli on Mac
[Kivy] How to install Kivy on Windows [Python]
How to install pandas on EC2 (How to deal with MemoryError and PermissionError)
How to display emoji on Manjaro Linux
Upgraded mysql on Cloud9 (Amazon Linux) (5.5 to 5,7)
5 reasons to install Linux on your laptop.
How to install richzhang / colorization on Windows 10
How to install Windows Subsystem For Linux
How to update security on CentOS Linux 8
How to install Apache (httpd) on CentOS7
How to install Eclipse GlassFish 5.1.0 on CentOS 7
How to install Apache (httpd) on CentOS8
How to find large files on Linux
How to install NumPy on Raspberry Pi
How to install cx_Oracle on macOS Sierra
How to set up a jupyter notebook on ssh destination (AWS EC2)
Install Python3 and Django on Amazon Linux (EC2) and run your web server
How to install OpenCV on Jetson Nano Python
How to quickly install h5py on Windows 10 [Unofficial]
How to install OpenGM on OSX with macports
[Python] How to install OpenCV on Anaconda [Windows]
How to build Java environment on Ubuntu (Linux)
Jupyter Notebook Settings-How to use (EC2 Amazon Linux 2)
Install PHP 7 series on Amazon Linux 2 with Amazon Linux Extras
How to install / verify graphviz on anaconda / windows10
How to install Python
How to install pip
How to install archlinux