Skip to content

Commit c2b84d6

Browse files
committed
The script
1 parent 295ee30 commit c2b84d6

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

install_java.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Install common stuff
2+
echo -e "\n\n Installing common stuff.."
3+
yum install -y iproute openssh-* initscripts vim wget curl
4+
5+
cd /opt
6+
7+
echo -e "\n\n Get Java and extract it... \n\n"
8+
# Get Java tar gz :
9+
wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz jdk-8u111-linux-x64.tar.gz
10+
11+
# extract it..
12+
tar -zxvf jdk-8u111-linux-x64.tar.gz
13+
14+
cd jdk1.8.0_111
15+
16+
# Alternatives install
17+
echo -e "\n\n Alternatives Setup..."
18+
alternatives --install /usr/bin/java java /opt/jdk1.8.0_111/bin/java 1
19+
alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_111/bin/jar 1
20+
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_111/bin/javac 1
21+
22+
alternatives --set jar /usr/bin/jar
23+
alternatives --set javac /usr/bin/javac
24+
25+
# Set environment variables, temporary and permanent
26+
echo -e "\n\n Setting up environment variables, temporary and permanent..."
27+
export JAVA_HOME=/opt/jdk1.8.0_111
28+
export JRE_HOME=/opt/jdk1.8.0_111/jre
29+
export PATH=$PATH:/opt/jdk1.8.0_111/bin:/opt/jdk1.8.0_111/jre/bin
30+
31+
echo "export JAVA_HOME=/opt/jdk1.8.0_111" >> /etc/environment
32+
echo "export JRE_HOME=/opt/jdk1.8.0_111/jre" >> /etc/environment
33+
echo "export PATH=\$PATH:/opt/jdk1.8.0_111/bin:/opt/jdk1.8.0_111/jre/bin" >> /etc/environment
34+
35+
# Show stuff
36+
echo -e "\n\n Java Version:"
37+
java -version
38+
39+
echo -e "\n\n Javac Version:"
40+
javac -version

0 commit comments

Comments
 (0)