Create a Bootable USB Java Development Machine With Puppy Linux

Without hurting your existing Netbook operating system

(Something you cannot do with an iPad)

Motivation

You can carry a complete Linux Java development environment around on a USB stick or SD card; all you need to run it is any Intel computer that can boot from that USB stick or SD card.  The host computer supplies only the CPU, RAM, and network hardware.  The host computer hard disks do not even spin up.

Here is an 8 GB USB stick that I use to run Puppy Linux on my EEE PC netbook computer:

Puppy USB

Preparation

Obtain a 4 GB or larger USB stick or SD card.  Make sure you do not need any of its prior contents.  (Smaller storage devices will also work, but they leave less room for expansion of the writable portion of the file system.)

Insert the USB stick or SD card into a slot on your Windows workstation.  Note the drive letter assigned to the device in the Computer (or My Computer) window.

Download the Lucid Puppy Linux ISO image from here.  (Lucid Puppy is derived from Ubuntu Lucid Lynx 10.04 LTS)

ftp://distro.ibiblio.org/puppylinux/puppy-5.2.8/

Choose lupu-528.005.iso for the basic version with Gnome Office (AbiWord, Gnumeric, etc. http://www.brighthub.com/computing/linux/articles/22953.aspx) or choose lupulibre-528.005.iso for a version with the more advance Libre Office (http://www.libreoffice.org/).  The minor version number may differ.

Download the PenDriveLinux Universal USB Installer from here:

http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/

Run the Universal-USB-Installer-1.9.0.0.exe program (or whatever version you obtained).  Read and accept the license.

Universal USB Installer Setup

Scroll the Step 1 drop-down list about half-way down to the “—Puppy Linux Based –“ section and select “Lucid Puppy”.

Click the Step 2 Browse button and navigate to and select the lupu-528.005.iso or lupulibre-528.005.iso image.

Set the Step 3 drop-down list to the drive letter for your USB stick or SD card.  Put a check-mark into the Format X: Drive (Erases Content) check-box.

Click Create, confirm the “are you sure” dialog, and wait for the process to finish.

Universal USB Installer Complete

Click Close when the “Process is Complete!” message appears.

Open the USB stick or SD card (now labeled PENDRIVE) in a file explorer window.

Download git-1.7.9.6-i686.pet from here:

http://www.datafilehost.com/download-953dfcd2.html

Copy the downloaded *.pet file (Puppy Extra Treat) to root folder of your USB stick or SD card (X:\ or equivalent).  This will make it available for access once we boot into Puppy Linux.

First Boot on Host Computer

Eject the USB stick or SD card, and insert it into the computer you wish to use as a hardware host.  If that is the same computer you used to create the image, just leave it in the drive.

(Re)Boot the computer with the USB stick or SD card in place, and activate the BIOS Setup screen.  For my EEE PC 1000HD this requires pressing the F2 function key during the boot sequence.

In the BIOS SETUP UTILITY screen, use the Right-Arrow key to navigate to the Boot page then use the Down-Arrow to navigate to the Hard Disk Drives section.  Press the Enter key for the 1st Drive and select your USB stick or SD card device.  Press the F10 function key to Save and Exit, then press the Enter key to confirm Ok.  Let the machine complete its boot sequence.

BIOS USB Boot Setup

(If your machine boots into the normal Windows operating system, you may need to try a different USB slot.  If that doesn’t work you may need to use a different brand of USB stick or SD card.)

The Puppy Linux startup sequence should complete in just under 2 minutes.

Here is my Netbook computer running Puppy Linux.  Note that the bootable USB stick barely protrudes from the right side of the machine:

Netbook Running Puppy Linux

Training Your New Puppy

Since this is your first boot from an emulated read-only “Live CD” image, you do not yet have a writeable personal file system image.  The Personalize Settings dialog will appear.

Select your Country Settings (most likely just correct your Time Zone) and click OK.  You will be prompted for permission to restart the X-Server (graphics subsystem).  Click Yes.

The Puppy Video Wizard may appear in text mode.  Press the Enter key to activate the Probe option.  A set of screen size and color depth options will appear.  Use the Down-Arrow to change the color depth from 16 bits to 24 bits and then press the Enter key to indicate OK.  The graphics subsystem will reinitialize.

The Simple Network Setup dialog will appear.  Click the X icon in the upper right to close this dialog.  Instead, click the connect icon on the left side of the desktop screen, toward the bottom.  Click the graphic button next to Internet by wired or wireless LAN.

The Network Connection Wizard will appear.  Click the top button for Network Wizard.

The Puppy Network Wizard will appear.  Select eth0 if you have a network cable connected, or wlan0 if you are using “wi-fi”.  The rest of the network setup wizard should be self-evident.

Back in the main Puppy Network Wizard dialog, select Auto DHCP to complete the network setup.  When prompted to “keep this configuration for next boot” click Yes.

Click Done to close the main wizard, and click to save that wizard as the default network wizard when you are prompted.

Down at the bottom of your desktop screen, near the current time display, you will see a yellow warning triangle icon.  Click that icon to invoke the Firewallinstallshell. Press the Enter key to accept the “automagic” default firewall settings.  Press Enter again when the shell script completes and displays its feedback text.

Initializing Personal Storage

Now reboot the computer to activate the initialization of the personal storage writeable filesystem.  Click the Menu item at the lower left of the screen, select Shutdown and then select Reboot computer.

A series of text-based dialogs appear.  In the first, press the Enter key to select the SAVE option.

The next prompt should show your USB stick or SD card as the selected device, labeled sdb1 Filesystem: vfat (which is Linux speak for FAT32).  Press the Enter key to select OK.

Press Enter on the next prompt to accept the default filesystem of ext2.

The next screen prompts for a suffix to add to the filesystem image file name.  Enter a short text string like “java” or your initials, and then press the Enter key.

On the next prompt, press Enter to accept NORMAL (no encrypt.)

On the next prompt, press Enter to accept the default size of 512MB.  You will be able to expand this storage file later if it starts to get full.

On the last prompt, press Enter to accept YES, SAVE.  A file named lupusave-java.2fs will be written to the root of your USB stick or SD card.

Initial Exploration

After the machine reboots into Puppy, single-click the console icon at the top of the desktop (near the middle) to launch the ROXTerm console prompt window.

Type these two commands to see the mounted file-systems and their free space (in “human” readable notation) and the amount of RAM memory usage in bytes:

df -h
free

Type the following commands to navigate to the root of the USB stick or SD card container device and to see the contents of it:

cd /mnt/home
ls -alh

Creating a Swap File

Now we will create a swap file to allow some “elbow room” for Eclipse, which we will be downloading in a short while.  We will place the swap file on the USB stick or SD card; this is not the ideal location but it provides full portability.  It could also be placed on the actual hard-disk of the host computer at the root of the sda1 partition (C:\ in Windows) for more speed.  That will be left as an exercise for the reader.

To create a 1 GB swap file, use these commands in the ROXTerm console window.  Be patient during the dd command as it writes 1 GB worth of zeros to the image file:

cd /mnt/home
dd if=/dev/zero of=./puppy.swp bs=1024 count=1024k
ls –alh *.swp
mkswap ./puppy/swp
swapon /mnt/home/puppy.swp
free

To have this swapfile activated after each reboot, enter the following command to open a text editor for the startup script:

cd ~
pwd
geany /root/.etc/rc.d/rc.local

Add this line at the bottom of that file and save the file:

swapon /mnt/home/puppy.swp

Optional: Reboot the computer to persist the changes to your lupusave-java.2fs writable file-system and to test the boot script.  When back in Puppy, open the terminal console prompt and type this command to confirm the swap file is active:

free

Installing Git Revision Control Software Client

Single-click the sdb1 icon at the bottom of the desktop screen toward the left.  A file viewer window appears.  Single-click on the git-1.7.9.6-i686.pet file we place there when creating the USB stick or SD card image.  Click OK to confirm installation of the Git package then click OK again when it completes.

In a terminal console window type the following command to confirm that Git installed properly:

git --version

If this returns an error indicating the libcrypto shared object library version 1.0.0 cannot be loaded, you will need to define a symbolic link to the compatible 0.9.8 version of that library:

ln –s /usr/lib/libcrypto.so.0.9.8 /usr/lib/libcrypto.so.1.0.0
git --version

Installing Java Runtime Environment

Click the install icon at the top of the desktop screen toward the left.  Click the bottom button to run the Puppy Package Manager.

In the Puppy Package Manger type “jre” into the Find text box and click Go.  Single-click the jre-1.6.0-22 package in the result list to start installation.  Proceed thru the installation wizard.  (I found the ft.vcu.edu download source to be active.)

We only need the Java Runtime Environment (JRE) rather than the full Java Development Kit (JDK) since Eclipse will provide its own compiler.  (I received some dependency warnings about missing packages for mawt and odbc which I chose to ignore.)

Confirm that Java installed correctly by typing the following command in a ROXTerm window:

java -version

Installing a Chromium Browser

Next type “iron” into the Find text box and click Go.  Install the highest version number of the Iron browser, which is a Chromium browser using the same webkit engine as Google Chrome.

Close the Puppy Package Manager when done installing Iron.

Click the “planet Earth” icon next to the Menu at the lower left of the desktop screen.  Click on iron to make it your default web browser.  The browser will also launch.  To launch it in the future, click the browse icon on the left side of the desktop (another “planet Earth” icon).

Installing Eclipse

With the Iron browser open. type eclipse.org in the browser address bar.  Click Download Eclipse at the upper right of the web page.  On the Eclipse Downloads page select Linux 32-bit next to Eclipse IDE for Java EE Developers at the top of the page.  Select the suggested default mirror site.

Wait for the download to complete in the Iron browser.  Open the ~/Downloads folder either by telling Iron to open it, or using the file icon at the upper left of the desktop screen to open a file browser window and navigating down to the Downloads folder.

Single-click on the Eclipse *.tar.gz archive file to open the XArchive tool.  Select the Archive | Extract menu item and then click OK to confirm you want to extract the entire contents.  Change the suggested target directory from /root/Downloads to just /root and click OK.

Delete the Downloaded Eclipse Archive File

We will be running low on disk space in our writable personal storage “save file” so let’s delete the *.tar.gz archive file.  In a terminal console window:

df –h
cd /root/Downloads
ls –alh
rm eclipse*.gz
df -h

My system shows 244M free in my /dev/loop1 file system at this point.  If you feel you need more, you can resize the writable save file via menu | Utility | Resize personal storage file.  If you do choose to resize, a reboot will be required before the image file is actually increased in size.

Running Eclipse

Create an empty Eclipse workspace from a terminal console window:

cd ~
mkdir eclipse-ws

Click the file icon on the upper left of the desktop and navigate to the eclipse folder.  Drag the eclipse “gear” icon to a place anywhere on the desktop to create a shortcut link.  Single-click that desktop shortcut to launch Eclipse. When prompted for a workspace, type or browse to ~/eclipse-ws (which is also known as /root/eclipse-ws ).

Confirm your Eclipse functionality by creating a new Java project called HelloWorld with a single HelloWorld.java class with this statement in its “main” method:

System.out.println(“Hello, world!”);

Save and run the project and you should see that famous greeting in the Eclipse console output window.

You Can Take It With You

Shutdown your machine to ensure all your latest installations and changes are properly persisted to the personal storage file (lupusave-java.2fs).

You can now take your USB stick or SD card to any computer that can boot from USB and your complete Puppy Linux Java development environment, with Git and Eclipse, is there for your use.

Advertisements