-
Notifications
You must be signed in to change notification settings - Fork 0
/
installjava.sh
60 lines (40 loc) · 1.57 KB
/
installjava.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Install common stuff
echo -e "\n\n Installing figlet.."
yum install -y wget
cd /opt
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/f/figlet-2.2.5-9.el7.x86_64.rpm
rpm -ivh figlet-2.2.5-9.el7.x86_64.rpm
clear
figlet -f banner "Figlet Installed :)"
figlet -f small "Installing common utilities..."
sleep 1
yum install -y iproute openssh-* initscripts vim wget curl lynx telnet nc nmap less wget man
clear
figlet -f small "Get Java & Install"
sleep 1
# Get Java tar gz :
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
# extract it..
tar -zxvf jdk-8u111-linux-x64.tar.gz
cd jdk1.8.0_111
clear
figlet -f small "Java Alternatives Setup"
# Alternatives install
echo -e "\n\n Alternatives Setup..."
alternatives --install /usr/bin/java java /opt/jdk1.8.0_111/bin/java 1
alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_111/bin/jar 1
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_111/bin/javac 1
alternatives --set jar /usr/bin/jar
alternatives --set javac /usr/bin/javac
# Set environment variables, temporary and permanent
echo -e "\n\n Setting up environment variables, temporary and permanent..."
curl https://raw.githubusercontent.com/abhishekunotech/install_scripts/master/setJavaEnv.sh > setJavaEnv.sh
source setJavaEnv.sh
echo -e "TESTING JAVA HOME SET/UNSET inside installjava.sh"
echo $JAVA_HOME
figlet -f small "Done, all good? check"
# Show stuff
echo -e "\n\n Java Version:"
java -version
echo -e "\n\n Javac Version:"
javac -version