Thursday, July 19, 2018

Install Java in Tiny Core Linux 7

Tiny Core Linux does not come with a default java installation. To install java we need to create a .tcz file first. To do this I am using Tiny Core docker, but you can also use the same steps in a normal installation too.

Download the required JDK version from Oracle.  You need to download the Linux tar.gz file. (ex. jdk-8u181-linux-x64.tar.gz)

Pull the required docker image from https://github.com/tatsushid/docker-tinycore

docker pull tatsushid/tinycore:7.2-x86_64

Now run Tiny Core docker in privileged mode.

docker run -it --privileged tatsushid/tinycore:7.2-x86_64

To use scp to copy the downloaded file to Tiny Core Linux inside docker you need to install open ssh.

tce-load -wi openssh.tcz

Copy downloaded JDK tar.gz file to Tiny Core Linux. (Following command copy to the current folder. In my case it was /home/tc)

scp prasad@192.168.0.1:/Users/prasad/Downloads/jdk-8u181-linux-x64.tar.gz .

Install java-installer

tce-load -wi java-installer.tcz

Run java-installer in the same folder where JDK is copied.

sudo java-installer


Above message will be displayed. Since we already have jdk download in place, press enter to continue. (The message is bit misleading, even we already have the JDK file in place it ask to download).


Now java tcz files will be created in /usr/local/src/java
As shown in the message, now you can add jdk8.tcz to /etc/sysconfig/tcedir/onboot.lst and reboot to start using java.

IMPORTANT

It is possible you get the following error when running java: 

tc@box:~$ /usr/local/java/bin/java -version
-sh: /usr/local/java/bin/java: not found

To avoid this after startup run. (You will need to automate this appropriately)

ln -s /lib /lib64