# Connect to your server as root via SSH
ssh root@your.server
# Install dependency
apt-get install curl wget -y
# Download installation script
curl -O https://gist.githubusercontent.com/gomin1d/12beb5009bd9c3c559176008daa688c6/raw/java-install.sh
# Run it
bash java-install.sh
# Apply environment variables without reopening an SSH session
source /etc/profile.d/java.sh
Last active
April 1, 2023 17:00
-
-
Save gomin1d/12beb5009bd9c3c559176008daa688c6 to your computer and use it in GitHub Desktop.
Installing oracle java on linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MACHINE_TYPE=`uname -m` | |
if [ ${MACHINE_TYPE} == 'x86_64' ]; then | |
JAVA_DOWNLOAD_URL="https://www.dropbox.com/s/raw/ccn5w29df56lamf/jre-8u221-linux-x64.tar.gz" | |
else | |
JAVA_DOWNLOAD_URL="https://www.dropbox.com/s/raw/c71p18q10tz5soi/jre-8u221-linux-i586.tar.gz" | |
fi | |
wget -O jre.tar.gz ${JAVA_DOWNLOAD_URL} | |
mkdir -p /usr/java | |
tar -xzvf jre.tar.gz -C /usr/java | |
rm jre.tar.gz | |
echo -e "JAVA_HOME=`ls -d /usr/java/* | grep jre | head -1`\nPATH=\$PATH:\$HOME/bin:\$JAVA_HOME/bin\nexport JAVA_HOME\nexport PATH" > /etc/profile.d/java.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment