Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
deb9:virtualbox [2020/06/21 14:06] – [through rc.local] Bernard Condraudeb9:virtualbox [2025/09/08 14:23] (current) – [VirtualBox] Bernard Condrau
Line 1: Line 1:
 ====== VirtualBox ====== ====== VirtualBox ======
 +
 ===== Host ===== ===== Host =====
 +  * I recommend to install VirtualBox from the Oracle repository, as you get the latest version of VirtualBox
   * Add "virtualbox.list" to /etc/apt/sources.list.d<code>sudo deb http://download.virtualbox.org/virtualbox/debian stretch contrib</code>   * Add "virtualbox.list" to /etc/apt/sources.list.d<code>sudo deb http://download.virtualbox.org/virtualbox/debian stretch contrib</code>
   * Add Oracle VirtualBox public key:<code>wget https://www.virtualbox.org/download/oracle_vbox_2016.asc   * Add Oracle VirtualBox public key:<code>wget https://www.virtualbox.org/download/oracle_vbox_2016.asc
Line 12: Line 14:
   * [[https://pgaskin.net/linux-tips/configuring-virtualbox-autostart/|Configuring VirtualBox autostart on Linux]]   * [[https://pgaskin.net/linux-tips/configuring-virtualbox-autostart/|Configuring VirtualBox autostart on Linux]]
  
-===== Guest =====+===== Guest Network ===== 
 +  * [[https://www.nakivo.com/blog/virtualbox-network-setting-guide/|VirtualBox Network Settings: Complete Guide]] 
 +  * [[https://www.virtualbox.org/manual/ch06.html#network_performance|Network Performance]] 
 ===== Guest Additions ===== ===== Guest Additions =====
   * To upgrade the Guest Additions after upgrading the host version, download the guest additions pack, close all virtual machines, and start virtualbox as root<code>sudo virtualbox</code>   * To upgrade the Guest Additions after upgrading the host version, download the guest additions pack, close all virtual machines, and start virtualbox as root<code>sudo virtualbox</code>
Line 32: Line 37:
 ==== through rc.local ==== ==== through rc.local ====
 === startup === === startup ===
-  - install [[deb10:service|rc.local]] as a systemd service on your debian server. This emulates the //SysVinit// behavior of rc.local as Debian changed the default init system to //systemd// with Debian Jessie 8+  - install [[deb10:rclocal|rc.local]] as a systemd service on your debian server. This emulates the //SysVinit// behavior of rc.local as Debian changed the default init system to //systemd// with Debian Jessie 8
   - mount encrypted file systems through rc.local as explained in [[deb9:encrypted|Encrypted partitions/folders with auto-mount]]   - mount encrypted file systems through rc.local as explained in [[deb9:encrypted|Encrypted partitions/folders with auto-mount]]
   - start vms through rc.local headless. Since rc.local runs as root you need to use runuser to start the vm as the user who created the vm. You may also chose to put the startvm code into a script and add execution of the script to rc.local:<code>runuser -l <user> -c "vboxmanage startvm <vm-name> --type headless"</code>   - start vms through rc.local headless. Since rc.local runs as root you need to use runuser to start the vm as the user who created the vm. You may also chose to put the startvm code into a script and add execution of the script to rc.local:<code>runuser -l <user> -c "vboxmanage startvm <vm-name> --type headless"</code>
Line 47: Line 52:
   - the scripts must be run as root so they can be executed through rc.local   - the scripts must be run as root so they can be executed through rc.local
   - also, the server must be shut down with //systemctl// rather than //reboot// or //shutdown// for this to work   - also, the server must be shut down with //systemctl// rather than //reboot// or //shutdown// for this to work
-  * [[https://opensource.com/life/16/11/running-commands-shutdown-linux|How to run commands at shutdown on Linux]] 
-  * [[https://www.2daygeek.com/how-to-avoid-or-prevent-accidental-shutdown-or-reboot-on-linux/|How to Prevent Accidental Shutdown or Reboot on Linux Using systemd Custom Service]] 
  
 +=== links ===
 +  * Debian [[deb10:services|Services]]
 ==== through XFCE Desktop ==== ==== through XFCE Desktop ====
 === startup === === startup ===
Line 96: Line 101:
   * [[https://pgaskin.net/linux-tips/configuring-virtualbox-autostart/|Configuring VirtualBox autostart on Linux]]   * [[https://pgaskin.net/linux-tips/configuring-virtualbox-autostart/|Configuring VirtualBox autostart on Linux]]
   * [[http://techgenix.com/start-virtualbox-service/|How to start VirtualBox machines automatically as a service on Windows]]   * [[http://techgenix.com/start-virtualbox-service/|How to start VirtualBox machines automatically as a service on Windows]]
 +
 +===== Update VirtualBox =====
 +  * Make sure to update the same way you installed the previous version, either from the Oracle repository, or from the Debian backports
 +  * If you followed my guide, check the VirtualBox version.revision.build (e.g. 6.1.16)
 +  * Updating the build is done by running "apt upgrade"<code>audo apt update
 +sudo apt upgrade</code>
 +  * Updating to a new version or revision is done by running "apt install virtualbox-<version>.<revision>", e.g.<code>sudo apt update
 +sudo apt install virtualbox-6.1</code>
 +
 +==== Links ====
 +  * [[https://www.linuxbabe.com/debian/install-virtualbox-debian-9-stretch|2 Ways to Install VirtualBox on Debian 9 Stretch]]
 +===== Manage VirtualBox through CLI =====
 +==== Extension Pack ====
 +  * Remove old extension pack<code>sudo vboxmanage extpack uninstall "Oracle VM VirtualBox Extension Pack"</code>
 +  * Download current extension pack from [[https://www.virtualbox.org/wiki/Downloads|Download VirtualBox]] and install<code>wget https://download.virtualbox.org/virtualbox/6.1.30/Oracle_VM_VirtualBox_Extension_Pack-6.1.30.vbox-extpack
 +sudo vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.30.vbox-extpack</code>
 +
 +==== Run VM ====
 +  * <code>vboxmanage startvm "<vm_name>" --type headless</code>
 +
 +==== Hold back upgrade ====
 +  * <code>sudo apt-mark hold virtualbox-6.1</code>
 +  * <code>sudo apt-mark unhold virtualbox-6.1</code>
 +==== Links ====
 +  * [[http://underpop.online.fr/v/virtualbox/vboxmanage-extpack-virtualbox.html.gz|VBoxManage extpack]]
 +  * [[https://docs.oracle.com/en/virtualization/virtualbox/6.0/user/vboxmanage-extpack.html|Oracle VirtualBox Extension Pack]]
 +  * [[https://linoxide.com/exclude-specific-package-apt-get-upgrade/|How to Exclude Specific Package from apt-get Upgrade]]
 +