Setting Up a Solaris Lab – VirtualBox

Virtual Environments provide an excellent “sandbox” for you to try out and get some real hands on experience with Oracle Solaris™ (x86).    I’ve run Oracle Solaris (x86) in both VirtualBox™ and VMware™, but I prefer VirtualBox.   After installing your Virtual Machine, you can add and clone additional Virtual Machines and start up more than one at a time to simulate a network of Solaris systems.  I tell my students to setup a local lab to practice everything they’ve learned in class.   For those who are using my book, setup a lab on your PC to follow the examples in my book.  If you are fortunate to have a SPARC server, you can download Solaris for that too.

You may download and install Solaris 10 or 11 for free.  It’s perfectly legal, but read the Oracle agreement and terms of use.

These instructions detail how to download and setup VirtualBox on an x86/AMD desktop or laptop.  VirtualBox does not run on the SPARC platform.  VirtualBox runs on everything that I’ve ever tried it on, so the hardware requirements are easily met.  The only problem I’ve run into is loading VirtualBox on another Virtual machine.  The website has good documentation and enough people use this product, so that any problem you encounter, is probably addressed there.


There are two methods of installing Solaris as a Virtual Machine in VirtualBox.

1)      Install Solaris 10 or 11 from scratch using the Solaris media (allows customization)
This method is the same as installing Solaris on a x86 server.

2)      Install Solaris 10 or 11 using a prebuilt appliance or virtual machine (easiest)
This method is easiest for first time users, but does not allow customization.

I describe both methods in this post.

VirtualBox is a free program and can be downloaded from   

VirtualBox can be installed on Windows, OS X, Linux and a Solaris (x86) host.  On the above website, click on the link for your host operating system, download and install Oracle VirtualBox using all of the defaults.

Before following the steps below, download and install VirtualBox onto a desktop or laptop.


Option 1 – Installing using the Solaris Media

After installing Virtual Box on your PC, download the Full DVD (ISO image) – Oracle Solaris 10 (x86) from Oracle (approx 2.1 GB download)

Download the Full DVD ISO Image for x86 (not SPARC).

Download Solaris 11 from this URL:
You’ll see several downloads listed, for beginners, I recommend the “Oracle Solaris Live Media for x86.”

Note: You will be using the x86 version of Solaris, not the SPARC version, so make sure you download the correct installation media.

If prompted for a login and password, signup for a free Oracle account.

1. After downloading the installation media, Install and Start VirtualBox on your PC by clicking on the icon:



2. Click on the New icon (Hilighted):



The Welcome screen will appear.

3. Click on Next and the Create New Virtual Machine window will be displayed.  Click on Next.



4. Enter a name for your Solaris Virtual Machine, select the OS type and version (version does not need to be exact).  Click on Next.



5. Select the amount of RAM.  Keep in mind, Windows (the host system) will be using some of the RAM too.    Make sure you leave at least 1GB for the Windows host.  Click on Next.



6. Create a New Hard disk.  I recommend 16GB which is the default.  Click on Next.



7. The Virtual creation wizard screen is displayed, use the default (VDI) and click on Next.



8. The Virtual Disk Storage details screen is displayed.  Use the default, Dynamically Allocated.  This will save disk space on your host system.



The Virtual disk location and size screen will be displayed.   You can select where the Virtual Machine and its disks will be created.  Choose a location that has 3-4GB of free space.

The system will create a folder named “Virtual Box VMs.”  All of your virtual machines and disks will be stored here.

9. Click Next when ready to move onto the next screen.



10. A summary screen is displayed.  Review it and click on Create.



The new machine will now be listed in your VirtualBox Manager:



11. Highlight the machine and select Settings:



The Settings screen will be displayed as follows:



12. Click on Storage, then click on the DVD.   The DVD will be labeled “Empty.”  Then click on the Attributes section (see highlight) and select the location of the Solaris Full DVD ISO image that you downloaded earlier.  Then select OK.



The VirtualBox manager window will be displayed.   The Storage section (see highlight) should show the CD/DVD using the ISO image selected in the previous step.



13. Click on START and the installation will begin.  The following window will begin the Solaris Installation program:



When the installation is complete, the Virtual Machine will still have the DVD mounted to the ISO image and will boot to it and restart the installation process.  When this happens, you’ll see the Black GRUB menu displayed again as follows:



14. Click on Devices, then CD/DVD devices, then “Remove Disk from Virtual Drive.”

This will unmount the DVD ISO image from the CD/DVD.


15. Click on Machine, then RESET to restart from the Virtual Machine’s boot disk.



You’ll know that Solaris is installed and booting from the boot disk when it boots to the Blue GRUB menu as shown:



Option 2- Installing from an appliance

After downloading and installing Virtual Box on your PC, download the Solaris 11 appliance image from Oracle (approx 1.5GB download)

A list of prebuilt Solaris 11 virtual machines (appliances) are available here:


Scroll down and select  Oracle Solaris 11 VM for Oracle VM VirtualBox

Solaris 10 virtual machines are located at this URL:

Download and uncompress the files and remember where you put them for the next step.


1. Install and Start VirtualBox on your PC by clicking on the icon:



2. Click on FILE from the top toolbar, then IMPORT APPLIANCE from the pulldown menu and the following screen will open:



3. Select the location of the unzipped files (Appliance Image) that you downloaded and unzipped earlier:


4. Click OPEN

5. Click NEXT.  The Appliance Settings window will open.   On this screen, you can modify the appliance settings before importing (or leave everything as is).  You could change the amount of RAM allocated to the virtual machine or you could modify the location of the Virtual Disk Image.  Click on IMPORT when finished.


6. Click FINISH

The Virtual Machine will appear in the Oracle VM VirtualBox Manager window.  Highlight the machine and click on Start to start the machine up.


Install VirtualBox Additions Package

I recommend that you install the VirtualBox Additions package in the Solaris virtual machine.  This makes the mouse and graphics a little easier to work with. It also allows you to cut/paste from the virtual machine and also resize the VM window.

1. Login to the Solaris VM

2. Click on Devices from the top toolbar and select Install Guest Additions from the pulldown menu.
Note: If you are unable to get the mouse to move outside of the VM window, press the Right Control key on your keyboard to free up the mouse.



A window will open on the Solaris desktop.



3. Double click on the icon and click on the RUN button when the popup window opens:



4.  Click on icon and click on the RUN button when the popup window opens.  A window will open on the Solaris Desktop labelled, “Installing VirtualBox Additions.”


5. Press ENTER as prompted.   Reboot the VirtualMachine and the installation is complete.


Create a Snapshot of the VM

Before using the virtual machine to practice, I recommend creating a Snapshot of the Solaris VM.  Then, if you really mess up the Solaris system, you simply restore the VM snapshot and try again.  To create the snapshot, follow these staps:

1. Shutdown Solaris by typing init 5 at the command prompt in a terminal window:


2. When the machine is powered down (be patient and give it time to shutdown and power off), click on the Snapshots icon in the Oracle VM VirtualBox Manager window:



3.When the snapshot window opens, click on the Camera icon:



4. You’ll be prompted for a name, enter a name and description. I like to add a description for each snapshot so that I know when each was taken.  Snapshots can be taken at any point in time.  Use them as you attempt new things with Solaris.

Have fun and good luck.  As always, feel free to post questions or comments for others to learn from.



Recovering Root (/) on an x86-Based Solaris 10 System

This procedure describes how to recover the root file system on an x86-based Solaris 10 system from a ufsdump recovery tape (or file).

1. Replace and partition the disk if it has failed.
    Because the system cannot be booted from the boot disk, boot from the DVD or CD-ROM.

2. The system begins its boot process from the Solaris miniroot on DVD (or CD-ROM). The following list of boot choices is displayed:

  1. Solaris Interactive (default)
  2. Custom JumpStart
  3. Solaris Interactive Text (Desktop Session)
  4. Solaris Interactive Text (Console Session)
  5. Apply driver updates
  6. Single user shell
    Enter the number of your choice:

3. Select boot choice 6, the single user shell. If an instance of Solaris is found on the disk, the system asks if you want to mount it on /a.  Answer n to avoid mounting an existing root file system.

4. Re-create the failed file system by issuing the newfs command:
   # newfs /dev/rdsk/<disk-partition-name>
<disk-partition-name> is the name of the raw disk partition that contains the corrupted root file system.

5. Check the new file system by using fsck:
   # fsck /dev/rdsk/<disk-partiton-name>

6. Mount the new file system on a temporary mount point:
   # mount /dev/dsk/<disk-partition-name> /mnt

7. Change to the /mnt directory:
   # cd /mnt

8. If using a tape, write-protect the tapes so that you don’t accidentally overwrite them.

9. Load the tape and issue the following command:
# ufsrestore rf /dev/rmt/0

The entire contents of the tape are restored to the file system. All permissions, ownerships, and dates remain as they were when the last incremental tape was created.

10. Verify that the file system is restored:
   # ls

11. Remove the restoresymtable file that is created and used by ufsrestore to checkpoint the restoration:
   # rm restoresymtable

12. Install the GRUB stage1 and stage2 programs on the Solaris partition. The installgrub command installs the GRUB stage1 program in sector 0 and the GRUB stage2 program beginning at sector 50. These sectors are within the reserved first cylinder  f the partition. Depending on the nature of the damage, they may not require reinstallation.

To install the stage1 and stage2 programs found in the miniroot from the Solaris DVD (or CDROM), use the following command:
   # /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/<disk-partition-name>

13. Change to the root (/) directory:
   # cd /

14. Unmount the newly created file system:
   # umount /mnt

 15. Check the new file system with fsck:
   # fsck /dev/rdsk/<disk-partition-name>
The restored file system is checked for consistency.

 16. Perform a full backup of the file system:
ufsdump ouf /dev/rmt/0 dev/rdsk/<disk-partition-name>

Note: You should always create a new backup of the newly created file system.  ufsrestore re-positions the files and changes the inode allocation.

If you have separate filesystems for /usr, /var, or /opt- repeat the steps (except for step 12)  for each of the filesystems.

17. Reboot the system, but first eject the DVD (or CD-ROM) to prevent the system from booting to it again:
    # init 6