Install java 1.8.0 on Amazon linux2

I would like to install java on an Amazon linux2 EC2 instance.

After launching and executing sudo yum update, check if java is included

[ec2-user@ip-10-0-0-127 ~]$ java -version
-bash: java: command not found

I don't think it's in

Find java

[ec2-user@ip-10-0-0-127 ~]$ sudo yum search java
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
============================== N/S matched: java ===============================
aether-javadoc.noarch : Java API documentation for Aether
ant-antunit-javadoc.noarch : Javadoc for ant-antunit
ant-contrib-javadoc.noarch : Javadoc for ant-contrib
ant-javadoc.noarch : Javadoc for ant
ant-javamail.noarch : Optional javamail tasks for ant
antlr-javadoc.noarch : Javadoc for antlr
aopalliance-javadoc.noarch : API documentation for Java/J2EE AOP standards
apache-commons-beanutils-javadoc.noarch : Javadoc for apache-commons-beanutils
apache-commons-cli-javadoc.noarch : Javadoc for apache-commons-cli
apache-commons-collections-javadoc.noarch : Javadoc for
                                          : apache-commons-collections
apache-commons-collections-testframework-javadoc.noarch : Javadoc for
                                                        : apache-commons-collections-testframework
apache-commons-dbcp-javadoc.noarch : Javadoc for apache-commons-dbcp
apache-commons-exec-javadoc.noarch : Javadocs for apache-commons-exec
apache-commons-jexl-javadoc.noarch : Javadocs for apache-commons-jexl
apache-commons-pool-javadoc.noarch : Javadoc for apache-commons-pool
apache-commons-validator-javadoc.noarch : Javadoc for apache-commons-validator
apache-commons-vfs-javadoc.noarch : Javadoc for apache-commons-vfs
apache-rat-javadoc.noarch : Javadocs for apache-rat
aqute-bnd-javadoc.noarch : Javadoc for aqute-bnd
aqute-bndlib-javadoc.noarch : Javadoc for aqute-bndlib....

Select and install JRE or JDK (including development commands such as javac) according to your requirements

# JDK1.8.Install 0
$ sudo yum install -y java-1.8.0-openjdk-devel.x86_64

Enable Java 8

[ec2-user@ip-10-0-0-127 ~]$ sudo alternatives --config java

There is 1 program that provides 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-0.amzn2.x86_64/jre/bin/java)

Enter to keep the current selection[+], or type selection number: 1
[ec2-user@ip-10-0-0-127 ~]$ java -version
openjdk version "1.8.0_201"
OpenJDK Runtime Environment (build 1.8.0_201-b09)
OpenJDK 64-Bit Server VM (build 25.201-b09, mixed mode)

The end

Reference source https://www.yoheim.net/blog.php?q=20180101

Recommended Posts

Install java 1.8.0 on Amazon linux2
Install rbenv on Amazon Linux
Install Java on Mac
[Java] Install Amazon Corretto 8
How to install kafkacat on Amazon Linux2
Try to build Java8 environment on Amazon Linux2
Install OpenJDK7 (JAVA) on ubuntu 14.04
Downgrade Java on openSUSE Linux
Install Java on WSL Ubuntu 18.04
Install Java 8 (OpenJDK: Amazon Corretto) on macOS with Homebrew
Install Java with zip on Windows
Install Java Open JDK 8 on CentOS 7
Install Java 9 on windows 10 and CentOS 7
Install Java development environment on Mac
Run R from a tomcat-powered Java process on Amazon Linux
Install OpenJDK (Java) on the latest Ubuntu
Install java and android-sdk on Mac using homebrew
Install Java 11 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew
Install Java 8 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew
Install java with Homebrew
Install gradle on mac
Let's touch on Java
Install Corretto 8 on Windows
Install OpenJDK on macOS
Install Java with Ansible
Install Golang on CentOS 8
Install pyqt5 on ubuntu
Install Neo4j 4.1.3 on centOS
Run PostgreSQL on Java
Install Docker on Manjaro
Install Vertica 10.0 on CentOS 6.10
Install Ruby on Ubuntu 20.04
Install PostgreSQL 12 on Centos8
Install lombok on SpringToolSuite4
Install Python 3 on CentOS 7
Install kuromoji on CentOS7
Install Autoware on Ubuntu 18.04.5
Install Mattermost on CentOS 7
Install PostGIS 2.5.5 on CentOS7
Install jpndistrict on CentOS 7
Install openjdk11 on mac
Install Homebrew on Ubuntu 20.04
Install Redmine 4.1.1 on CentOS 7
Install OpenJDK 8 on mac
Smokeping Install on CentOS7
Install PostgreSQL 13 on CentOS 7.5
Java development environment construction on Mac-JDK Install (2020 preservation version)
Install java and maven using brew on new mac
Install Java 8 (OpenJDK: Zulu Community) on macOS with Homebrew
Java version control on macOS
Install Docker on Raspberry Pi
Install Docker on Windows 10 PRO
Install Cybozu Office 10 on Ubuntu 20.4
Install Java 7 with Homebrew (cask)
Install Sidekiq pro on Rails
Reflection on Java string manipulation
On passing Java Gold SE 8
Oracle Java 8 on Docker Ubuntu
Install zabbix agent (5.0) on Ubuntu 18.04
Install MAV Proxy on Ubuntu 18.04
Install tomcat on Sakura's VPS