개요

centos 서버에 jdk8 설정하는 방법을 정리하여 포스팅한다.

jdk 바이너리 받기

$ cd /opt
$ wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"

jdk 설정

cd /opt/jdk1.8.0_131/
# alternatives --install /usr/bin/java java /opt/jdk1.8.0_131/bin/java 2
# alternatives --config java

환경변수 등록하기

export JAVA_HOME=/opt/jdk1.8.0_131
export PATH=$PATH:/opt/jdk1.8.0_131/bin