Tuesday, July 10, 2012

How-To Set Up VirtualBox in openSUSE 12.1


 
  Recently I needed to do a new install of VirtualBox on my openSUSE 12.1 desktop. I usually only do this when I get in the mood to test new operating systems or I need a version of Windows for something specific that Linux isn’t suited for. I used to keep a copy installed by default, but lately I have been more resourceful in getting things done without Windows. This just happened to be one of those times when I had a new OS that I had never experienced before and I needed a platform to try it out on (the story on that later).

 I know that a lot of people still aren’t familiar with virtualization or how to set one up or what they would even want one for. There are also a lot of relatively new Linux users that still do the dual-boot system on their computers running Windows next to Linux and choose which system to run on start. When I started using Linux back in 2009, I did the very same thing so I could continue to be productive in my old ways while learning to accept change and migrate over to a Linux OS. Whatever the reasoning, often times Linux users still end up needing a copy of Windows for some reason or another now and again however, as each new release of the various Linux distributions improve in user interface, operation, and efficiency, I’m seeing less and less dependencies on the old Microsoft build.

 The dual boot system works fine for those who insist on having their OS have direct control to the hardware and network. The problem lies in the fact that some OS are more prone to infection and virus than other systems and if one of the two gets in deep enough trouble, it could render the entire machine useless and require a complete scrub and new install. By installing a second OS through means of a virtual machine such as Oracle’s VirtualBox, there is only one log in screen and when the need to use a secondary OS is required, a user just starts up the virtual instance just as if it were another program. If the secondary OS becomes unstable or infected in some way there is no complete loss, just scrub the virtual machine and install it again. Running two operating systems in this manner is far safer than trying to run side by side.

 Getting past a simple why and into the how-to section, obviously the first thing anyone is going to want to do is to visit the Oracle VirtualBox download page and find the correct version for their particular openSUSE distribution. I strongly suggest taking the time to read the documentation on this page and not just surf for the matching download to their particular system. It does make a difference as to whether or not a 32 or 64 bit will be the host OS. There are also a lot of hints, tips and tricks to installing VirtualBox on Linux so do your reading and save aspirin! While on the download page, make sure to also download the extensions pack that goes with the version of VirtualBox. The serial numbers should match on both.

 Once both the software and extension pack have been installed, don’t do anything with them just yet. As much as we would like, they are not ready to go right off the bat. There are a couple of things that need to be done prior to installing the first “guest” OS. Considering how popular the use of VirtualBox has become to Linux users over the last couple of years, I would hope that in future releases of openSUSE the programming engineers could make the installation a bit simpler, for now though it is what it is and that’s why I’m writing this how-to.

The next thing to do is go to YaST and in the search box on the upper left corner type in “DKMS”. Select the checkbox and install it. DKMS is an acronym for “Dynamic Kernel Module Support”. These packages are required for VirtualBox to generate Linux kernel modules for itself when updates are made and for driver support. No, I don’t know a whole lot about it except for the fact that the installation of VirtualBox will give an error when trying to initialize without it.


 After DKMS is installed then we can go ahead and get VirtualBox in. This should have been downloaded from Oracle as an RPM package. These are the best and easiest packages to deal with in openSUSE. They operate just like the old EXE files for Windows programs. Just click on the file and openSUSE will take care of the rest. Don’t get overly excited just yet however, there are still a number of steps we have to go through before we can actually get our guest OS up and running so just be patient and follow along. Once the loader is done doing its thing, go to the application launcher in the lower left corner and navigate to  Applications -> System -> Emulator and there should be the installation of VirtualBox. At this particular point I would actually suggest doing a right click and adding it to favorites since it will probably get used quite a bit in the beginning.


Once this is done there is another thing we need to do in YaST, so start this up and go to System -> System Services (Runlevel). For whatever reason there are dependencies for VirtualBox that do not initialize automatically so we are going to have to tell them to start with our system by default.



Once inside the runlevels interface up at the top, click on the radio button that says “Expert Mode”. Don’t worry about this too much, it’s not as intimidating as it sounds. Once the interface has changed scroll down to almost the bottom and look for the service called “vboxdrv” and click on it so that it is highlighted green or selected. For whatever reason, this is always “no” by default and it needs to be turned on for our program to work. Once selected, click on the button below that is labeled “Start/Stop/Refresh” and in that dropdown select “Start Now”. Next to the service the running indication should switch from no to yes. Once this is done make sure to click on the green button in the lower right corner labeled Ok and the setting will get saved. Now, every time the computer is started, this service will begin running automatically.


Once these steps are complete, we need to give ourselves permission to use our virtual application. This may seem odd, but this is the way it gets set up. So again go to YaST and navigate over to Security and Users -> User and Group Management. In the top tabs of this



screen select “Groups” and there should be a group called “vboxusers”. Highlight this group and at the bottom of the screen select “Edit”. In the next screen, in the column on the right look for your user name and check the box next to it then click “Ok”. You have now set permissions for yourself as being authorized to use VirtualBox.


The next hurdle to have to jump through is adding in some RPM groups associated with keeping all the kernel information cool with our virtual environment. These are loaded directly through the terminal so open one up of choice and log in as root. Now type in the following string and just select “y” every time it asks.

zypper in gcc make kernel-devel

Finally we have reached the point where we can re-boot the system so everything we changed gets set into place and start using our virtual environment.

I know this seems like a lot of work to set up a virtual machine, but once all is said and done, the payoff is totally worth it. I have actually had 4 different operating systems installed into one of these before for various levels of testing and trial purposes. One of the nice things is that a virtual machine can also be used for testing the same OS as the host before modifying the host itself. There are a number of good reasons for taking the time to install virtual machines besides being able to run Linux and Windows at one station. So I urge people to give it a try.

I also want to thank my friends over at openSUSE for helping me when I get stuck and motivating me to continue writing about my experiences and explorations with what I consider to be one of the most user friendly free OS available today. If for any reason these instructions aren’t working for anyone, please feel free to review the source I used to create them.
















1 comment:

  1. The first truely comprehensive tutorial,Thanks alot

    ReplyDelete