A Guide to Virtualization on Mandriva Linux 2007 Spring
A Guide to Virtualization on Mandriva Linux 2007 Spring
Have you ever wished you had another computer handy? Maybe you want to try a new operating system out. Maybe you want to test something experimental without potentially breaking your own system. Maybe you need to run some software that only runs in a different operating system. Mandriva Linux 2007 Spring comes with a range of virtualization options that can help.
Virtualization can often be the best way to handle these situations. To put it simply, virtualization systems simulate a complete running PC in software. You can install an operating system to the virtual machine without it being aware it is really just running inside a program on your desktop. Virtualization systems emulate all the important hardware on a PC, including the processor, memory, disk drives, graphics card, sound card and monitor. The operating system you install on the virtual machine is the real deal, which means it will almost always work exactly the same way as it would on a real computer.
There are several virtualization systems available for Linux, all of which work a little differently and are good for different purposes. Let's take the simplest option first. Imagine you run Mandriva Linux 2007 Spring on your computer, but you need to test something out on another Linux distribution. For simply running one other operating system on your computer occasionally, or another copy of the same operating system for testing purposes, VirtualBox is the best option. VirtualBox is an easy-to-use graphical virtualization application, and it's quick and easy to set up and boot new VirtualBox machines.
Mandriva Linux 2007 Spring Discovery, Powerpack and Powerpack+ editions include VirtualBox on the DVD. Just use the Mandriva software installation tools to install the 'virtualbox' package. See this Mandriva Wiki page for instructions on installing packages. Mandriva Linux 2007 Spring One and Free editions do not include VirtualBox on the discs, but you can easily install it from the official Internet repositories. See this Mandriva wiki page for instructions on setting up the official repositories, then install the 'virtualbox' package as described above.
Once you have VirtualBox installed, you can run it from the system menus, under More Applications / Emulators. You will see the VirtualBox control panel. Right now, there won't be any virtual machines set up, so let's create one! Click on the New button. Click Next. Now enter a name for your new virtual machine. This can be anything you like: make it descriptive so you can recognize the machine later. Set the OS Type box to whichever type of operating system you intend to install on the virtual machine (for most modern Linux distributions you would choose Linux 2.6). Now click Next. Next you must set the amount of memory the virtual machine will have. This memory will be allocated from free memory on your computer, so don't set it any higher than the amount of free memory you have available, or the virtual machine will run very slowly. However, remember to set it higher than the minimum amount of memory required by the operating system you are installing. It's best to stick to an amount of memory that is a power of two, as found on real computers: 64MB, 128MB, 256MB and so on. Now click Next again. Now you must set up the hard disk for the virtual machine. On your real computer, this will simply be a single very big file. To create a new hard disk image file, click the New... button. Click Next. You can choose to use a dynamically expanding image (which will only be as large as the actual amount of data it contains, no matter how big you say the disk is) or a fixed-size image (which will be as big as the capacity of the disk, even if there is very little data stored on it). VirtualBox explains the benefits of each choice, so choose appropriately and click Next. Now you can set how big the disk will be and what the image file will be called. By clicking on the folder icon next to the image file name you can set where it will be stored (by default it is stored in a hidden folder in your home directory) - make sure you choose a location on a partition with enough free space to hold whatever size of disk you choose! Now click Next again, and click Finish. You'll be back at the hard disk configuration dialog, but the new image file you created will be listed. Click Next, and a summary of the settings you chose will be displayed. Click Finish, and your virtual machine is created!
It's not quite ready to be used yet, though. You might have noticed that we didn't set up a CD / DVD drive, so it won't have anything to boot from. Select your new virtual machine in the list in the main VirtualBox window and click the Settings button. Click CD/DVD-ROM and check the Mount CD/DVD Drive checkbox. You can choose to either use a real CD/DVD drive on your real computer, or use a .ISO disc image file which will be seen by the virtual machine as a real disc. In our example, we'll go with the second option. Make sure you have a .ISO image of the installer disc for the operating system you want to install on the virtual machine. Select ISO Image File and click the little folder icon at the right hand side. The Virtual Disk Manager window will open, with the CD/DVD Images tab selected. Click the Add button, then navigate to and select the .ISO image you want to use, and click Open. Back in the other window, click Select. The window will close and you'll see that the .ISO image you chose will be set to be the CD/DVD for the virtual machine.
You can also set sound and network options from this window, but you shouldn't need to change them for now, so click OK, and you'll be back at the main window. Now you can boot your new virtual machine! Select it from the list and click the Start button, and you will see a new window appear and a typical PC boot process begin. From now on, this window behaves just like a completely separate machine. The installer for the operating system you chose will boot up, and you will be able to go ahead and install it. For networking, set everything to auto-detect, and an internet connection will be available for the virtual machine. For the video card, use the framebuffer or VESA compatibility driver. Note that you can 'grab' the mouse pointer and keyboard into the VirtualBox window simply by clicking: now your mouse will control the pointer on the VirtualBox machine and the keyboard will type into the VirtualBox machine. To 'release' the pointer and let your mouse and keyboard control your real computer again, just press the right-hand side Control key on your keyboard.
There is much more to VirtualBox than explained in this starter guide. For help with its more advanced options and features, take a look at the documentation on the official site.
Besides VirtualBox, Mandriva Linux 2007 Spring includes some other virtualization options.
Xen is a virtualization system aimed less at the desktop user and more at server-level virtualization. Using Xen requires installing two special kernel packages - one to be booted on the host machine, the other to be used in the guest machines - and the creation of disk images for the clients. Mandriva Linux 2007 Spring includes a tool named drakvirt which can help configure and manage Xen guests. drakvirt is included in the Powerpack and Powerpack+ editions of Mandriva Linux 2007 Spring, and available from the official Internet repositories for other editions. See the start of the VirtualBox section for instructions on installing packages.
VMware is a commercial virtualization provider which provides many different systems that cover the whole range of virtualization requirements. Mandriva Linux 2007 Spring Powerpack and Powerpack+ editions include the VMware Player, a simple application which allows you to 'play' - run - virtual machines created by other people using the more advanced VMware products. Due to VMware's popularity within the industry, many of these 'virtual appliances' are available, ranging from full installations of many Linux distributions to very specialized packages designed for a single purpose, such as a pre-built package of a streamlined Linux distribution with a web server stack running a particular web application. To install VMware Player, simply use the Mandriva Linux software installation tools to install the VMwarePlayer package. To find virtual machines to run on it, take a look at the VMware Virtual Appliance Marketplace.
qemu is a long-standing Linux virtualization application which is very flexible and powerful. To try out qemu quickly and easily, use the Mandriva Linux software installation tools to install the 'qemu' package. From a console, run this command to create a hard disk image:
qemu-img create disk.img 4G
4G specifies the size, 4GB. You can change it as appropriate. Now run the following command:
qemu -cdrom image.iso -boot d disk.img
change 'image.iso' to the name of a .ISO image of an operating system installation disc. This tells qemu to use image.iso as the CD/DVD drive, boot from the CD/DVD, and use disk.img as the primary hard disk. The virtual machine will boot into the operating system installation routine. To learn more about using qemu, see the official documentation.
You can buy Mandriva Linux 2007 Spring Discovery, Powerpack and Powerpack+ editions from the Mandriva Store. Members of the Mandriva Club can download commercial editions of Mandriva Linux 2007 Spring as part of their membership privileges: join the Mandriva Club here. The Mandriva Linux 2007 Spring Free and Mandriva Linux 2007 Spring One editions are available for free download from the Mandriva Linux download page.