Thursday, August 13, 2015

Creating a Tiny Core Linux virtual machine


Creating a Tiny Core Linux Virtual Machine in VirtualBox


Tiny Core Linux


Tiny Core Linux (TCL) is a very small Linux distribution.  I find it useful on older hardware and as a quick testing machine for virtual networks.  Let’s get a copy of TCL and create a virtual machine now shall we.  This tiny operating system makes it easy for us to get an idea of how VirtualBox works, and to introduce Linux to someone who has never used it.  It is different than any of the mainstream Linux distributions, but it is functional for our purposes.
/
Tiny Core Linux lives at http://distro.ibiblio.org/tinycorelinux/welcome.html and from there we can find the “downloads” link.  When we click on that, we will get the three versions to select from.  They are Core, TinyCore, and CorePlus.  I will be using CorePlus for this as I sometimes install this on laptops that use somewhat older wireless network adapters, and it just has more stuff without being huge.  The download is rather quick as the entire thing is actually tiny compared to most of the things we will download when we create our virtual network later.

A few words on ISO files


What we are currently downloading is a file ending with the extension “ISO”.  If you are not sure what an ISO file is, it is basically an image of a disk.  A while back, we would download ISO files, decompress and burn these images to a shiny CD or DVD using the “burn image” feature of certain CD and DVD burning software.  I would then use that to install an operating system on a physical computer.  Now we usually copy the ISO image contents to a bootable USB flash drive using various tools.  These tools make the USB flash drive bootable and they extract the ISO image onto the USB flash drive.  To be completely honest, I do still burn some ISO files on to shiny disks because I still have some older computers that do not boot from USB devices.  

There are a few different tools available for creating bootable USB flash drives, but I mostly use UNetbootin for Linux ISO files or Windows USB/DVD Tool from Microsoft when I am creating USB flash drives with versions of Windows.   As our goal is to create virtual machines, we just use VirtualBox to handle all of this.

Setting up the Virtual Machine


Now that we have our ISO, let’s create the virtual machine that it will run on.  This is the virtual version of a real machine.
Launch VirtualBox and click on the top left where it says “New”.  You will be presented with a box that wants you to enter some basic information.  If you start typing “TinyCore” into the name section, you will notice that the type and version automatically fill to “Linux” and “Oracle (64-bit)”.  If you have a 32-bit PC, then yours may default to version “Oracle (32-bit)”.  Press next after you have chosen your version and you will be taken to a screen where you decide how much RAM to dedicate to your new machine.  

The new virtual machine should have enough RAM to function properly without using too many system resources.  Mine defaults to 768 megabytes and that seems right for a quick install of Tiny Core Linux.

The next screen asks us to create a hard disk.  The default for my install is 12.00 GB and that works well for me as we are not going to put much on this virtual machine.  It can be less, but I would not go below 4.0 GB just to be safe.

The next step will ask us what sort of virtual disk we want to use.  I always use VDI disks, for no reason other than it is the default.  I have not looked into the other formats available, so I can’t comment on what would be best for what purpose.

The next screen asks if we want our disks dynamically allocated or a fixed size.  For this, I always choose to have the disk dynamically allocated.  Like the disk types, I just do this because it’s the default.  I do the same for the next screen that asks for a file location and a size.

We now have a virtual machine called “TinyCore” listed on the left of our VirtualBox window.  If you click to highlight this machine, and choose “Settings” in the window above, you will see other settings that you can look at.  We will be changing some of those later, but for now all the defaults should work properly.  

We can either double click the virtual machines name in the column, or click to highlight and press the green start arrow in VirtualBox and the virtual machine will begin its power up.  Luckily, VirtualBox will see that we have no operating system, and it will prompt us to insert a start-up disk.  This will be the Tiny Core ISO file that we downloaded earlier.
Click on the folder with the green upward arrow and browse to your “downloads” location so you can choose the tiny core ISO file.  After we select it, the virtual computer will boot off of that.  We are now running as if we have a physical computer, with a blank hard disk, running off of a CD.

After all of the text screens scroll by, choose the top option, “Boot Core Plus with default FLWS topside”.  Don’t worry about what this means yet.  When you either select this, or wait 60 seconds for it to select itself, you will be taken to the GUI (Graphical User Interface).

If you click in your virtual machine, your mouse will be “captured” and you will be able to move the cursor in Tiny Core.  To release your mouse and keyboard back to your windows PC, press the right “Ctrl” key on your keyboard.  This key can be changed if you need it, but I find the right “Ctrl” to work well.

Congratulations, you now have a fully functional machine within your other machine.  Now we need to stop running off the CD and install the operating system onto your virtual hard drive.  To do that in Tiny Core, click the small screw head in the bottom line of icons that says “TC_Install” when you hover over it.  This will begin the installer program.  Let’s go through the options quickly.

The menu that a show up has a few options, what we want is “Frugal”, “Whole Disk”, and “sda”, and “install boot loader”.  The next two screens, I just choose the defaults.  

The following screen will give you the option to install Wi-Fi, ndswrapper, and other things.  Even if you are on a laptop with Wi-Fi, or a desktop with Wi-Fi (like I am), you don’t want to choose these options because VirtualBox creates a virtual wired connection.  Therefore, whatever you install will think it’s on a wired network connection, not a wireless.  This virtual wired adapter goes through your computers existing connection to connect to the internet.  Therefore, so long as your physical machine has an internet connection, your virtual machine will have one as well.

Let’s look at this from the other direction.  Your windows PC will see the VirtualBox software as just another application that needs internet access.  Your windows PC will just give it access through its programming just as if it was Skype, OneNote , or any other application that uses the internet.  The VirtualBox program creates fake (or “virtual”) wired connections from your virtual machines out to the internet but does not tell windows what it is doing, and Windows thinks it’s just allowing another application to access the internet.   Just as I don’t have to configure wireless settings for every application that uses the internet, I don’t have to configure these settings for each virtual machine.

Let’s get back to the install.  There will be a review screen that pops up, and we want to make sure that we are using “Type: frugal”, “Target:sda”, “Format: ext4”, “ Options: Install X GUI”.  If these are your settings choose proceed, if not choose the back arrow and make the needed changes.

Installation should go rather fast, but there is no popup window that tells you it is done.  All we get is the last line of that window that says “Installation has completed”.  We can close this window and select the power button on the bottom row of icons.  We will get exit options, and we want to make sure “Shutdown” is selected and click “OK”.  This should power down our Tiny Core machine.

Now we must remove the virtual CD from the virtual machine.   To do this, left click on the Tiny Core machine listed in VirtualBox.  From there, choose “Settings”.  From there we want to choose “Storage” and select the drive that contains our ISO file (not the .VDI file as that is our virtual hard drive).  From there, we can click the picture of the shiny disk next to the “Optical Drive” box and choose the last option, “Remove Virtual Disk From Drive”.  This is exactly like it says, it is as though we physically removed a disk from a DVD ROM device.   Click OK when done.  We now have a virtual machine with Tiny Core hopefully properly installed on the hard disk, and no CD rom in the drive.

Now we can double click the Tiny Core computer to power on our virtual machine again.  

You should now have a virtual Tiny Core Linux machine running. Enjoy.

No comments:

Find an article