VirtualBox: Difference between revisions

add info about shared folders
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight"
 
(7 intermediate revisions by 3 users not shown)
Line 6: Line 6:
* https://askubuntu.com/questions/914997/install-virtualbox-while-keeping-secure-boot
* https://askubuntu.com/questions/914997/install-virtualbox-while-keeping-secure-boot
* https://stegard.net/2016/10/virtualbox-secure-boot-ubuntu-fail/
* https://stegard.net/2016/10/virtualbox-secure-boot-ubuntu-fail/
* Assuming you disable secure boot due to a package installation, even when you re-enable secure boot in your system configuration, you may still see [https://askubuntu.com/questions/726052/ubuntu-booting-in-insecure-mode-with-secureboot-enabled “Booting in insecure mode” with SecureBoot enabled]
* Assuming you disable secure boot due to a package installation, even when you re-enable secure boot in your system configuration, you may still see [https://askubuntu.com/questions/726052/ubuntu-booting-in-insecure-mode-with-secureboot-enabled Booting in insecure mode with SecureBoot enabled]


You'll always find a newer version of VirtualBox [https://www.virtualbox.org/wiki/Linux_Downloads using the Oracle ppa], so use that rather than the packaged version that comes with your distro.  Warning: if you've already got VirtualBox installed from packages, you should remove it (but not 'completely' meaning don't destroy your existing images). Also, under packaged Ubuntu, you can simply <code>apt-get install virtualbox-guest-additions-iso</code>; however with the PPA, you'll need to download it yourself.
You'll always find a newer version of VirtualBox [https://www.virtualbox.org/wiki/Linux_Downloads using the Oracle ppa], so use that rather than the packaged version that comes with your distro.  Warning: if you've already got VirtualBox installed from packages, you should remove it (but not 'completely' meaning don't destroy your existing images). Also, under packaged Ubuntu, you can simply <code>apt-get install virtualbox-guest-additions-iso</code>; however with the PPA, you'll need to download it yourself.
Line 22: Line 22:
=== Getting it ===
=== Getting it ===


<source lang="bash">
<syntaxhighlight lang="bash">
# prep
# prep
# Stop any virtual machines
# Stop any virtual machines
Line 30: Line 30:
wget http://download.virtualbox.org/virtualbox/5.0.26/virtualbox-5.0_5.0.26-108824-Ubuntu-trusty_i386.deb
wget http://download.virtualbox.org/virtualbox/5.0.26/virtualbox-5.0_5.0.26-108824-Ubuntu-trusty_i386.deb
sudo dpkg -i ~/Downloads/virtualbox-5.0_5.0.26-108824-Ubuntu-trusty_i386.deb
sudo dpkg -i ~/Downloads/virtualbox-5.0_5.0.26-108824-Ubuntu-trusty_i386.deb
</source>
</syntaxhighlight>
If you get a 'conflict with virtualbox' error, remove the existing package and re-try the previous install command
If you get a 'conflict with virtualbox' error, remove the existing package and re-try the previous install command
<code>sudo dpkg --remove virtualbox-4.3</code>
<code>sudo dpkg --remove virtualbox-4.3</code>


You may also need to upgrade vagrant E.g. VirtualBox GUI runs fine, but 'vagrant up' does not.  This happened to me when my installed version of vagrant 1.7.1 only supported VirtualBox <= 4.3.  Upgrading to vagrant 1.8.5 added support for VirtualBox 5.x
You may also need to upgrade vagrant E.g. VirtualBox GUI runs fine, but 'vagrant up' does not.  This happened to me when my installed version of vagrant 1.7.1 only supported VirtualBox <= 4.3.  Upgrading to vagrant 1.8.5 added support for VirtualBox 5.x
<source lang="bash">
<syntaxhighlight lang="bash">
sudo dpkg -i /home/greg/Downloads/vagrant_1.8.5_i686.deb
sudo dpkg -i /home/greg/Downloads/vagrant_1.8.5_i686.deb
</source>
</syntaxhighlight>


=== VBoxManage ===
=== VBoxManage ===
Line 48: Line 48:
If you have problems with installing Guest Additions, see https://www.virtualbox.org/wiki/LinuxAdditionsDebug which describes what the drivers are, what they do, and how to install them manually.
If you have problems with installing Guest Additions, see https://www.virtualbox.org/wiki/LinuxAdditionsDebug which describes what the drivers are, what they do, and how to install them manually.


== Vagrant ==
<code>lsmod | grep vbox</code> will give you some info on what's installed; which will be different for the host and the guest.


"Vagrant is a tool for building and distributing virtualized development environments. By providing automated creation and provisioning of virtual machines using Oracle's VirtualBox (ed.: as well as other virtualization engines), Vagrant provides the tools to create and configure lightweight, reproducible, and portable virtual environments."
<code>modinfo vboxdrv</code> will give you info about the specific driver; especially the filename and version. The version of the driver should match the version of VirtualBox that you're running.
 
http://www.vagrantup.com/
 
The MediaWiki project uses vagrant and provides instructions as well as the configuration itself so that you can setup a development instance in a snap. See [[MediaWiki-Vagrant]]


== Extensions ==
You may need/want to install the "'''Extension Pack'''" for VirtualBox.  That's because it provides USB 2.0 and USB 3.0 Host Controller, Host Webcam, VirtualBox RDP, PXE ROM, Disk Encryption, and NVMe. First download the file (it's a tarball with a .vbox-extpack extension), and then use VBoxManage to install it.
<syntaxhighlight lang="bash">
VBoxManage list extpacks
VBoxManage extpack --help
VBoxManage extpack install --replace ~/Downloads/Oracle_VM_VirtualBox_Extension_Pack-5.2.13-122773.vbox-extpack
</syntaxhighlight>


== Shared Folders ==
== Shared Folders ==
Line 61: Line 64:


E.g. for meza,  
E.g. for meza,  
<source lang="bash">
<syntaxhighlight lang="bash">
cd ~/src/meza
cd ~/src/meza
vagrant ssh # to get onto the guest
vagrant ssh # to get onto the guest
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) opt_meza /opt/meza
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) opt_meza /opt/meza
# now the /home/greg/src/meza folder on the host is available to the vagrant user on the guest at /opt/meza
# now the /home/greg/src/meza folder on the host is available to the vagrant user on the guest at /opt/meza
</source>
</syntaxhighlight>


== Disk Images ==
== Disk Images ==
Line 73: Line 76:


== Other Projects using VirtualBox ==
== Other Projects using VirtualBox ==
See [[Drupal/virtualization]]
* See [[Drupal/virtualization]]
* VirtualBox is the default 'provider' (virtualization system)  used by HashiCorp's [[Vagrant]]
* The MediaWiki project uses vagrant so that you can setup a development instance in a snap.  See [[MediaWiki-Vagrant]]


[[Category:Virtualization]]
[[Category:Virtualization]]
[[Category:Development]]
[[Category:Development]]
[[Category:DevOps]]
[[Category:DevOps]]