리눅스 CentOS - JAVA 설치 및 설정

CentOS 7 리눅스에 java를 설치하는 방법입니다.



설치 리눅스는 CentOS 7 (Linux 3.10.0-514.26.2.el7.x86_64)

자바는 java8 입니다.



64비트용 java 8 다운로드

# cd /usr/local/src
# 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/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz"

# tar xzf jdk-8u144-linux-x64.tar.gz


32비트용 java 8 다운로드

# cd /usr/local/src
# 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/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-i586.tar.gz"

# tar xzf jdk-8u144-linux-i586.tar.gz


Install Java with Alternatives

# mv jdk1.8.0_144 /usr/local/
# cd /usr/local/jdk1.8.0_144/
# alternatives --install /usr/bin/java java /usr/local/jdk1.8.0_144/bin/java 2
# alternatives --config java



# alternatives --install /usr/bin/jar jar /usr/local/jdk1.8.0_144/bin/jar 2
# alternatives --install /usr/bin/javac javac /usr/local/jdk1.8.0_144/bin/javac 2
# alternatives --set jar /usr/local/jdk1.8.0_144/bin/jar
# alternatives --set javac /usr/local/jdk1.8.0_144/bin/javac




Configuring Environment Variables

# vi /etc/profile

맨 아래 추가

export JAVA_HOME=/usr/local/jdk1.8.0_144
export JRE_HOME=/usr/local/jdk1.8.0_144/jre
export PATH=$PATH:/usr/local/jdk1.8.0_144/bin:/usr/local/jdk1.8.0_121/jre/bin




Java 정상 설치여부 확인

# java -version

아래와 같이 표시되면 잘 설치 된 것임



자바 설치 끝~

Comments 0