본문 바로가기

퍼블릭 클라우드

[draft] EC2 인스턴스에 Java를 설치하는 방법

728x90

EC2 인스턴스에 Java를 설치하는 방법

sdkman 설치

sdkman을 설치해야 합니다.

curl -s "https://get.sdkman.io" | bash

sdkman_io


Looking for a previous installation of SDKMAN...
Looking for unzip...
Looking for zip...
Looking for curl...
Looking for sed...
Installing SDKMAN scripts...
Create distribution directories...
Getting available candidates...
Prime the config file...
Installing script cli archive...
* Downloading...
######################################################################## 100.0%
* Checking archive integrity...
* Extracting archive...
* Copying archive contents...
* Cleaning up...

* Downloading...
######################################################################## 100.0%
* Checking archive integrity...
* Extracting archive...
* Copying archive contents...
* Cleaning up...

Set version to 5.16.0 ...
Set native version to 0.0.15 ...
Attempt update of interactive bash profile on regular UNIX...
Added sdkman init snippet to /root/.bashrc
Attempt update of zsh profile...
Updated existing /root/.zshrc



All done!


You are subscribed to the STABLE channel.

Please open a new terminal, or run the following in the existing one:

    source "/root/.sdkman/bin/sdkman-init.sh"

Then issue the following command:

    sdk help

Enjoy!!!

새 터미널 세션 시작

  • sdkman이 설치되었으면, 새로운 터미널 세션을 시작하거나 다음 명령어를 실행하여 sdkman이 현재 쉘 세션에서 사용할 수 있도록 활성화합니다.
source "/root/.sdkman/bin/sdkman-init.sh"

또는

source "$HOME/.sdkman/bin/sdkman-init.sh"

sdk 버전 확인

sdk version
$ sdk version
==== BROADCAST =================================================================
* 2022-12-20: vertx 4.3.7 available on SDKMAN!
* 2022-12-20: quarkus 2.13.6.Final available on SDKMAN! https://github.com/quarkusio/quarkus/releases/tag/2.13.6.Final
* 2022-12-20: micronaut 3.7.5 available on SDKMAN!
================================================================================

SDKMAN 5.16.0

java 설치(jdk 배포판 설치)

sdk list java

sdk_list_java

sdk install java 19.0.1-amzn
$ sdk install java 19.0.1-amzn

Downloading: java 19.0.1-amzn

In progress...

###################################################################################### 100.0%

Repackaging Java 19.0.1-amzn...

Done repackaging...

Installing: java 19.0.1-amzn
Done installing!


Setting java 19.0.1-amzn as default.

java 버전 확인

java -version

 

EC2 인스턴스에 Java가 성공적으로 설치되었습니다. 필요한 경우 Java 환경을 구성하고 Java 기반의 애플리케이션을 실행할 수 있습니다.

 

참고 URL

- sdk 설치 : https://sdkman.io/install

- jdk 배포판 : https://sdkman.io/jdks

 

728x90