Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save strongant/7fdb01ec4a95bd6987e9c6bfe064ecc2 to your computer and use it in GitHub Desktop.
Save strongant/7fdb01ec4a95bd6987e9c6bfe064ecc2 to your computer and use it in GitHub Desktop.
How to Install Java 8 in CentOS / Amazon Linux?
# Remove java 7
sudo yum remove -y java

# Install basic packages
sudo yum install -y git

# Download and install java 8
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"
tar -xzvf jdk-8u131-linux-x64.tar.gz
rm -rf jdk-8u131-linux-x64.tar.gz

# Configure JAVA_HOME
sudo vim ~/.bashrc
alias cls='clear'

export JAVA_HOME=~/jdk1.8.0_131
export JRE_HOME=~/jdk1.8.0_131/jre
export PATH=$PATH:~/jdk1.8.0_131/bin:/~/jdk1.8.0_131/jre/bin
source ~/.bashrc 
java -version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment