Installing Oracle Java on Ubuntu x64 (Using an NFS Share)

Download the Oracle JDK GZ that you wish to install on your target Ubuntu x64 Clients.

Save the GZ on a network file share (NFS) that is accessible by the Ubuntu x64 Clients

In our example we are using a share on a Network Attached Storage Device IP Address public folder name is called Apps it uses the same username and password as used in our windows Authentication to access the share

**Please Note - you must run the commands silent with no output or user prompts

Script - Install JDK x64 (NFS Share)

Create the following script using a text editor on Linux or using or with Notepad++ (with EOL Conversion set to Unix) and save it to the shared apps folder on the windows server

In our example we are using the following to access the share:

The NFS share has been given access to all for Read capabilities

path = \\\apps\Ubuntu\

In our example we are using the following for the ubuntu user password to run as sudo:

Ubuntu user password = 12345678


echo 12345678 | sudo -S apt-get purge openjdk-\*

echo 12345678 | sudo -S mkdir -p /usr/local/java

echo 12345678 | sudo -S smbget -n -q smb://

echo 12345678 | sudo -S cp -r jdk-8u77-linux-x64.gz /usr/local/java

cd /usr/local/java

echo 12345678 | sudo -S chmod a+x jdk-8u77-linux-x64.gz

echo 12345678 | sudo -S tar zxvf jdk-8u77-linux-x64.gz > /dev/null

echo 12345678 | sudo -S update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_77/bin/java" 1

echo 12345678 | sudo -S update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_77/bin/javaws" 1

echo 12345678 | sudo -S update-alternatives --set java /usr/local/java/jdk1.8.0_77/bin/java

echo 12345678 | sudo -S update-alternatives --set javaws /usr/local/java/jdk1.8.0_77/bin/javaws

cd $home

echo 12345678 | sudo -S rm -f jdk-8u77-linux-x64.gz

**Please Note your script must be saved as .sh

**Please Note - This will only work on Ubuntu 64bit

Create Third Party Template

Now create a Third Party Template to run the script

Give the template a name, select Linux, choose the Authentication Template that contains the username and password for both Windows App share file access the root level user on the Linux target system

Click find files to select your script, press Add and the check the Copy check box.