Amazon Linux 2023 に Maven をインストールする手順。
インストール
$ curl -L -O https://dlcdn.apache.org/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz $ tar xvfz apache-maven-3.9.4-bin.tar.gz
設定
- ~/.bashrc に以下を追記
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64 export PATH=$PATH:/home/ec2-user/apache-maven-3.9.4/bin
- 追記した環境変数を設定する
$ source ~/.bashrc
確認
$ mvn -v Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9) Maven home: /home/ec2-user/apache-maven-3.9.4 Java version: 1.8.0_382, vendor: Amazon.com Inc., runtime: /usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64/jre Default locale: en, platform encoding: UTF-8 OS name: "linux", version: "6.1.49-69.116.amzn2023.x86_64", arch: "amd64", family: "unix"