Simple VirtualBox Set-Up for Linux Server Fun: Part 2

In part 1 we created a Virtual Machine (VM) for Ubuntu Server:

We are ready to install Ubuntu Server to this VM. First, click the ‘Run…’ button with the green arrow at the top of the list of virtual machines. VirtualBox has a ‘First Start Wizard’ that will ask you to select installation media. Use this to select the ISO file you downloaded from the Ubuntu Server download page. Once selected, VirtualBox will load the ISO and boot to it as if it were a real computer booting from an actual CD.

The next screen it displays will be a list of languages to choose from. These are only the languages used by the Ubuntu Server ISO / CD menu. I picked English.

We are taken to a “pre-boot” environment where we can choose to install Ubuntu Server, and where advanced users can choose to boot Ubuntu into using kernel boot arguments. For this guide, just select Install Ubuntu Server.

Seems redundant, but I tell the installer program itself to use English.

Tell the installer that it’s located in the United States.

Do not have the installer detect your keyboard layout. The detection program seems like a good idea but really it takes extra time and won’t always detect the right keyboard. I choose no at this stage.

Tell the installer that the keyboard’s origin is the USA.

Select the keyboard. USA is conveniently the default.

The installer will present a screen with a progress bar. It will start probing the hardware in your computer to find the installation CD, load additional components for the installer, and detect your network hardware. Most home users have a router that uses DHCP to automagically assign IPs behind the scenes. Under the VirtualBox defaults, the installer will automatically setup your networking by communicating with your VirtualBox’s NAT DHCP server behind the scenes. All this takes just a minute.

Select the hostname for the Ubuntu Server we’re installing. The hostname I chose was ‘machine2’:

The Ubuntu Server installer will now try to establish the system clock behind the scenes. For most systems, this means connecting to some networked time server. Once it is finished, it will ask you if the correct time was chosen. Usually this works without a hitch. No need to adjust anything here.

The installer will now try to detect all your disks by quickly scanning the computer, or in our case, our VM.

Once this is done, the partitioner will start up. Read up on partitioning if you don’t know what it is. In a nutshell, it allows you to divide your physical hard drive into different logical drives. You’ll be presented with some options for default partitioning schemes. The installer preselects ‘Guided – set up LVM and use entire disk’ but I’ve chosen ‘Guided – use entire disk’. LVM means Logical Volume Manager and it allows Linux to do very cool things with your hard drive space, especially if you have multiple hard drives and partitions. It is absolutely worth tinkering with another time. Since this is a simple VM, we don’t need the extra overhead of Logical Volume Manager.

Select the single disk we created through VirtualBox’s Virtual Machine Creation Wizard.

Review the changes we want to make to the disk. Select Yes to continue the installation.

The Ubuntu Server installer will start writing the partitioning changes to the disk.

Next it will install the base system.

After installing the base system, you will be asked to provide a name. This is really arbitrary, but its intended that a real name goes here. I chose ‘muser1’.

Create a username. Here I chose ‘umachine2’.

Create a password.

Re-type the password. Don’t mess up!

With the base system installed and a user set up, the Ubuntu Server installer is almost ready to start installing additional packages.

Before installing user programs that may make use of umachine2’s home directory, the installer asks if the home directory should be encrypted. For anyone who doesn’t know what that it, think of it as a ‘User’ folder like in windows. Its designed to hold most of your personal stuff. I don’t need home directories to be encrypted. Encryption and de-encryption of the home directory adds a little extra overhead the VM doesn’t need. I choose no.

The installer asks for HTTP Proxy information in case it needs a Proxy to access the internet. I don’t use an HTTP proxy.

Ubuntu will always ask whether the system administrator wants manual updating, automatic updating, or automatic updating for important security updates. Ubuntu Server can also have it’s updates and more managed via Landscape, Cannonical’s enterprise-class Ubuntu Managment service. I keep it simple and turn off automatic updating.

The APT package manager used by Ubuntu, Debian, and their variants, makes it very easy to do a system update. APT is also the primary tool to install any software on Ubuntu systems. Ubuntu Server comes with Aptitude in addition to APT, a terminal-based GUI for APT. The next screen in the installer is a little like Aptitude in that we can select from a list some common software packages, some of which are combinations of multiple packages. I choose only the OpenSSH Server package because OpenSSH is the best way to login remotely to a linux machine, as I’ll show in part 3.

The installer will use APT behind the scenes to download the OpenSSH Server packages from remote package servers. After downloading, it will install the packages.

When package installation is completed, the installer is almost done. Before we can start using the system, the installer needs to install a bootloader to our hard drive. A bootloader sits at the beginning of your hard drive and is the first thing on virtual disk image the VM will run at boot. When the bootloader is run, it will assist the system in loading the proper linux kernel and the rest of the system we’re installing.

Yes, we want to install the GRUB bootloader. GRUB is a default bootloader for most Linux systems. Cool thing about GRUB is that it enables you to boot into different OSes like Windows and other Linux versions.

The installer will then finish the installation and finally complete.

Continue to reboot into the new system.

Does reboot…

Reboot happens. Now enter in a username and password.

Ta-Da! A shell prompt;

What to do next? See the final steps I take with my VMs in the next post in this series, part 3.

Simple VirtualBox Set-Up for Linux Server Fun: Part 1

In this part of Simple VirtualBox Set-Up for Linux Server Fun, I’ll detail the step-by-step process of creating a virtual machine in VirtualBox.

Step 1: Download VirtbualBox and Ubuntu Server

Visit the VirtualBox download page to download the latest VirtualBox. Also, get the Extension Pack for VirtualBox.

There are a few options for downloading Ubuntu Server. Canonical keeps all versions of Ubuntu in a nice releases site you can easily navigate. From there, you can download any version using a few protocols including FTP and BitTorrent. If you have unreliable internet like I do, the most reliable way to download is via BitTorrent. Transmission is a good BitTtorrent client for Mac. uTorrent is also a good client that will run on Windows.

Step 2: Install VirtualBox

Sun made the VirtualBox installation a straight-forward process for every platform. Notice I said Sun instead of Oracle? VirtualBox was created by Sun Microsystems first, then Sun Microsystems was bought by Oracle Corporation. Its worth noting that much of Oracle’s good software was originally made by Sun.

Each download of VirtualBox comes with a User Manual full of useful information. In addition to instructions on how to use the VirtualBox GUI (Graphical User Interface), instructions on the CLI (Command Line Interface) are also in the User Manual. The CLI for VirtualBox offers some very advanced features beyond the scope of this simple guide. The User Manual is a great place to go to learn more about virtualization. It can also be found online.

Step 3: Create a Virtual Machine

The VirtualBox GUI has a Virtual Machine creation wizard. It will walk you through the basic components of a virtual machine. First, we select an OS. Conveniently, VirtualBox allows us to select Linux / Ubuntu 64 bit as an OS. I’ve chosen to name mine ‘Machine2’.

Next, we select the amount to RAM to allocate to the VM. Stand-alone linux doesn’t use much RAM to begin with, and since a server has no GUI, this VM will use even less RAM. Some installations can run with as little as 256MB. I’ve given this installation 512MB:

Opt to create a new Virtual Hard Disk.

VirtualBox supports several formats. The default is Virtual Disk Image (VD) and is the best choice for most VirtualBox VMs because of it’s native support.

Now we choose how the Virtual Disk Image is stored on the hard drive. A Fixed Size means the 8GB chosen for the virtual machine will immediately use 8GB of precious hard drive space. Dynamically-Allocated means that the 8GB of storage space won’t be used immediately by the Virtual Machine, but instead be used efficiently on an as-needed basis. Dynamically-Allocated is what I’ve chosen.

Choose the size and location of the virtual hard disk. Being able to choose the location of the virtual hard disk is a really nice feature offered by the VirtualBox GUI. Particularly, it allows those of us using small SSDs to offload big virtual disk images to a storage HDD. I’ve chosen to have this Virtual Disk Image installed to the default location:

At this point, everything is finished. Go to part 2 and install the Ubuntu Server.

Simple VirtualBox Set Up for Linux Server Fun Intro

I use VirtualBox to experiment with Linux all the time and yesterday I realized that I’ve set up Linux VMs on VirtualBox a dozen or so times by now. Each install involves a bit of googling around to remember how to do some routine tasks. I thought it might be more efficient to have all the documentation I need in one place, saving tab space on my browser. So why not place it here where others can see it?

Thus, I bring you the Simple VirtualBox Set-Up for Linux Server Fun three part series.

  1. In Part 1, noobs will learn how to create their own Virtual Machines using the VirtualBox GUI.
  2. In Part 2, linux novices will discover how to install Ubuntu Server into a VirtualBox VM.
  3. In Part 3, I’ll show some ways to get more out of your new Ubuntu Server VM.

Ubuntu Server and VirtualBox are the same from platform to platform so the concepts in this series should be helpful to most recent and future VirtualBox setups with a Ubuntu Server guest. Specifically, I’ll use Ubuntu Server 10.04.3 LTS 64bit, the virtualization host will be OS X Mointain Lion 10.8, and the version of VirtualBox is 4.2.1.

So stay tuned! I’m aiming to get all three parts done by tomorrow, Monday, October 8, 2012.