Difference between revisions of "HOWTO: Using VirtualBox"

From Sabayon Wiki
Jump to: navigation, search
m (With OpenRC: update: OpenRC no longer supported)
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{i18n| [[HOWTO: Using Virtualbox|en]] [[Tr:HOWTO: Using Virtualbox|tr]]}}
 
{{i18n| [[HOWTO: Using Virtualbox|en]] [[Tr:HOWTO: Using Virtualbox|tr]]}}
  
== Installing Virtualbox ==
+
= Installing Virtualbox =
  
---------------------------------------------------
+
The installation of VirtualBox is straight forward, but you have to install the kernel modules before installing the binary: otherwise it's possible that another kernel will be installed
ATTENTION
+
  
Because VirtualBox pulls a new kernel during install, before installing VirtualBox,
+
# equo install virtualbox-modules#`uname -r`
i strongly advise to FIRST read this article:
+
  
http://wolf911.us/wgo/?p=699
+
# equo install virtualbox-bin
  
so you won't get surprised.  thank you.
+
After the installation load the necessary kernel modules:
  
However, if, for some reason you want to stick with your old kernel AND want to use VirtualBox, then follow the steps below.
+
# modprobe vboxdrv
---------------------------------------------------
+
  
    # equo update
+
# modprobe vboxnetadp
  
    # equo install virtualbox-bin --nodeps
+
# modprobe vboxnetflt
  
Normally the right modules should automatically be pulled, but in this example we're using the "--nodeps" option, so:
+
Add the Linux user who wants to use Virtualbox to the group vboxusers
  
    # equo install virtualbox-modules#`uname -r`
+
# usermod -a -G vboxusers <user>
 
+
    # depmod -a
+
 
+
    # modprobe vboxdrv
+
 
+
    # modprobe vboxnetadp
+
 
+
    # modprobe vboxnetflt
+
 
+
    # usermod -a -G vboxusers YOUR_USER_NAME
+
  
 
After this '''you must log out and log in''', otherwise you'll get "Permission denied" error if you try to run "VirtualBox" command.
 
After this '''you must log out and log in''', otherwise you'll get "Permission denied" error if you try to run "VirtualBox" command.
Line 39: Line 26:
  
 
Without the Capitals, but just plain insert:"virtualbox", the command is not found......}}
 
Without the Capitals, but just plain insert:"virtualbox", the command is not found......}}
 
To get virtualbox modules to load automatically:
 
 
    # nano /etc/conf.d/modules
 
 
add to it:
 
 
    modules="vboxdrv vboxnetflt vboxnetadp"
 
 
then save and exit, reboot.
 
  
 
Sometimes, for some reason after installation, the package isn't available, accessible, or missing in the Menus.
 
Sometimes, for some reason after installation, the package isn't available, accessible, or missing in the Menus.
  
In this case, simply reinstall VirtualBox without the "--nodeps" option:
+
In this case, simply reinstall VirtualBox.
  
 
     # equo install virtualbox-bin
 
     # equo install virtualbox-bin
Line 60: Line 37:
 
{{Note| You do not need to install xf86-input-virtualbox and xf86-video-virtualbox. These are for installation '''in the guest OS, if it is Sabayon Linux''', not in the host OS.}}
 
{{Note| You do not need to install xf86-input-virtualbox and xf86-video-virtualbox. These are for installation '''in the guest OS, if it is Sabayon Linux''', not in the host OS.}}
  
== Setup a Guest OS ==
+
== Autoload modules on boot ==
+
=== With systemd ===
Setting the Guest OS up, is a case of following the Wizard, which is very intuitive.
+
On new installs systemd is default init system.
  
1) Open VirtualBox
+
Create a file with extension '''*.conf''' in directory '''/etc/modules-load.d/''', e.g. virtualbox.conf. In  this file write what modules should be loaded.
  
2) Click on New
+
File content: 
 +
  vboxdrv
 +
  vboxnetadp
 +
  vboxnetflt
  
3) Click on Next
+
----
  
4) Add a name for your OS (Lets assume you are installing WinXP) so enter '''Windows XP'''
+
=== With OpenRC ===
 +
{{Warning| Please note that '''OpenRC is no longer supported''' in Sabayon.}}
  
5) Choose the OS Type from the drop down menu (Windows XP)
+
To get virtualbox modules to load automatically edit the file /etc/conf.d/modules
  
6) Click Next
+
add to it:
  
7) Set your base memory size, (''as a rule of thumb,  never set this to more than half the host machines actual memory, otherwise the host grinds to a halt'')
+
  modules="vboxdrv vboxnetflt vboxnetadp"
  
8) Click Next
+
then save and exit, reboot.
  
9) This will take you to the hard disk allocation page, where on a new install you will need to click on New and launch another Wizard,
+
= Setup a Guest OS =
 
+
10) Virtual Disk image type, set this to Dynamically expanding image
+
Setting the Guest OS up, is a case of following the Wizard, which is very intuitive.
 
+
11) Click Next
+
 
+
12) Set the image name to WinXP and the Image size to something over 4Gb
+
 
+
13) Click Next
+
 
+
14) A Summary will display, click finish
+
 
+
15) This will take you back to the Virtual Hard disk page, where you will be able to select the WinXP hard disk from the drop down menu
+
 
+
16) Click Next
+
 
+
17) Click on Finish
+
 
+
18) This will take you back to the Main Virtualbox interface.
+
  
 +
# Open VirtualBox
 +
# Click on New
 +
# Click on Next
 +
# Add a name for your OS (Lets assume you are installing WinXP) so enter '''Windows XP'''
 +
# Choose the OS Type from the drop down menu (Windows XP)
 +
# Click Next
 +
# Set your base memory size, (''as a rule of thumb,  never set this to more than half the host machines actual memory, otherwise the host grinds to a halt'')
 +
# Click Next
 +
# This will take you to the hard disk allocation page, where on a new install you will need to click on New and launch another Wizard,
 +
# Virtual Disk image type, set this to Dynamically expanding image
 +
# Click Next
 +
# Set the image name to WinXP and the Image size to something over 4Gb
 +
# Click Next
 +
# A Summary will display, click finish
 +
# This will take you back to the Virtual Hard disk page, where you will be able to select the WinXP hard disk from the drop down menu
 +
# Click Next
 +
# Click on Finish
 +
# This will take you back to the Main Virtualbox interface.
 
To Launch the New system click on it once, and click on start. and the Virtual system will start to load, however with no CD in the CD Rom the system will probably stop when it looks for an OS.
 
To Launch the New system click on it once, and click on start. and the Virtual system will start to load, however with no CD in the CD Rom the system will probably stop when it looks for an OS.
  
 
You can load the Guest OS either from the CD-ROM, or from an ISO image, which is setup via the Settings option, when the Virtual machine is powered down.
 
You can load the Guest OS either from the CD-ROM, or from an ISO image, which is setup via the Settings option, when the Virtual machine is powered down.
  
== Guest Additions ==
+
= Guest Additions =
  
  
Line 117: Line 100:
 
If you prefer to mount the additions manually, you can perform the following steps:
 
If you prefer to mount the additions manually, you can perform the following steps:
  
1. Start the virtual machine where you have installed a Windows guest operating
+
# Start the virtual machine where you have installed a Windows guest operating system.
system.
+
# Select “Mount CD/DVD-ROM” from the “Devices” menu in the virtual machine’s menu bar and then “CD/DVD-ROM image”. This brings up the Virtual Disk Manager.
 
+
# In the Virtual Disk Manager, press the “Add” button and browse your host file system for the VBoxGuestAdditions.iso file:
2. Select “Mount CD/DVD-ROM” from the “Devices” menu in the virtual machine’s
+
## On a Linux host, you can find this file in the additions folder under where you installed VirtualBox (normally /opt/VirtualBox-1.5.0).
menu bar and then “CD/DVD-ROM image”. This brings up the Virtual Disk Man-
+
# Back in the Virtual Disk Manager, select that ISO file and press the “Select” button. This will mount the ISO file and present it to your Windows guest as a CD-ROM.
ager.
+
 
+
3. In the Virtual Disk Manager, press the “Add” button and browse your host file
+
system for the VBoxGuestAdditions.iso file:
+
 
+
On a Linux host, you can find this file in the additions folder under where
+
you installed VirtualBox (normally /opt/VirtualBox-1.5.0).
+
 
+
4. Back in the Virtual Disk Manager, select that ISO file and press the “Select” but-
+
ton. This will mount the ISO file and present it to your Windows guest as a
+
CD-ROM.
+
  
 
Once you have rebooted the Guest System, you can click on Machine -> Seamless mode and the apps you launch in the Guest OS, will behave no in a window, but actually on your desktop environment.
 
Once you have rebooted the Guest System, you can click on Machine -> Seamless mode and the apps you launch in the Guest OS, will behave no in a window, but actually on your desktop environment.
  
 
[[Category:Virtual Machines|Using Virtualbox]]
 
[[Category:Virtual Machines|Using Virtualbox]]

Revision as of 13:12, 9 March 2014

i18n: en tr

Installing Virtualbox

The installation of VirtualBox is straight forward, but you have to install the kernel modules before installing the binary: otherwise it's possible that another kernel will be installed

# equo install virtualbox-modules#`uname -r`
# equo install virtualbox-bin

After the installation load the necessary kernel modules:

# modprobe vboxdrv
# modprobe vboxnetadp
# modprobe vboxnetflt

Add the Linux user who wants to use Virtualbox to the group vboxusers

# usermod -a -G vboxusers <user>

After this you must log out and log in, otherwise you'll get "Permission denied" error if you try to run "VirtualBox" command.

Question.png
Please note that, when starting VirtualBox in a terminal, the command is: VirtualBox (watch the Capitals), Without the Capitals, but just plain insert:"virtualbox", the command is not found......

Sometimes, for some reason after installation, the package isn't available, accessible, or missing in the Menus.

In this case, simply reinstall VirtualBox.

    # equo install virtualbox-bin

Now it should be available.....

Question.png
You do not need to install xf86-input-virtualbox and xf86-video-virtualbox. These are for installation in the guest OS, if it is Sabayon Linux, not in the host OS.

Autoload modules on boot

With systemd

On new installs systemd is default init system.

Create a file with extension *.conf in directory /etc/modules-load.d/, e.g. virtualbox.conf. In this file write what modules should be loaded.

File content:

 vboxdrv
 vboxnetadp
 vboxnetflt

With OpenRC

Stop.png
Please note that OpenRC is no longer supported in Sabayon.

To get virtualbox modules to load automatically edit the file /etc/conf.d/modules

add to it:

 modules="vboxdrv vboxnetflt vboxnetadp"

then save and exit, reboot.

Setup a Guest OS

Setting the Guest OS up, is a case of following the Wizard, which is very intuitive.

  1. Open VirtualBox
  2. Click on New
  3. Click on Next
  4. Add a name for your OS (Lets assume you are installing WinXP) so enter Windows XP
  5. Choose the OS Type from the drop down menu (Windows XP)
  6. Click Next
  7. Set your base memory size, (as a rule of thumb, never set this to more than half the host machines actual memory, otherwise the host grinds to a halt)
  8. Click Next
  9. This will take you to the hard disk allocation page, where on a new install you will need to click on New and launch another Wizard,
  10. Virtual Disk image type, set this to Dynamically expanding image
  11. Click Next
  12. Set the image name to WinXP and the Image size to something over 4Gb
  13. Click Next
  14. A Summary will display, click finish
  15. This will take you back to the Virtual Hard disk page, where you will be able to select the WinXP hard disk from the drop down menu
  16. Click Next
  17. Click on Finish
  18. This will take you back to the Main Virtualbox interface.

To Launch the New system click on it once, and click on start. and the Virtual system will start to load, however with no CD in the CD Rom the system will probably stop when it looks for an OS.

You can load the Guest OS either from the CD-ROM, or from an ISO image, which is setup via the Settings option, when the Virtual machine is powered down.

Guest Additions

Now if you are using Virtualbox to run Windows XP as the guest OS, it is worthwhile loading the Guest Additions

The Guest additions allow you to do some really funky stuff, like have the mouse pointer work across both guest and host applications: Better Video drivers, and Seamless integration.

In the “Devices” menu in the virtual machine’s menu bar, VirtualBox has a handy menu item named “Install guest additions”, which will automatically bring up the Additions in your VM window.

If you prefer to mount the additions manually, you can perform the following steps:

  1. Start the virtual machine where you have installed a Windows guest operating system.
  2. Select “Mount CD/DVD-ROM” from the “Devices” menu in the virtual machine’s menu bar and then “CD/DVD-ROM image”. This brings up the Virtual Disk Manager.
  3. In the Virtual Disk Manager, press the “Add” button and browse your host file system for the VBoxGuestAdditions.iso file:
    1. On a Linux host, you can find this file in the additions folder under where you installed VirtualBox (normally /opt/VirtualBox-1.5.0).
  4. Back in the Virtual Disk Manager, select that ISO file and press the “Select” button. This will mount the ISO file and present it to your Windows guest as a CD-ROM.

Once you have rebooted the Guest System, you can click on Machine -> Seamless mode and the apps you launch in the Guest OS, will behave no in a window, but actually on your desktop environment.