Virtualbox: Difference between revisions
(182 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
VMWare workstation player is more robust than VirtualBox. The screen size is large before installing vmware tools and vmware tools just work after installation. | |||
(Update) KVM is more robust than VMWare. This assumes the host is a Linux box. | |||
= Windows Host = | = Windows Host = | ||
== Windows 11 == | |||
[https://www.makeuseof.com/windows-11-virtual-machine/ How to Install a Virtual Machine on Windows 11] | |||
== Uninstall == | == Uninstall == | ||
* Uninstall virtualbox drivers http://dottech.org/101997/how-to-uninstall-virtualbox-drivers-on-windows/. I found the drivers and registry are cleaned out after we run uninstall Oracle Virtualbox. | * Uninstall virtualbox drivers http://dottech.org/101997/how-to-uninstall-virtualbox-drivers-on-windows/. I found the drivers and registry are cleaned out after we run uninstall Oracle Virtualbox. | ||
Line 47: | Line 55: | ||
If your CPU does not supports hardware virtualization, you can only install 32-bit virtual machines (not 64-bit). | If your CPU does not supports hardware virtualization, you can only install 32-bit virtual machines (not 64-bit). | ||
== IOMMU == | |||
* [https://en.wikipedia.org/wiki/Input%E2%80%93output_memory_management_unit Input–output memory management unit] | |||
* Udoo Bolt https://www.udoo.org/forum/forums/udoo-bolt.51/ | |||
== Virtualization in the host machine == | == Virtualization in the host machine == | ||
Note that even the host machine is 64-bit, if the vT is not available/enabled in the BIOS, we cannot install 64-bit OS in the guest machine. | Note that even the host machine is 64-bit, if the vT is not available/enabled in the BIOS, we cannot install 64-bit OS in the guest machine. | ||
== Booting and EFI == | |||
BIOS mode and UEFI mode. | |||
* [https://www.makeuseof.com/set-up-efi-linux-virtual-machine-virtualbox/ How to Enable EFI on VirtualBox Virtual Machines Running Linux] | |||
* [https://arstechnica.com/gadgets/2020/02/linux-distro-review-intels-own-clear-linux-os/ Linux distro review: Intel’s own Clear Linux OS] | |||
* [https://docs.01.org/clearlinux/latest/get-started/virtual-machine-install/virtualbox-cl-installer.html Clear Linux* OS on VirtualBox] | |||
* [https://linuxhint.com/install-clear-linux-intel-linux-os-on-a-virtual-machine-using-virtualbox/ Install Clear Linux (Intel Linux OS) on a Virtual Machine using VirtualBox] | |||
== A caution about Ubuntu guest machine == | == A caution about Ubuntu guest machine == | ||
Line 97: | Line 116: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Centos === | === Centos and header not found (it is actually mismatch) === | ||
<pre> | <pre> | ||
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 # to set ''ONBOOT'' to yes. | vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 # to set ''ONBOOT'' to yes. | ||
Line 103: | Line 122: | ||
yum install dkms | yum install dkms | ||
yum groupinstall "Development Tools" | yum groupinstall "Development Tools" | ||
yum install kernel-devel | yum install kernel-headers-$(uname -r) kernel-devel-$(uname -r) | ||
# Above is a correction of yum install kernel-devel | |||
# insert guest additions cd image and run Linux executable | # insert guest additions cd image and run Linux executable | ||
# reboot | # reboot | ||
</pre> | </pre> | ||
Reference: https://wiki.centos.org/HowTos/Virtualization/VirtualBox/CentOSguest | Reference: | ||
* https://wiki.centos.org/HowTos/Virtualization/VirtualBox/CentOSguest | |||
* [https://unix.stackexchange.com/a/582669 header mismatch] | |||
=== Server === | |||
The guest additions works on both Linux desktop and server. | |||
How to mount the guest additions cd-rom [https://www.tecmint.com/install-virtualbox-guest-additions-in-centos-rhel-fedora/ Install VirtualBox Guest Additions in CentOS, RHEL & Fedora] | |||
<pre> | |||
$ su | |||
# mount -r /dev/cdrom /media | |||
# cd /media/ | |||
# ./VBoxLinuxAdditions.run | |||
</pre> | |||
== virtual machine software benchmark == | == virtual machine software benchmark == | ||
Line 143: | Line 176: | ||
</pre> | </pre> | ||
The only solution is to install an old version of VB. | The only solution is to install an old version of VB. | ||
[https://www.linuxuprising.com/2019/12/how-to-upgrade-ubuntu-repositories.html How To Fix Upgrading Ubuntu Repositories VirtualBox To Oracle-Provided VirtualBox] Ubuntu 19.10. | |||
=== the headers of the current running kernel were not found === | === the headers of the current running kernel were not found === | ||
Line 203: | Line 238: | ||
=== No internet access on Centos guest machine === | === No internet access on Centos guest machine === | ||
Follow [http://www.jeramysingleton.com/install-centos-7-minimal-in-virtualbox/ Install a CentOS 7 Minimal Virtual Machine with VirtualBox] and modify the file '''/etc/sysconfig/network-scripts/ifcfg-enp0s3''' to set ''ONBOOT'' to yes. | Follow [http://www.jeramysingleton.com/install-centos-7-minimal-in-virtualbox/ Install a CentOS 7 Minimal Virtual Machine with VirtualBox] and modify the file '''/etc/sysconfig/network-scripts/ifcfg-enp0s3''' to set ''ONBOOT'' to yes. | ||
=== Screen Resolution Too Small During Installation === | |||
Trick: | |||
# install Virtualbox Extension Pack | |||
# In the guest OS, go to setting and increase the screens resolution from the least 800x600 (4:3) to a better one,e.g. 1024x768 (4:3) or 1280x800 (16:10). | |||
= Mac host = | = Mac host = | ||
Line 216: | Line 256: | ||
== Download virtual disk images == | == Download virtual disk images == | ||
[https://www.makeuseof.com/tag/3-websites-to-download-virtual-disk-images-for-virtualbox/ The 3 Best Sites to Download Virtual Disk Images for VirtualBox] | [https://www.makeuseof.com/tag/3-websites-to-download-virtual-disk-images-for-virtualbox/ The 3 Best Sites to Download Virtual Disk Images for VirtualBox] | ||
== Nested VM == | |||
[https://www.makeuseof.com/how-set-up-virtual-machine-in-another-virtual-machine-nested-virtualization-explained/ How to Set Up a Virtual Machine in Another Virtual Machine? Nested Virtualization Explained] | |||
== Hard disk file type & splitting == | == Hard disk file type & splitting == | ||
Line 248: | Line 291: | ||
== [https://www.virtualbox.org/manual/ch06.html Virtual networks] == | == [https://www.virtualbox.org/manual/ch06.html Virtual networks] == | ||
[https://www.makeuseof.com/whats-the-difference-nat-bridge-host-only-network-modes/ What's the Difference Between NAT, Bridge, and Host-Only Network Modes?] | |||
# [https://www.virtualbox.org/manual/ch08.html#vboxmanage-natnetwork NAT]: Network Address Translation (NAT) service works in a similar way to a home router. It groups systems using it into a network and prevents outside systems from directly accessing those inside, while letting systems inside communicate with each other and outside systems using TCP and UDP over IPv4 and IPv6. | # [https://www.virtualbox.org/manual/ch08.html#vboxmanage-natnetwork NAT]: Network Address Translation (NAT) service works in a similar way to a home router. It groups systems using it into a network and prevents outside systems from directly accessing those inside, while letting systems inside communicate with each other and outside systems using TCP and UDP over IPv4 and IPv6. | ||
# Bridge | # Bridge. See [https://www.tecmint.com/set-static-ip-address-in-ubuntu/ How to Configure Static IP Address on Ubuntu 20.04 (host machine)] | ||
# Host Only: Host can access guest, but not the other direction. Outside cannot access guests. Good for running a test web server. | # Host Only: Host can access guest, but not the other direction. Outside cannot access guests. Good for running a test web server. | ||
# Internal Network: Guests can access each other but host still cannot access guests. This is good for testing when you need a separate, clean network, and you can create sophisticated internal networks with vm's that provide their own services to the internal network. (e.g. Active Directory, DHCP, etc). | # Internal Network: Guests can access each other but host still cannot access guests. This is good for testing when you need a separate, clean network, and you can create sophisticated internal networks with vm's that provide their own services to the internal network. (e.g. Active Directory, DHCP, etc). | ||
Line 495: | Line 539: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* Use the 'split' and 'md5sum' commands. See [[Backup#split_large_files_before_transfer.2Fbackup|Split large files before transfer]]. | * Use the 'split' and 'md5sum' commands. See [[Backup#split_large_files_before_transfer.2Fbackup|Split large files before transfer]]. | ||
:<syntaxhighlight lang='bash'> | |||
# backup | |||
cd ~/Documents # default location when export using virtualbox | |||
split -d -b 2G windows10.ova windows10.ova. | |||
md5sum windows10.ova.* > windows10.md5 | |||
rsync -avz windows10.ova.* /mnt/wd4t/windows10/2019-09-09/ --progress | |||
cp -r windows10.md5 /mnt/wd4t/windows10/2019-09-09/ | |||
md5sum windows10.ova # optional | |||
# restore | |||
cd /mnt/wd4t/windows10/2019-09-09 | |||
md5sum -c windows10.md5 | |||
## DON'T do the following on the external drive (slow) | |||
## ONLY do merge on the internal drive | |||
cat windows10.md5.* > windows10.ova # split files are still there | |||
md5sum windows10.ova # optional | |||
</syntaxhighlight> | |||
== Import vmdk == | == Import vmdk == | ||
Line 534: | Line 595: | ||
== Port forward == | == Port forward == | ||
[https://opensource.com/article/21/9/what-port-forwarding What is port forwarding?] | |||
If you’d like to run server software inside a virtual machine, you’ll probably want to set up port forwarding so the server software is reachable from outside of the virtual machine. You’ll find this option in the Network settings pane, under Advanced. | If you’d like to run server software inside a virtual machine, you’ll probably want to set up port forwarding so the server software is reachable from outside of the virtual machine. You’ll find this option in the Network settings pane, under Advanced. | ||
Line 582: | Line 645: | ||
== Increase the guest machine space == | == Increase the guest machine space == | ||
* http://www.dedoimedo.com/computers/virtualbox-shrink-expand-disks.html | * http://www.dedoimedo.com/computers/virtualbox-shrink-expand-disks.html | ||
* http://www.howtogeek.com/124622/how-to-enlarge-a-virtual-machines-disk-in-virtualbox-or-vmware/ | * [http://www.howtogeek.com/124622/how-to-enlarge-a-virtual-machines-disk-in-virtualbox-or-vmware/ How To Enlarge a Virtual Machine’s Disk in VirtualBox or VMware] | ||
== Boot virtual machines from USB drives == | == Boot virtual machines from USB drives == | ||
Line 599: | Line 662: | ||
[https://www.nextofwindows.com/fix-virtualbox-windows-hidpi-mac-retina-display-blurry-text Fix Virtualbox Windows HiDPI Mac Retina Display Blurry Text] | [https://www.nextofwindows.com/fix-virtualbox-windows-hidpi-mac-retina-display-blurry-text Fix Virtualbox Windows HiDPI Mac Retina Display Blurry Text] | ||
== Windows 11 == | |||
[https://www.makeuseof.com/windows-11-enterprise-virtualbox-install/ How to Install Windows 11 Enterprise in Your VirtualBox] | |||
== Hackintosh == | == Hackintosh == | ||
Line 874: | Line 940: | ||
== Configuring a single Ubuntu installation as a dual-boot option and a VirtualBox appliance == | == Configuring a single Ubuntu installation as a dual-boot option and a VirtualBox appliance == | ||
https://www.howtoforge.com/tutorial/configuring-a-single-ubuntu-installation-as-a-dual-boot-option-and-a-virtualbox-appliance-under-windows-10/ | https://www.howtoforge.com/tutorial/configuring-a-single-ubuntu-installation-as-a-dual-boot-option-and-a-virtualbox-appliance-under-windows-10/ | ||
== Multipass == | |||
* [https://youtu.be/U_44gHyCcoc?si=0B5tGITp_UIttyTk&t=231 Best Virtual Machine Creation tool to create and run Linux VMs like containers] | |||
== [http://www.osboxes.org/ OSBoxes] == | == [http://www.osboxes.org/ OSBoxes] == | ||
Line 897: | Line 966: | ||
= Other visualization software = | = Other visualization software = | ||
== Hypervisor/Virtual machine monitor == | == Hypervisor/Virtual machine monitor == | ||
A '''hypervisor''', also known as a '''virtual machine monitor (VMM)''', is a '''type of computer software, firmware or hardware''' that creates and runs virtual machines. A computer on which a hypervisor runs one or more virtual machines is called a host machine, and each virtual machine is called a guest machine. The hypervisor presents the guest operating systems with a virtual operating platform and manages the execution of the guest operating systems. | |||
There are two types of '''[http://en.wikipedia.org/wiki/Hypervisor Hypervisor]''' (wikipedia) | There are two types of '''[http://en.wikipedia.org/wiki/Hypervisor Hypervisor]''' (wikipedia) | ||
# Type 1: ''' | # Type 1: native or '''bare-metal hypervisors'''. These hypervisors run directly on the host's hardware to control the hardware and to manage guest operating systems. Examples include Oracle VM Server for SPARC, Oracle VM Server for x86, the Citrix '''XenServer/XenClient''', VMware '''vSphere/ESXi''', Microsoft '''Hyper-V''' 2008/2012, RedHat Enterprise Virtualization ('''RHEV'''), '''Proxmox''' and '''KVM''' (see note below). | ||
# Type 2: '''hosted hypervisors'''. These hypervisors run on a conventional operating system just as other computer programs do. Type-2 hypervisors abstract guest operating systems from the host operating system. '''VMware Workstation''' and ''' | # Type 2: '''hosted hypervisors'''. These hypervisors run on a conventional operating system just as other computer programs do. Type-2 hypervisors abstract guest operating systems from the host operating system. '''VMware Workstation''', '''VirtualBox''' and '''QEMU''' are examples of type-2 hypervisors. | ||
However, the distinction between these two types is not necessarily clear. Linux's '''Kernel-based Virtual Machine (KVM)''' and FreeBSD's '''bhyve''' are kernel modules[1] that effectively convert the host operating system to a type-1 hypervisor. At the same time, since Linux distributions and FreeBSD are still general-purpose operating systems, with other applications competing for VM resources, KVM and bhyve can also be categorized as type-2 hypervisors. | However, the distinction between these two types is not necessarily clear. Linux's '''Kernel-based Virtual Machine (KVM)''' and FreeBSD's '''bhyve''' are kernel modules[1] that effectively convert the host operating system to a type-1 hypervisor. At the same time, since Linux distributions and FreeBSD are still general-purpose operating systems, with other applications competing for VM resources, KVM and bhyve can also be categorized as type-2 hypervisors. | ||
See also the youtube videos [https://www.youtube.com/playlist?list=PL1l78n6W8zyp2NO11-BpJql2P_DN1q_Ly Hyper-V Course] from itfreetraining. | See also the youtube videos [https://www.youtube.com/playlist?list=PL1l78n6W8zyp2NO11-BpJql2P_DN1q_Ly Hyper-V Course] from itfreetraining. | ||
== | == KVM: Kernel-based Virtual Machine == | ||
[ | See [[KVM|KVM]]. | ||
== KVM vs. Xen vs. VirtualBox Virtualization Performance == | == KVM vs. Xen vs. VirtualBox Virtualization Performance == | ||
Line 913: | Line 984: | ||
=== [https://www.qemu.org/ QEMU] === | === [https://www.qemu.org/ QEMU] === | ||
* QEMU stands for Quick Emulator | |||
* [https://linuxconfig.org/qemu-vs-kvm-hypervisor-whats-the-difference QEMU vs KVM] | |||
** QEMU is a '''software-based''' virtualization solution, while KVM is a '''hardware-based''' virtualization | |||
** KVM tends to be more efficient and performant than QEMU but is also more hardware-dependent. | |||
** QEMU is a type-2 hypervisor. | |||
** '''QEMU can make use of KVM when running a target architecture that is the same as the host architecture.''' Mimicking the performance of a Type-1 Hypervisor. To use KVM pass [https://wiki.qemu.org/Features/KVM --enable-kvm] to QEMU. | |||
** Previously, KVM was a fork of QEMU called qemu-kvm, but this has now been merged into QEMU upstream and the fork has been discontinued. | |||
** QEMU is built on top of QEMU and uses it for device emulation and I/O operations. | |||
* QEMU is using an integrated VNC server to show the guest OS screen instead of relying on the graphical interface of the host OS. | |||
* [https://www.linux.com/learn/intro-to-linux/2017/11/testing-ipv6-networking-kvm-part-1 QEMU/KVM/Virtual Machine Manager] | * [https://www.linux.com/learn/intro-to-linux/2017/11/testing-ipv6-networking-kvm-part-1 QEMU/KVM/Virtual Machine Manager] | ||
** QEMU emulates hardware | ** QEMU emulates hardware (like ARM). QEMU is a userland type 2 (i.e runs upon a host OS) hypervisor. | ||
** KVM is a kernel module that creates the guest state on your CPU and manages access to memory and the CPU. | ** KVM is a kernel module that creates the guest state on your CPU and manages access to memory and the CPU. KVM is a Linux kernel module. It is a type 1 hypervisor. | ||
** Virtual Machine Manager is a lovely graphical overlay to all of this virtualization and hypervisor goodness. | ** Virtual Machine Manager is a lovely graphical overlay to all of this virtualization and hypervisor goodness. | ||
* [[Ubuntu#MultiSystem_.E2.80.93_Create_a_MultiBoot_USB_from_Linux|Ubuntu -> MultibootUSB]] has an option to test ISO (it's called Boot ISO). You can use that to boot a Linux with desktop (but don't too greedy to do other things). | * [[Ubuntu#MultiSystem_.E2.80.93_Create_a_MultiBoot_USB_from_Linux|Ubuntu -> MultibootUSB]] has an option to test ISO (it's called Boot ISO). You can use that to boot a Linux with desktop (but don't too greedy to do other things). | ||
* | * Raspberry Pi ARM | ||
** [https://epicchasgamer.com/2020/10/18/how-to-emulate-raspberry-pi-in-qemu/ How to emulate Raspberry Pi in QEMU] | |||
** [https://www.instructables.com/id/Raspberry-Pi-Emulator-for-Windows-10/ Raspberry Pi Emulator for Windows 10] | |||
* | * Android | ||
* https:// | ** Install Android 8.1 Oreo on Linux to Run Apps & Games. See [[Android#Android-x86|Android x86]]. | ||
* [https://developer.r-project.org/Blog/public/2020/05/29/testing-r-on-emulated-platforms/ Testing R on Emulated Platforms] | |||
* [https://linux.cn/article-13523-1.html?utm_source=rss&utm_medium=rss 使用 QEMU 尝鲜 Windows 11] | |||
* [https://itsfoss.com/quickgui/ Create Windows, macOS, and Linux Virtual Machines Easily With QEMU-based Quickgui] | |||
* [https://raspberrytips.com/qemu-on-ubuntu/ Getting Started With QEMU On Ubuntu – An Illustrated Guide]. '''If your computer has the virtualization technology enabled, you can add –enable-kvm to your command line to speed it up.''' | |||
** [https://www. | |||
** | |||
* [ | |||
* [ | |||
=== [http://www.xenproject.org/ Xen] === | === [http://www.xenproject.org/ Xen] === | ||
Line 966: | Line 1,022: | ||
== What hypervisor software does Google Compute Engine use == | == What hypervisor software does Google Compute Engine use == | ||
Google Compute Engine uses [https://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine KVM] as the hypervisor according to [https://en.wikipedia.org/wiki/Google_Compute_Engine wikipedia]. | Google Compute Engine uses [https://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine KVM] as the hypervisor according to [https://en.wikipedia.org/wiki/Google_Compute_Engine wikipedia]. | ||
== VirtualBox vs VMware Workstation Player vs VMware Workstation Pro vs Microsoft Hyper-V == | |||
* [https://www.pcworld.com/article/1936055/the-best-virtualization-tools-for-windows.html The best virtual machine tools for Windows: Run a PC inside your PC] 6/10/2023. | |||
** The advantage of Hyper-V over the virtualization platforms from Oracle and VMware is the '''dynamic memory management'''. | |||
** Hyper-V comes from the server area of Microsoft. Accordingly, some functions that are useful on the desktop and found with VirtualBox and VMware Workstation Pro are missing, such as support for sound and access to USB devices. The exchange of files between the desktop of the main computer and a virtual PC is also missing, as is a shared clipboard for transferring data. | |||
== VMware vSphere bare-metal Hypervisor/ESXi (free) == | == VMware vSphere bare-metal Hypervisor/ESXi (free) == | ||
Line 972: | Line 1,033: | ||
* [http://www.vmware.com/products/vsphere-hypervisor.html Product page] | * [http://www.vmware.com/products/vsphere-hypervisor.html Product page] | ||
* (Youtube) [https://www.youtube.com/watch?v=48sQjr74XBc Installing vSphere Hypervisor], [https://youtu.be/iL7Biov-6r8?list=PL1l78n6W8zyr-wZWJzRppQUjz6gc_EWzt Lubuntu Install on vSphere virtual machine] | * (Youtube) [https://www.youtube.com/watch?v=48sQjr74XBc Installing vSphere Hypervisor], [https://youtu.be/iL7Biov-6r8?list=PL1l78n6W8zyr-wZWJzRppQUjz6gc_EWzt Lubuntu Install on vSphere virtual machine] | ||
* [https://www.altaro.com/vmware/esxi-free/ Is ESXi Really Free? Let’s put it to the Test] | |||
* [http://blog.cyberexplorer.me/2013/03/improving-vm-to-vm-network-throughput.html Improving VM to VM network throughput on an ESXi platform] | * [http://blog.cyberexplorer.me/2013/03/improving-vm-to-vm-network-throughput.html Improving VM to VM network throughput on an ESXi platform] | ||
Line 1,002: | Line 1,064: | ||
=== Release mouse cursor from VM === | === Release mouse cursor from VM === | ||
Ctrl + Alt. | Ctrl + Alt. | ||
=== Problems === | |||
Vmware workstation 16 player + Ubuntu 16.04 guest and Pop_OS 20.04 host. The desktop flickered and the OS becomes unusable. [https://communities.vmware.com/thread/601045 Workstation 15: Guest screen flickering occasionally - can someone reproduce this issue?] | |||
=== VMware tools === | === VMware tools === | ||
Line 1,014: | Line 1,079: | ||
* number of cpu (need to change when the os is off) | * number of cpu (need to change when the os is off) | ||
* memory (need to change when the os is off) | * memory (need to change when the os is off) | ||
=== Host-only network or NAT === | |||
* [https://www.vmware.com/support/ws45/doc/network_select_ip_ws.html Selecting IP Addresses on a Host-Only Network or NAT Configuration] | |||
* [https://communities.vmware.com/thread/239074 Solved: Why are there 2 Network Adapters from VMNet?]. | |||
By default VMware Workstation offers three networking options: | |||
# VMnet0 (bridged) - that is the connection type used for virtual NIC's which connects the guest transparently to the physical network. | |||
# VMnet1 (host-only) - that is a virtual switch/network where only the guests and the host can participate. On my computer, vmnet1 has 172.16.183.1 | |||
# VMnet8 (NAT) - that is a virtual switch/network which connects the guest to the outside but hidden behind a virtual NAT device. SO it can't be seen from the outside world. On my computer, vmnet8 has 172.16.205.1 | |||
=== Install Workstation or Player on any Linux === | |||
[https://www.linuxlookup.com/howto/install_vmware_workstation_or_vmware_player_bundle_file Install VMware Workstation or VMware Player from a .bundle file] | |||
<pre> | |||
cd dir | |||
sudo sh VMware-Workstation-xxxx-xxxx.architecture.bundle | |||
</pre> | |||
=== Install Centos 7 guest === | |||
<pre> | |||
sudo yum update | |||
sudo yum install -y open-vm-tools | |||
</pre> | |||
''htop'' shows the memory usage is 740 MB. | |||
=== Install Vmware tools in Debian/SparkyLinux guest === | |||
[https://www.sysnettechsolutions.com/en/install-debian-vmware/ Install Debian 10 on VMWare Workstation 15]. The instruction for installing vmware tools works on SparkyLinux 6. Steps: | |||
# Virtual Machine > Install Vmware tools | |||
# Extract VMWareTools tar ball to your home directory | |||
# Open a terminal and cd to vmware-tools-distrib directory | |||
# '''sudo ./vmware-install.pl -d''' . The "-d" option tells to accept all defaults. | |||
# sudo reboot. | |||
SparkyLinux is quite light in terms of memory usage. neofetch shows SparkyLinux uses [https://sparkylinux.org/about/ lightdm-xsession] as DE and openbox as WM. htop shows '''386 MB''' is used. I can install ''gedit'' using ''sudo apt install'' command. I use the rolling release and [https://sparkylinux.org/download/rolling/ MinimalGUI 64bit version]. Sharing folders work but clipboard sharing does not work. It has a stringer requirement for setting the password; something like 'sparkylinux' works. I can change the password afterwards by following this [https://askubuntu.com/a/114244 instruction] by editing the file '''/etc/pam.d/common-password'''. | |||
Is Openbox a desktop environment? | |||
* [https://wiki.debian.org/Openbox Openbox can be used alone, without a desktop environment, or it can be used to replace the window manager in a complete desktop environment. Either way is acceptable.] When I check '''/etc/lightdm/lightdm.conf''' it shows '''user-session=openbox'''. | |||
* [https://wiki.archlinux.org/index.php/Openbox It may be built upon and run independently as the basis of a unique desktop environment, or within other integrated desktop environments such as KDE and Xfce, as an alternative to the window managers they provide.] | |||
=== Install Vmware tools in Ubuntu guest === | === Install Vmware tools in Ubuntu guest === | ||
Line 1,051: | Line 1,154: | ||
</pre> | </pre> | ||
and reboot your VM. | and reboot your VM. | ||
[https://www.cyberciti.biz/faq/ubuntu-linux-install-gnome-desktop-on-server/ Ubuntu 20.04 server + minimal Desktop]. RAM usage is around 850 MB. | |||
=== Manjaro guest machine === | |||
Make sure to allocate at least 2GB RAM. I also use 2 CPUs. I am using manjaro-xfce-20.0.2-minimal-200531-linux56.iso. | |||
[https://manjaro.site/how-to-install-virtualbox-guest-additions-on-manjaro-18-0/ How to Install VirtualBox Guest Additions on Manjaro 18.0] | |||
[https://digitechnews.net/how-to-update-manjaro-using-command-line-in-the-terminal/ How to update Manjaro using command line in the Terminal] | |||
=== Shared Folder === | === Shared Folder === | ||
Line 1,066: | Line 1,178: | ||
See this article in [http://www.howtogeek.com/125640/how-to-convert-virtual-machines-between-virtualbox-and-vmware/ howtogeek.com] | See this article in [http://www.howtogeek.com/125640/how-to-convert-virtual-machines-between-virtualbox-and-vmware/ howtogeek.com] | ||
== Boxes == | |||
* https://help.gnome.org/users/gnome-boxes/stable/ | |||
* https://en.wikipedia.org/wiki/GNOME_Boxes | |||
* [https://www.maketecheasier.com/gnome-boxes-virtual-machine-linux/ Easily Create a Virtual Machine on Linux with Gnome Boxes] | |||
* [https://www.zdnet.com/article/how-to-quickly-spin-up-a-linux-virtual-machine-with-boxes/ How to spin up a Linux virtual machine quickly with Boxes] | |||
* [https://www.debugpoint.com/2020/06/move-virtual-machine-image-another-host/ Move Virtual Machine Image to Another Host Using GNOME Boxes] | |||
* [https://arstechnica.com/gadgets/2020/04/virtualization-on-the-linux-desktop-gnome-boxes-vs-virt-manager/ Gnome Boxes vs virt-manager] | |||
== [http://www.proxmox.com/en/ Proxmox Virtual Environment] == | == [http://www.proxmox.com/en/ Proxmox Virtual Environment] == | ||
[[Self_hosting]] | |||
== Proxmox Backup Server == | |||
* https:// | * [https://youtu.be/33ubleU4OFc Proxmox Backup Server: Full Getting Started Guide!] (video) | ||
* [https:// | * [https://youtu.be/n_JZ2aXMMmI Setting Up a Proxmox Backup Server] (video) | ||
== [http://www.ovirt.org/Home oVirt] == | == [http://www.ovirt.org/Home oVirt] == | ||
Line 1,092: | Line 1,206: | ||
= How Do You Safely Run an Untrusted Executable File on Linux = | = How Do You Safely Run an Untrusted Executable File on Linux = | ||
[https://firejail.wordpress.com/ Firejail]. See [http://www.howtogeek.com/285595/how-do-you-safely-run-an-untrusted-executable-file-on-linux/ this post]. | [https://firejail.wordpress.com/ Firejail]. See [http://www.howtogeek.com/285595/how-do-you-safely-run-an-untrusted-executable-file-on-linux/ this post]. | ||
= Security = | |||
[https://youtu.be/Cs8yOmTJNYQ Self-Hosting Security Guide for your HomeLab] (video) | |||
= Ways to Use a Virtual Machine = | |||
* [https://youtu.be/SVQmzaSabEQ 20 Ways to Use a Virtual Machine (and other ideas for your homelab)] (video) | |||
* [[Server|Server]] and ports | |||
= 8個DevOps好用工具大介紹 = | = 8個DevOps好用工具大介紹 = |
Revision as of 13:36, 15 May 2024
VMWare workstation player is more robust than VirtualBox. The screen size is large before installing vmware tools and vmware tools just work after installation.
(Update) KVM is more robust than VMWare. This assumes the host is a Linux box.
Windows Host
Windows 11
How to Install a Virtual Machine on Windows 11
Uninstall
- Uninstall virtualbox drivers http://dottech.org/101997/how-to-uninstall-virtualbox-drivers-on-windows/. I found the drivers and registry are cleaned out after we run uninstall Oracle Virtualbox.
Error In supR3HardenedWinReSpawn
I got this error when I installed Virtualbox 4.3.30 and 5.0.4 on my office Windows machine.
It may be caused by Anti-virus software. See http://superuser.com/questions/791352/virtual-box-error-after-creating-new-vm
It seems the error cannot be resolved on Windows machine. Try VMWare player.
The problem of cannot upgrading VirtualBox on my Windows desktop is I cannot run or import Windows 10 guest machines.
NOTE: I got the error when I try to install the guest addition on NIH computers. The solution is to run VirtualBox as an elevated account and then go to the Preferences to install the guest addition. After that, it works.
Ubuntu Host
Upgrade from 5.2 to 6.0
Need to uninstall 5.2 extension pack and then uninstall Virtualbox.
Install 6.0 and then launch existing guest machines. It may complain USB compatibility. After disable USB, it works.
I also follow Install VirtualBox Extension Pack on VirtualBox 6.0 May 2019.
Install VirualBox using Oracle’s repository: automatic update
How to Install VirtualBox on Ubuntu [Beginner’s Tutorial]
Install virtual machines from non-root users
Yes, it works.
Install on a headless server, phpVirtualBox
- How to Install Oracle VirtualBox On Ubuntu 18.04 LTS Headless Server
- phpVirtualBox is a web-based front-end tool for VirtualBox
Uninstall
sudo apt-get remove virtualbox-\*
Check if hardware (CPU) supports virtualization
egrep -c '(vmx|svm)' /proc/cpuinfo
- If 0 it means that your CPU doesn't support hardware virtualization.
- If 1 (or more) it does - but you still need to make sure that virtualization is enabled in the BIOS.
If your CPU does not supports hardware virtualization, you can only install 32-bit virtual machines (not 64-bit).
IOMMU
Virtualization in the host machine
Note that even the host machine is 64-bit, if the vT is not available/enabled in the BIOS, we cannot install 64-bit OS in the guest machine.
Booting and EFI
BIOS mode and UEFI mode.
- How to Enable EFI on VirtualBox Virtual Machines Running Linux
- Linux distro review: Intel’s own Clear Linux OS
- Clear Linux* OS on VirtualBox
- Install Clear Linux (Intel Linux OS) on a Virtual Machine using VirtualBox
A caution about Ubuntu guest machine
Compiz
The regular Ubuntu OS uses 'compiz' which takes too much CPU power (50% to 100%) in virtual machine. Better to use others like xubuntu or lubuntu.
Language Pack
One step in the installation is to download language packs. It may a long time to do that. So it is better to hit the 'Skip' button once it is in this step.
VirtualBox guest addition
See http://www.virtualbox.org/manual/ch04.html for the instruction for different OS.
Installation In Ubuntu, Linux Mint, Debian And Fedora (updated for VB 6.0)
For any Linux guest machine, we need to install dkms package BEFORE installing guest addition.
sudo apt-get install virtualbox-guest-dkms
Virtualbox guest additions common errors
Virtualbox guest additions common errors. Eg for Permission denied, In /etc/fstab, change this: /dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0 to this: /dev/sr0 /media/cdrom0 udf,iso9660 user,exec 0 0.
Debian
Install guest addition for virtualbox on Debian See an instruction here.
The instruction is helpful on Debian w/o a graphical desktop.
- Login as root; Or type 'su' and the required password to log in as root.
- Update your APT database with apt-get update;
- Install the latest security updates with apt-get upgrade;
- Install required packages with apt-get install build-essential module-assistant;
- Configure your system for building kernel modules by running m-a prepare;
- Click on Install Guest Additions… from the Devices menu. If the Debian has no graphical desktop, then run mount /media/cdrom0.
- Run sh /media/cdrom0/VBoxLinuxAdditions.run, and follow the instructions on screen.
We can check the extension pack version or if it was installed by going to the File -> Preferences -> Extensions.
Unfortunately the guest addition does not work with the current version of Debian (8.1.0) for some reason: Building the share folder support module fail!
Check installed Guest Additions version
modinfo vboxguest # or lsmod | grep -io vboxguest | xargs modinfo | grep -iw version
Centos and header not found (it is actually mismatch)
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 # to set ''ONBOOT'' to yes. yum -y install epel-release yum install dkms yum groupinstall "Development Tools" yum install kernel-headers-$(uname -r) kernel-devel-$(uname -r) # Above is a correction of yum install kernel-devel # insert guest additions cd image and run Linux executable # reboot
Reference:
Server
The guest additions works on both Linux desktop and server.
How to mount the guest additions cd-rom Install VirtualBox Guest Additions in CentOS, RHEL & Fedora
$ su # mount -r /dev/cdrom /media # cd /media/ # ./VBoxLinuxAdditions.run
virtual machine software benchmark
Trouble Shooting
Forum
Software Rendering Mode
Shut down the Linux VM. Edit the VM settings in VirtualBox. Click "Display -> Enable 3D Acceleration".
Black screen or fuzzy screen
The problem happened when I installed Ubuntu 16.04 for example.
Try to increase the display memory and enable 3D (emulate GPU, useful for a Desktop instead of Server environment). ** But this has to be done before installing Ubuntu virtual machines. ** This post contains a screenshot of the problem and a different solution on Ubuntu 14. This post from http://askubuntu.com/ provides another solution.
Host+F1 and Host+F7 method works on my Ubuntu 16.04 and Lxle 16.04 guest. If my host is already Ubuntu, I want to use RightCtrl + F1 and RightCtrl + F7 to switch between the terminal and the graphical desktop (the fuzzy screen will disappear and the normal installation screen will appear). If my host is Windows OS, I can use Ctrl + Alt + F1 and Ctrl + Alt + F7 to switch.
Sometimes it is the grub menu problem. Press F6 and selected nomodeset.
Upgrade Difficulty
When it is impossible to find a solution for some unknown errors when installing a new build of VB, it is worthy to go back to install an old build of VB.
The old build & extension pack of VB can be downloaded from https://www.virtualbox.org/wiki/Download_Old_Builds.
For example, I always got an error 'supR3HardenedWinReSpawn'. The following screenshot shows an error when I tried to upgrade from v4.3.12 to v5.0
The log file shows something like
13d8.c54: supR3HardenedMonitor_LdrLoadDll: error opening 'C:\Windows\system32\wintab32.dll': 0 (NtPath=\??\C:\Windows\system32\wintab32.dll; Input=C:\Windows\system32\wintab32.dll)
The only solution is to install an old version of VB.
How To Fix Upgrading Ubuntu Repositories VirtualBox To Oracle-Provided VirtualBox Ubuntu 19.10.
the headers of the current running kernel were not found
sudo apt-get install dkms build-essential linux-headers-$(uname -r) dpkg --get-selections | grep linux-headers
For some reason when the above is run and /media/$USER/VBOXADDITIONS_w.x.y_z/VBoxLinuxAdditions.run is run, the header becomes old and we have to run it again to get new headers??
If this has not solved the problem, another try is to run
sudo apt-get install virtualbox-guest-dkms # install dkms virtualbox-guest-utils virtualbox-guest-x11
See
- http://ubuntuforums.org/showthread.php?t=2198058
- http://askubuntu.com/questions/104440/how-do-you-resize-the-standard-ubuntu-desktop-inside-of-virtualbox
Unfortunately the above methods do not solve the issue.
The only solution is to create the desired virtual machine (eg Ubuntu 14.04) on another host computer which has a newer version of Virtualbox and a working Guest Addition function. Then export the virtual machine from that host and import the virtual machine into my host with an old version of Virtualbox.
virtualbox failed to create the host-only network
Virtualbox (*.deb) was downloaded from virtualbox website. However, when I want to create a host-only network, I have to execute
sudo /etc/init.d/vboxdrv setup sudo apt-get install dkms build-essential linux-headers-$(uname -r)
This also solves the error "Kernel driver not installed (rc=-1908)".
How To Fix “Kernel driver not installed (rc=-1908)” VirtualBox Error In Ubuntu 18.04.
Error 0x000000C4 & Windows 8.1 guest machine
The problem happened on my Xeon CPU Windows & Ubuntu machines, but not my Pentium cpu Ubuntu machine.
The solution is to run the following line (remove the path if it is run under Linux) first before installing Windows 8.1.
“c:\Program Files\Oracle\VirtualBox\VBoxManage.exe” setextradata “<Virtual Machine Name Here>” VBoxInternal/CPUM/CMPXCHG16B 1
Check the guest machine version
From the guest machine
ls /opt/ # VBoxGuestAdditions-5.0.10 /opt/VBoxGuestAdditions-5.0.10/bin/VBoxControl -v # 5.0.14r105127
VERR_PDM_DEVHLPR3_VERSION_MISMATCH
Mismatch of the vbox and extension
Log file
$HOME/VirtualBox VMs/{machinename}/Logs. See Manual
No internet access on Centos guest machine
Follow Install a CentOS 7 Minimal Virtual Machine with VirtualBox and modify the file /etc/sysconfig/network-scripts/ifcfg-enp0s3 to set ONBOOT to yes.
Screen Resolution Too Small During Installation
Trick:
- install Virtualbox Extension Pack
- In the guest OS, go to setting and increase the screens resolution from the least 800x600 (4:3) to a better one,e.g. 1024x768 (4:3) or 1280x800 (16:10).
Mac host
Error unsupported version 6 of data unit 'hda'
I use VB 5.1.x. When I upgrade VB to 6.0.4, I cannot open (Saved) Windows 10 virtual machine.
Solution 1: Use Import Appliance method. Solution (works!) 2. Downgrade VirtualBox to 5.2.x or 5.1.x.
Use VirtualBox
Host key
Right control key. It is shown on the right bottom corner of the virtual machine.
Download virtual disk images
The 3 Best Sites to Download Virtual Disk Images for VirtualBox
Nested VM
How to Set Up a Virtual Machine in Another Virtual Machine? Nested Virtualization Explained
Hard disk file type & splitting
Difference of file types really only matters if you're planning to use the same virtual hard disk with another virtualization provider.
You can switch to the Expert mode where it allows to split the image into files of less than 2GB (VMDK file type only). It seems splitting has an advantage for backing up and also for the FAT32 partition/network share file size restriction. As for performance, splitting has no advantage.
See Should I split VMware virtual disk into multiple files or not?
VDI (virtual disk image)
Default
VHD (virtual hard disk)
Used by Microsoft VirtualPC
VMDK (virtual machine disk)
Used by VMWare.
How to Open a VMDK File in VirtualBox
HDD
Compatibility with Mac parallels.
QCOW
QEMU Copy-On-Write
QED
QMU enhanced disk
How to Convert Between Fixed and Dynamic Disks
https://www.howtogeek.com/312456/how-to-convert-between-fixed-and-dynamic-disks-in-virtualbox/
Virtual networks
What's the Difference Between NAT, Bridge, and Host-Only Network Modes?
- NAT: Network Address Translation (NAT) service works in a similar way to a home router. It groups systems using it into a network and prevents outside systems from directly accessing those inside, while letting systems inside communicate with each other and outside systems using TCP and UDP over IPv4 and IPv6.
- Bridge. See How to Configure Static IP Address on Ubuntu 20.04 (host machine)
- Host Only: Host can access guest, but not the other direction. Outside cannot access guests. Good for running a test web server.
- Internal Network: Guests can access each other but host still cannot access guests. This is good for testing when you need a separate, clean network, and you can create sophisticated internal networks with vm's that provide their own services to the internal network. (e.g. Active Directory, DHCP, etc).
Speed consideration
- Bridged adapter connection is faster than the default (NAT) network. See p25 here.
Host-Only
First of all, click File > Host Network Manager... Click the 'Create' button to create a new network. By default, its name is "vboxnet0", IPV4 Address/Mask is 192.168.56.1/24 and DHCP Server is enabled. Now the name "vboxnet0" will appear in the "Name" of the dropdown list of the Host-only Adapter.
The 'Adapter' tab has the following values
- IPv4 address: 192.168.56.1 (seen from running 'ifconfig' in the host machine)
- IPv4 network mask: 255.255.255.0
The 'DHCP Server' tab has the following values
- check Enable Server
- Server Address: 192.168.56.100
- Server mask: 255.255.255.0
- Lower address bound: 192.168.56.101
- Upper address bound: 192.168.56.254
Note that the virtual machine can ALWAYS ssh to the host by ssh [email protected] even though the ifconfig command does not show 192.168.56.* address. But if host-only is enabled in the VM, host can ssh to VM.
To create a static IP on the guest machine, modify /etc/network/interfaces so it looks like (Hint: use ip add to check the ip information)
auto enp0s3 iface enp0s3 inet static address 192.168.56.5 network 192.168.56.0 netmask 255.255.255.0 dns-nameservers 8.8.8.8 192.168.56.1
If I repeatly create & delete a VM with a host-only network, I found the IPV4 may be missing from the VM. I play a trick by adding another network which solved the problem.
Articles how to make use of host-only network
- Oracle VM VirtualBox: Host-only Networking to run servers securely
- A short guide to networking in Virtual Box with Oracle Linux inside
- VirtualBox: Configuring Static IPs for VMs
- Advanced Virtualbox and Vagrant tips for VLAN,PXE and Hostonly networking
- Host-only Networking in VirtualBox
- Use command lines to configure host-only network
Internal Network
The Ip address for internal network is ipv6 (at least seen from Ubuntu guest machine).
inet6 addr: fe80::a00:27ff:fecb:966c/64
We can test it by pinging it from another machine (say Windows). Note that even it first shows Destination host unreachable, the 3 replies lines shows the pinging is successful.
C:\Users\brb>ping fe80::a00:27ff:fecb:966c Pinging fe80::a00:27ff:fecb:966c with 32 bytes of data: Destination host unreachable. Reply from fe80::a00:27ff:fecb:966c: time=1ms Reply from fe80::a00:27ff:fecb:966c: time<1ms Reply from fe80::a00:27ff:fecb:966c: time<1ms Ping statistics for fe80::a00:27ff:fecb:966c: Packets: Sent = 4, Received = 3, Lost = 1 (25% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 1ms, Average = 0ms C:\Users\brb>netstat -rn =========================================================================== Interface List 20...08 00 27 62 8c 1c ......Intel(R) PRO/1000 MT Desktop Adapter #2 11...08 00 27 86 6d 29 ......Intel(R) PRO/1000 MT Desktop Adapter 1...........................Software Loopback Interface 1 12...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter 13...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface 14...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2 =========================================================================== IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.0.2.2 10.0.2.15 10 10.0.2.0 255.255.255.0 On-link 10.0.2.15 266 10.0.2.15 255.255.255.255 On-link 10.0.2.15 266 10.0.2.255 255.255.255.255 On-link 10.0.2.15 266 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 169.254.0.0 255.255.0.0 On-link 169.254.200.31 266 169.254.200.31 255.255.255.255 On-link 169.254.200.31 266 169.254.255.255 255.255.255.255 On-link 169.254.200.31 266 224.0.0.0 240.0.0.0 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 10.0.2.15 266 224.0.0.0 240.0.0.0 On-link 169.254.200.31 266 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 10.0.2.15 266 255.255.255.255 255.255.255.255 On-link 169.254.200.31 266 =========================================================================== Persistent Routes: None IPv6 Route Table =========================================================================== Active Routes: If Metric Network Destination Gateway 1 306 ::1/128 On-link 11 266 fe80::/64 On-link 20 266 fe80::/64 On-link 20 266 fe80::28f6:df10:9926:c81f/128 On-link 11 266 fe80::48bc:2c38:765d:f88f/128 On-link 1 306 ff00::/8 On-link 11 266 ff00::/8 On-link 20 266 ff00::/8 On-link =========================================================================== Persistent Routes: None
Network Adapter Types
The default is 'PCnet-PCI II'. Change to other adapter type like 'PCnet-FAST III' or 'Paravirtualized Network (virtio-net)'. See this post
Suppose we want to share some folder from host to guest. Assume in Virtualbox, we use "Downloads" as the folder name in Share Folders dialog.
It is best to change the share folders settings when the guest machine is off. Otherwise we still need to restart the machine for the change of settings to be effective. The shared folder is under /media/ (just like external USB drive) with sf_ as prefix.
Method 1: Use Auto-mount option built in VirtualBox. But I get a permission denied error (This location could not be displayed). The reason is the shared folder is mounted with 770 permissions with root user and vboxsf as the group. We can switch to root user to access the folder (sudo su) or we can add the current user to vboxsf group by using the usermod command.
sudo usermod -aG vboxsf $USER # OR sudo adduser $USER vboxsf
Then reboot the system.
We can then use
id USERNAME
to verify you are in the vboxsf group.
Method 2: (Manual mount) We can use the following method to get an access to Downloads folder for this session only. See also howtogeek.com.
sudo mkdir /mnt/Downloads # Suppose we use the VirtualBox's Settings to add a new shared folder called 'Downloads' which # will be accessed from an existing directory /media/downloads. sudo mount -t vboxsf Downloads /mnt/Downloads
Method 3: We can use the following method for a permanent solution (why do we want to do that since Method 1 works well already).
sudo nano /etc/fstab sudo mkdir /mnt/Downloads # Add a new line # Downloads /mnt/Downloads/ vboxsf defaults 0 0 sudo mount -a
PS: There is a bug in virtualbox 4.3.10 which results an error
mount: wrong fs type, bad option, bad superblock on hostshare, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so
The solution is to run
sudo rm /sbin/mount.vboxsf sudo ln -sf /usrs/lib/x86_64-linux-gnu/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf
Windows guest machine + file sharing
In the File Explorer, one needs to check 'Turn on network discovery and file sharing' in order to use see the shared folder in the File Explorer (called File sharing in Windows). The shared folder is under Network > VBOXSVR directory.
Limitations
If we try to extract a tarball containing symbolic links files to a shared folder (mounted external drive formatted as an EXT3 partition or even one folder from the host machine running Ubuntu), these files cannot be extracted to the shared folder.
2nd hard drive
For some applications on Windows guest machines, the share folder does not work. We need to create a 2nd hard drive.
Create another SATA vdi is easy in virtual machine's setting. After it is created, go to the Administrative Tools -> Computer Management -> Disk Management to format it for use in Windows.
Seamless mode
If we want to run the app from guest machine on host machine (to hide the guest machine desktop) so the app looks like from the host machine, we can head to View->Switch to Seamless Mode in VirtualBox.
Snapshots
If we are installing a sketchy program, we can take a snapshot, install the program, then revert to your snapshot if things go wrong.
http://www.howtogeek.com/150258/how-to-save-time-by-using-snapshots-in-virtualbox/
Create a snapshot
- Create a clean machine.
- There are two ways:
- (When the VM is off) Switch from 'Details' to 'Snapshots' on the right-hand side of the VB window. Right click 'Current State' and click 'Create Snapshot'.
- (When the VM is on) Machine > Take a snapshot. Give it an intuitive name and description. Shutdown the current machine (This seems to be a good practice every time after we create a VM).
After we open an original snapshot and do not nothing, when we shutdown the VM, the VM status is 'changed'.
Restore a snapshot
- Select the Virtual machine from the list and switch over to the snapshots view (top-right corner). Right click a snapshot and choose 'Restore snapshot'. Uncheck the option of 'Create a snapshot of the current machine state'. Click 'Restore'.
- You should see the "Current State(changed)" will become "Current State" the same as the snapshot you selected to restore to.
- If we have a snapshot called original at the top, and a child snapshot, then running restore a snapshot on the root will move the "Current State" from under the child snapshot to the root snapshot. That is we have two children snapshots now (one of them is 'Current State').
Note that
- There is only one 'Current State' no matter how many snapshots we have created.
- If we stop the mouse at any snapshot and double click to run the VM, it still pick the 'Current State' to run. The title bar on the virtual machine will show which snapshot it is running.
- When we right click 'Restore snapshot' and choose 'Create a snapshot of the current machine', it will create a snapshot under the image we have selected. See the next plot
- If we run the VM on snapshot1 and use apt-get to install eg gfortran package, the current state will be changed. Now if we shutdown the machine and right click 'Restore snapshot' & check 'Create a snapshot of the current machine state'. A snapshot named 'Snapshot 2' will be created nested under 'Snapshot 1'.
- Again if we run the VM (may be through right click 'Restore Snapshot' if we want to run the VM based on a specific snapshot), the title bar on the virtual machine will show which snapshot it is based on. For example, if the Current State is nested under 'Snapshot 1', then the image is based on 'Snapshot 1'.
- If we do not try to take snapshot on 'Current State', anything we have done on a 'Current State' based on whatever snapshot could be lost after the VM is shutdown.
Clone
It will give an option of 'Full Clone' and 'Linked clone'. After that, it will give an option to choose which parts of the snapshot tree should be cloned with the machine: 'Current machine state' and 'Everything'.
See the screenshots.
Clone vs Import/Export appliance
Clone will create a new VM directory (including *.vdi) on the same machine.
Import/Export appliance (*.ova) allows to transport the appliance to a new machine.
- The appliance will not be touched on the new machine.
- The storage space cannot be adjust when we import an appliance.
- The .ova file can be opened in VMware Play.
Export to ova vs ovf
- ova file is only 1 file. This will create a problem when we want to back up or transfer a large ova file. OVA is a tar archive containing the OVF package files.
> tar xvf my.ova my.ovf my.mf my.vmdk
- ovf: several files will be written. An OVF is a collection of items in a single folder. Most commonly this is a description file (.ovf) a manifest file (.mf), and virtual machine state files (*.vhd or *.vmdk). These files must then reside in the same directory for VirtualBox to be able to import them. PS. vmdk file is about the same size of ova. So the ovf method has no advantage over ova.
Back up ova
vboxmanage list vms # export vboxmanage export UBUNTUSERVER164 -o ubuntu_server_new.ova # import vboxmanage import ubuntu_server_new.ova
- Use the 'split' and 'md5sum' commands. See Split large files before transfer.
# backup cd ~/Documents # default location when export using virtualbox split -d -b 2G windows10.ova windows10.ova. md5sum windows10.ova.* > windows10.md5 rsync -avz windows10.ova.* /mnt/wd4t/windows10/2019-09-09/ --progress cp -r windows10.md5 /mnt/wd4t/windows10/2019-09-09/ md5sum windows10.ova # optional # restore cd /mnt/wd4t/windows10/2019-09-09 md5sum -c windows10.md5 ## DON'T do the following on the external drive (slow) ## ONLY do merge on the internal drive cat windows10.md5.* > windows10.ova # split files are still there md5sum windows10.ova # optional
Import vmdk
How to Open a VMDK File in VirtualBox. Note: if you move the location of the VMDK file the VirtualBox machine will no longer boot until the VMDK file is located again.
Clonezilla: Transfer the VM to an actual computer
Install Ubuntu with Clonezilla & VirtualBox pp23-25.
Take the VDI file and decompress it into a directory. The files need to be transferred to the target computer.
Clonezilla allows us to boot up a system to be cloned and then make a copy/image of its hard drive (virtual machine in our case).
Once the image has been made, the target computer can be boot up from Clonezilla and the image restored to the target hard drive.
Some experiences:
- On my lenovo lynx tablet, Clonezilla only shows its figure without texts.
- On my hp stream 8 tablet, Clonezilla does not take 'Enter' key when I use my Anker's wireless keyboard.
Change screen resolution
VBoxManage controlvm "Your VM" setvideomodehint 1366 768 32 # inexpensive tablets, chromebooks, notebooks VBoxManage controlvm "Your VM" setvideomodehint 1280 800 32 VBoxManage controlvm "Your VM" setvideomodehint 1280 960 32
See Screen resolution? Aspect ratio? What do 720p, 1080p, 1440p, 4K and 8K mean? for a list of some common screen resolutions.
- 4:3 aspect ratio resolutions: 640×480, 800×600, 960×720, 1024×768, 1280×960, 1400×1050, 1440×1080 , 1600×1200, 1856×1392, 1920×1440, and 2048×1536.
- 16:10 aspect ratio resolutions: - 1280×800, 1440×900, 1680×1050, 1920×1200 and 2560×1600.
- 16:9 aspect ratio resolutions: 1024×576, 1152×648, 1280×720, 1366×768, 1600×900, 1920×1080, 2560×1440 and 3840×2160
Take a screenshot
- Method 1. Use 'snipping tool' in Windows 7 to make a screenshot of a desired region to a clipboard. When the 'New' button is clicked, the whole Windows desktop will be less clear. Users can use the mouse to select a region. When we select a rectangle region, the region will become clear. After we release the mouse, the region will be shown on the snipping tool application. In fact, the region will also be on Windows clipboard. So if the VirtualBox has enabled shared clipboard for both directions, we can access the clipboard on Ubuntu host OS.
- Method 2. Use the command line in the host machine to take a screenshot of the whole guest OS. See http://www.dedoimedo.com/computers/virtualbox-screenshot.html
VBoxManage controlvm <VM_NAME> screenshotpng <FILENAME>
To copy the image to the clipboard, I open the file in gthumb program. Then using Edit -> Copy the image to copy the image to the clipboard. If I leave the gthumb program open, it will update the image when I use the same file name to make a new screenshot on the command line.
- Method 3. Use the keyboard short Host + E in the VirtualBox. It will ask a file name to save the screenshot. Not that convenient if my purpose is to copy the image to the clipboard.
Port forward
If you’d like to run server software inside a virtual machine, you’ll probably want to set up port forwarding so the server software is reachable from outside of the virtual machine. You’ll find this option in the Network settings pane, under Advanced.
If we change to use the 'Bridged' network, we don't need to use port forward. We use 'port forward' if we use the default 'NAT' network.
- GUI method: http://www.howtogeek.com/122641/how-to-forward-ports-to-a-virtual-machine-and-use-it-as-a-server/
- Command line method: http://www.linuxjournal.com/content/tech-tip-port-forwarding-virtualbox-vboxmanage.
$ # Set up incoming NAT connections to an ssh server in the guest; $ # all TCP traffic arriving on port 2222 on any host interface will be forwarded to port 22 in the guest. $ VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22" $ # The number after --natpf denotes the network card $ # The name guestssh is purely descriptive and will be auto-generated if omitted. $ $ # To remove this forwarding rule again $ VBoxManage modifyvm "VM name" --natpf1 delete "guestssh"
There are some limitations of NAT port forwarding. For example, forwarding host ports lower than 1024 impossible. See section 6.3.3 on the VirtualBox Manual for more information.
Mouse in virtual consoles (not desktop environment)
How To Configure Mouse Support For Linux Virtual Consoles
Remote Desktop Connection
Guest: ubuntu 14.04. Client: Windows/Ubuntu
Method 1: use guest machine IP. (not preferred)
- Make sure the guest machine has a bridge network. In my case, my host machine is using a wireless adapter so I pick Name='wlan0' in the Adapter2. The 'ipconfig' command shows my eth1 adapter has an address 192.168.1.244.
- The guest machine needs to install vnc software. On my ubuntu 14.04 Unity, I follow the instruction on this to install xrdp, xfce4 and others.
- On the Virtual machine -> Settings -> Display -> Remote Display, check the option 'Enable Server' and click OK. (note that the port number is 3389).
- On my Windows desktop, open Remote Desktop Connection client (mstsc.exe), type 192.168.1.244:3389 and then in the next screen type the username and password of the Ubuntu 14.04.
We shall be able to see the xfce4 desktop on Windows machine.
Method 2: use host machine IP.
nmap command shows port 3389 is open on the host machine.
So both the guest machine and Windows client can control the same desktop.
For some reason, method 1 stopped working. However, if I use the host machine ip and port 3389 to connect. I will see the exact desktop environment (Unity) as the guest machine.
I can also test the connection from the Ubuntu host machine. In Remmina, I type localhost:3389 with username/password. It works. Note that the Protocol has to be RDP - Remote Desktop Protocol; VNC will not work.
One problem I met is I got a message Because of an error in data encryption, this session will end. Please try connecting to the remote computer again. after a while.
Increase the guest machine space
- http://www.dedoimedo.com/computers/virtualbox-shrink-expand-disks.html
- How To Enlarge a Virtual Machine’s Disk in VirtualBox or VMware
Boot virtual machines from USB drives
http://www.howtogeek.com/187721/how-to-boot-from-a-usb-drive-in-virtualbox/
Start virtual machine when the system boots up
Windows guest machine screen/display resolution
The available selection of the display resolution:
- 1600 x 1200 (win10)
- 1280 x 1024 (win10)
- 1152 x 864
- 1024 x 768
- 800 x 600 (win7)
Fix Virtualbox Windows HiDPI Mac Retina Display Blurry Text
Windows 11
How to Install Windows 11 Enterprise in Your VirtualBox
Hackintosh
- http://hintdesk.com/how-to-install-mac-os-x-yosemite-10-10-on-virtualbox/ vmdk file for Yosemite is downloadable.
PCI passthrough via OVMF
It is now possible to pass through a graphics card using qemu and KVM. It offers the VM native graphics performance which is useful for graphic-intensive tasks. See https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF
Manage virtual machines
VBoxManage
VBoxManage list
# list all virtual machines VBoxManage list vms # lists all currently running virtual machines VBoxManage list runningvms # displays all VirtualBox extension packs currently installed VBoxManage list extpacks
VBoxManage createvm
This command creates a new XML virtual machine definition file.
VBoxManage startvm
This command starts a virtual machine that is currently in the "Powered off" or "Saved" states
VBoxManage startvm <vm>
VBoxManage controlvm
VBoxManage controlvm <vm> savestate # Use VBoxManage startvm <vm> to start up again VBoxManage controlvm <vm> acpipowerbutton VBoxManage controlvm <vm> poweroff
VBoxManage showvminfo
VBoxManage showvminfo "Windows XP"
VBoxManage modifyvm
This command changes the properties of a registered virtual machine which is not running.
vagrant
- http://en.wikipedia.org/wiki/Vagrant_(software)
- https://taichimd.us/mediawiki/index.php/Vagrant
- http://www.vagrantbox.es/ubuntu
- If we want to use Vagrant + vmware, we need to pay money. And it only works on Vmware workstation not Vmware player.
- Complete guide for creating Vagrant boxes with VirtualBox
Vagrant boxes
Why vagrant
Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team.
To achieve its magic, Vagrant stands on the shoulders of giants. Machines are provisioned on top of VirtualBox, VMware, AWS, or any other provider. Then, industry-standard provisioning tools such as shell scripts, Chef, or Puppet, can be used to automatically install and configure software on the machine.
Tested on an Ubuntu host machine
$ sudo dpkg --install vagrant_1.7.1_x86_64.deb [sudo] password for mli: Selecting previously unselected package vagrant. (Reading database ... 209831 files and directories currently installed.) Unpacking vagrant (from vagrant_1.7.1_x86_64.deb) ... $ vagrant init hashicorp/precise32 # No 'sudo' is needed A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. $ cat Vagrantfile $ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Box 'hashicorp/precise32' could not be found. Attempting to find and install... default: Box Provider: virtualbox default: Box Version: >= 0 ==> default: Loading metadata for box 'hashicorp/precise32' default: URL: https://atlas.hashicorp.com/hashicorp/precise32 ==> default: Adding box 'hashicorp/precise32' (v1.0.0) for provider: virtualbox default: Downloading: https://atlas.hashicorp.com/hashicorp/boxes/precise32/versions/1.0.0/providers/virtualbox.box ==> default: Successfully added box 'hashicorp/precise32' (v1.0.0) for 'virtualbox'! ==> default: Importing base box 'hashicorp/precise32'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'hashicorp/precise32' is up to date... ==> default: Setting the name of the VM: Downloads_default_1420231386363_57276 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 22 => 2222 (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Connection timeout. Retrying... default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if its present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... default: The guest additions on this VM do not match the installed version of default: VirtualBox! In most cases this is fine, but in rare cases it can default: prevent things such as shared folders from working properly. If you see default: shared folder errors, please make sure the guest additions within the default: virtual machine match the version of VirtualBox you have installed on default: your host and reload your VM. default: default: Guest Additions Version: 4.2.0 default: VirtualBox Version: 4.3 ==> default: Mounting shared folders... default: /vagrant => /home/mli/Downloads $ vagrant destroy
More
$ vagrant box add ubuntu/trusty64 $ vagrant up $ vagrant ssh $ vagrant destroy $$ ls /vagrant # Web server $ nano bootstrap.sh $ nano Vagrantfile # add provision $ vagrant --provision $ vagrant ssh $ nano Vagrantfile # add port forward $ vagrant reload # Share $ vagrant login $ vagrant share Ctrl + C # Teardown $ vagrant suspend $ vagrant halt $ vagrant destroy # Provider $ vagrant up --provider=vmware_fusion
Install on a Windows machine
Note: If we want to use Vagrant with Virtualbox, we need to install Virtualbox separately. Vagrant does not include Virtualbox in its installer. Vagrant's installer (~150MB) only installs itself.
Go to the Download page to download Windows version (no separate 32 or 64-bit versions). The program will be installed onto C:\HashiCorp directory.
I can install Virtualbox and Vagrant on a virtual Windows 7 guest machine. This is a great advantage of vagrant over docker in that I cannot run (installation is fine) dock2boot on a Windows 7 guest machine (Docker requires a real Windows to work). But it is perfect OK to install and run docker on an Ubuntu guest machine.
After installing virtualbox & vagrant, vagrant will be available on a global environment. That said, we can open a command window and start to run 'vagrant'.
C:\Users\brb>vagrant init hashicorp/precise32 A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. C:\Users\brb>vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'hashicorp/precise32'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'hashicorp/precise32' is up to date... ==> default: Setting the name of the VM: brb_default_1421961025717_91472 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... ... default: Guest Additions Version: 4.2.0 default: VirtualBox Version: 4.3 ==> default: Mounting shared folders... default: /vagrant => C:/Users/brb C:\Users\brb> C:\Users\brb>vagrant ssh `ssh` executable not found in any directories in the %PATH% variable. Is an SSH client installed? Try installing Cygwin, MinGW or Git, all of which contain an SSH client. Or use your favorite SSH client with the following authentication information shown below: Host: 127.0.0.1 Port: 2222 Username: vagrant Private key: C:/Users/brb/.vagrant/machines/default/virtualbox/private_key C:\Users\brb>
The next step is to use Putty to connect to the virtual machine. We can follow the instruction at https://github.com/Varying-Vagrant-Vagrants/VVV/wiki/Connect-to-Your-Vagrant-Virtual-Machine-with-PuTTY. However, the private key used for conversion is not the one as described in the article. We should uses the private key indicated in the above message (C:/Users/brb/.vagrant/machines/default/virtualbox/private_key in this case).
Note that when we run 'vagrant up', we will see a new VM was created in VirtualBox and once we run 'vagrant destroy', the VM will be deleted.
If we run 'vagrant destroy' and then 'vagrant up' again, the old private key will not work in the new guest machine.
Sharing a Windows/host folder in Vagrant vm
See the tutorial video on youtube. In this example, an apache is created in vm. The goal is to install Apache in the vm and use a folder on Windows/host system as the DocumentRoot.
First we edit Vagrantfile, uncomment 'config.vm.network' line, and modify ip as anything you want. After we modify Vagrantfile, we can issue 'vagrant reload' to make the change effective immediately.
Now use 'vagrant ssh' to ssh to the vm and install apache2, ... and start apache2.
The interesting thing is if we create a new subfolder (/vagrant/www) in the vm, this folder will appear in the Windows/host system as well. If we change /etc/apache2/sites-available/default file AND modify DocumentRoot to /vagrant/www, <Directory> to /vagrant/www, and AllowOverwrite to None, we will be able to use the www subdirectory from the Windows/host system as the DocumentRoot for the Apache in the vm.
Use vagrant with Docker (instead of VirtualBox) provider
Use vagrant to run a VM remote desktop with desktop environment
How to setup a LAMP/Web Stack development environment
- https://www.howtoforge.com/tutorial/vagrant-ubuntu-linux-apache-mysql-php-lamp/ (I tested it)
- http://www.dev-metal.com/super-simple-vagrant-lamp-stack-bootstrap-installable-one-command/
- https://box.scotch.io/
However, I got an error complaining password in the configuration. See this post for help. A simple way to get rid of the error is to comment out the username and password lines.
The post tells us 1) how to create a lamp server using Vagrantfile and a shell script, 2) how to save the box for future use.
The <Vagrantfile> file looks like
Vagrant.configure(2) do |config| config.vm.box = "precise32" # Mentioning the SSH Username/Password: # config.ssh.username = "vagrant" # config.ssh.password = "vagrant" # Begin Configuring config.vm.define "lamp" do|lamp| lamp.vm.hostname = "lamp" # Setting up hostname lamp.vm.network "private_network", ip: "192.168.205.10" # Setting up machine's IP Address lamp.vm.provision :shell, path: "script.sh" # Provisioning with script.sh end end
and the <script.sh> file looks like
#!/bin/bash # Updating repository sudo apt-get -y update # Installing Apache sudo apt-get -y install apache2 # Installing MySQL and it's dependencies. # Also, setting up root password for MySQL as it will prompt to enter the password during installation sudo debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password password rootpass' sudo debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password_again password rootpass' sudo apt-get -y install mysql-server libapache2-mod-auth-mysql php5-mysql # Installing PHP and it's dependencies sudo apt-get -y install php5 libapache2-mod-php5 php5-mcrypt
We can verify the apache is working by browsing the address http://192.168.205.10. Note that the host-only network IPv4 address is 192.168.205.1 (not sure if this is coincidence).
Configuring a single Ubuntu installation as a dual-boot option and a VirtualBox appliance
Multipass
OSBoxes
OSBoxes provides ready-to-use VirtualBox/VMware Linux/Unix guest operating systems
Security
10 new VM escape vulnerabilities discovered in VirtualBox
Meltdown & Spectre
- After I upgrade the kernel to 4.4.0-109-generic & install the latest VirtualBox (5.2.6) on Ubuntu 16.04, VB cannot be launched
brb@t420s:~$ virtualbox WARNING: The vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (4.4.0-109-generic) or it failed to load. Please recompile the kernel module and install it by sudo /sbin/vboxconfig You will not be able to start VMs until this problem is fixed.
The error has been reported. https://bugs.launchpad.net/linuxmint/+bug/1742832
Other visualization software
Hypervisor/Virtual machine monitor
A hypervisor, also known as a virtual machine monitor (VMM), is a type of computer software, firmware or hardware that creates and runs virtual machines. A computer on which a hypervisor runs one or more virtual machines is called a host machine, and each virtual machine is called a guest machine. The hypervisor presents the guest operating systems with a virtual operating platform and manages the execution of the guest operating systems.
There are two types of Hypervisor (wikipedia)
- Type 1: native or bare-metal hypervisors. These hypervisors run directly on the host's hardware to control the hardware and to manage guest operating systems. Examples include Oracle VM Server for SPARC, Oracle VM Server for x86, the Citrix XenServer/XenClient, VMware vSphere/ESXi, Microsoft Hyper-V 2008/2012, RedHat Enterprise Virtualization (RHEV), Proxmox and KVM (see note below).
- Type 2: hosted hypervisors. These hypervisors run on a conventional operating system just as other computer programs do. Type-2 hypervisors abstract guest operating systems from the host operating system. VMware Workstation, VirtualBox and QEMU are examples of type-2 hypervisors.
However, the distinction between these two types is not necessarily clear. Linux's Kernel-based Virtual Machine (KVM) and FreeBSD's bhyve are kernel modules[1] that effectively convert the host operating system to a type-1 hypervisor. At the same time, since Linux distributions and FreeBSD are still general-purpose operating systems, with other applications competing for VM resources, KVM and bhyve can also be categorized as type-2 hypervisors.
See also the youtube videos Hyper-V Course from itfreetraining.
KVM: Kernel-based Virtual Machine
See KVM.
KVM vs. Xen vs. VirtualBox Virtualization Performance
- http://phoronix.com/scan.php?page=article&item=ubuntu-1510-virt&num=1
- http://blog.unitedlayer.com/hypervisor-101-vmware-virtualbox-hyper-v-infographic
QEMU
- QEMU stands for Quick Emulator
- QEMU vs KVM
- QEMU is a software-based virtualization solution, while KVM is a hardware-based virtualization
- KVM tends to be more efficient and performant than QEMU but is also more hardware-dependent.
- QEMU is a type-2 hypervisor.
- QEMU can make use of KVM when running a target architecture that is the same as the host architecture. Mimicking the performance of a Type-1 Hypervisor. To use KVM pass --enable-kvm to QEMU.
- Previously, KVM was a fork of QEMU called qemu-kvm, but this has now been merged into QEMU upstream and the fork has been discontinued.
- QEMU is built on top of QEMU and uses it for device emulation and I/O operations.
- QEMU is using an integrated VNC server to show the guest OS screen instead of relying on the graphical interface of the host OS.
- QEMU/KVM/Virtual Machine Manager
- QEMU emulates hardware (like ARM). QEMU is a userland type 2 (i.e runs upon a host OS) hypervisor.
- KVM is a kernel module that creates the guest state on your CPU and manages access to memory and the CPU. KVM is a Linux kernel module. It is a type 1 hypervisor.
- Virtual Machine Manager is a lovely graphical overlay to all of this virtualization and hypervisor goodness.
- Ubuntu -> MultibootUSB has an option to test ISO (it's called Boot ISO). You can use that to boot a Linux with desktop (but don't too greedy to do other things).
- Raspberry Pi ARM
- Android
- Install Android 8.1 Oreo on Linux to Run Apps & Games. See Android x86.
- Testing R on Emulated Platforms
- 使用 QEMU 尝鲜 Windows 11
- Create Windows, macOS, and Linux Virtual Machines Easily With QEMU-based Quickgui
- Getting Started With QEMU On Ubuntu – An Illustrated Guide. If your computer has the virtualization technology enabled, you can add –enable-kvm to your command line to speed it up.
Xen
- https://en.wikipedia.org/wiki/Xen
- https://help.ubuntu.com/community/VirtualMachines Xen is officially supported by Ubuntu
Xen for Beginners from youtube
This article compares KVM and Xen. Xen is more difficult compared to KVM thought it is technically superior to KVM.
What virtualization software does Amazon use
Amazon Elastic Compute Cloud (EC2) uses Xen virtualization according to wikipedia.
What hypervisor software does Google Compute Engine use
Google Compute Engine uses KVM as the hypervisor according to wikipedia.
VirtualBox vs VMware Workstation Player vs VMware Workstation Pro vs Microsoft Hyper-V
- The best virtual machine tools for Windows: Run a PC inside your PC 6/10/2023.
- The advantage of Hyper-V over the virtualization platforms from Oracle and VMware is the dynamic memory management.
- Hyper-V comes from the server area of Microsoft. Accordingly, some functions that are useful on the desktop and found with VirtualBox and VMware Workstation Pro are missing, such as support for sound and access to USB devices. The exchange of files between the desktop of the main computer and a virtual PC is also missing, as is a shared clipboard for transferring data.
VMware vSphere bare-metal Hypervisor/ESXi (free)
- This is a type 1 hypervisor.
- https://en.wikipedia.org/wiki/VMware_ESXi
- Product page
- (Youtube) Installing vSphere Hypervisor, Lubuntu Install on vSphere virtual machine
- Is ESXi Really Free? Let’s put it to the Test
- Improving VM to VM network throughput on an ESXi platform
Trouble shooting
- VMware ESXi requires the Execute Disable/No Execute CPU feature to be enabled.
- Change of BIOS works.
- No network adapter adapters were detected.
- Run sudo lshw -c network or sudo lspci -v to see your NIC vendor. Mine is RTL8111/8168/8411 Realtek.
- The VIB file can be found on https://vibsdepot.v-front.de/wiki/index.php/Net55-r8168
- How to make your unsupported NIC work with ESXi 5.x or 6.0
VMware Player
Download
After experiencing frustration with upgrading Virtualbox on Windows host, I decide to use Vmware player.
The download link is here.
The installation does not require an admin right. It does require an email when the program is launched the first time (non-commercial use). I am testing VMware-player-12.0.0-2985596.exe (70MB) released on 2015-08-24.
The default virtual machine location is C:\Users\$USERNAME\Documents\Virtual Machines\ while my favorite location is E:\Virtual Machines\ from the VirtualBox.
I can click an .ova file exported from VirtualBox in order to import it to VMware player. Importing ova does take a long time.
Note only the pro version can (comparison)
- Export to ova
- Map virtual disks
- Advanced CPU settings
- Snapshot
Release mouse cursor from VM
Ctrl + Alt.
Problems
Vmware workstation 16 player + Ubuntu 16.04 guest and Pop_OS 20.04 host. The desktop flickered and the OS becomes unusable. Workstation 15: Guest screen flickering occasionally - can someone reproduce this issue?
VMware tools
This is like VirtualBox guest additions. It is mounted on a DVD drive. We need to run setup.exe or setup64.exe to install it.
Once VMware tools is installed on the guest machine, go to Manage -> Virtual Machine Settings.
What is working:
- the screen resolution is adjustable
- share folder function is working.
- copy/paste (automatical)
- number of cpu (need to change when the os is off)
- memory (need to change when the os is off)
Host-only network or NAT
- Selecting IP Addresses on a Host-Only Network or NAT Configuration
- Solved: Why are there 2 Network Adapters from VMNet?.
By default VMware Workstation offers three networking options:
- VMnet0 (bridged) - that is the connection type used for virtual NIC's which connects the guest transparently to the physical network.
- VMnet1 (host-only) - that is a virtual switch/network where only the guests and the host can participate. On my computer, vmnet1 has 172.16.183.1
- VMnet8 (NAT) - that is a virtual switch/network which connects the guest to the outside but hidden behind a virtual NAT device. SO it can't be seen from the outside world. On my computer, vmnet8 has 172.16.205.1
Install Workstation or Player on any Linux
Install VMware Workstation or VMware Player from a .bundle file
cd dir sudo sh VMware-Workstation-xxxx-xxxx.architecture.bundle
Install Centos 7 guest
sudo yum update sudo yum install -y open-vm-tools
htop shows the memory usage is 740 MB.
Install Vmware tools in Debian/SparkyLinux guest
Install Debian 10 on VMWare Workstation 15. The instruction for installing vmware tools works on SparkyLinux 6. Steps:
- Virtual Machine > Install Vmware tools
- Extract VMWareTools tar ball to your home directory
- Open a terminal and cd to vmware-tools-distrib directory
- sudo ./vmware-install.pl -d . The "-d" option tells to accept all defaults.
- sudo reboot.
SparkyLinux is quite light in terms of memory usage. neofetch shows SparkyLinux uses lightdm-xsession as DE and openbox as WM. htop shows 386 MB is used. I can install gedit using sudo apt install command. I use the rolling release and MinimalGUI 64bit version. Sharing folders work but clipboard sharing does not work. It has a stringer requirement for setting the password; something like 'sparkylinux' works. I can change the password afterwards by following this instruction by editing the file /etc/pam.d/common-password.
Is Openbox a desktop environment?
- Openbox can be used alone, without a desktop environment, or it can be used to replace the window manager in a complete desktop environment. Either way is acceptable. When I check /etc/lightdm/lightdm.conf it shows user-session=openbox.
- It may be built upon and run independently as the basis of a unique desktop environment, or within other integrated desktop environments such as KDE and Xfce, as an alternative to the window managers they provide.
Install Vmware tools in Ubuntu guest
- http://partnerweb.vmware.com/GOSIG/Ubuntu_14_04.html
- Ubuntu 16.04.1
- http://www.howtogeek.com/howto/ubuntu/how-to-share-folders-with-your-ubuntu-virtual-machine-guest/
- https://help.ubuntu.com/community/VMware/Tools (maybe outdated)
Instruction for Ubuntu 14.04
sudo apt-get update sudo apt-get install build-essential module-assistant sudo m-a prepare cd Downloads # Go to the VMware Workstation Player menu -> Player -> Manage -> VMware Tools installation tar xzvf "/media/brb/VMware Tools/VMwareTools-10.0.0-2977863.tar.gz" cd vmware-tools-distrib sudo ./vmware-install.pl [Accept all default] sudo shutdown -r now
Go to Player -> Manager -> Virtual Machine Settings -> Options -> Shared folders.
The shared folders will be under /mnt/hgfs in the guest machine. One good thing about the share folder with VMware is we can create new share folders while the virtual machine is on. If we check the mount points, we will see
brb@ubuntu:~$ mount | grep host .host:/ on /mnt/hgfs type vmhgfs (rw,ttl=1)
Instruction for Ubuntu 16.04.1
# NOT to follow the yellow pop-up at the bottom of the VMware (e.g. clicking 'Install Tools'). # It's OK to receive the message 'the VirtualBox Kernel service is not running' sudo apt-get update sudo apt-get install open-vm-tools-desktop
and reboot your VM.
Ubuntu 20.04 server + minimal Desktop. RAM usage is around 850 MB.
Manjaro guest machine
Make sure to allocate at least 2GB RAM. I also use 2 CPUs. I am using manjaro-xfce-20.0.2-minimal-200531-linux56.iso.
How to Install VirtualBox Guest Additions on Manjaro 18.0
How to update Manjaro using command line in the Terminal
We may need to reinstall VMware tools (see the above section) for the shared folders function to work. It works when I tested on Unity and LXDE ubuntu.
Sound
By default there is no sound (audio device). Follow here to add a sound device.
Import an ova file
After we import an ova file exported from VirtualBox, VMware will generate a vmware virtual disk files (*.vmdk) under the new folder (folder name is the new virtual machine name). So we can delete the ova file.
Convert between vmdk and ova format
See this article in howtogeek.com
Boxes
- https://help.gnome.org/users/gnome-boxes/stable/
- https://en.wikipedia.org/wiki/GNOME_Boxes
- Easily Create a Virtual Machine on Linux with Gnome Boxes
- How to spin up a Linux virtual machine quickly with Boxes
- Move Virtual Machine Image to Another Host Using GNOME Boxes
- Gnome Boxes vs virt-manager
Proxmox Virtual Environment
Proxmox Backup Server
- Proxmox Backup Server: Full Getting Started Guide! (video)
- Setting Up a Proxmox Backup Server (video)
oVirt
Parallels
Emulation vs virtualization
Virtualization allows users to configure virtual machines outfitted with similar hardware and processors as the host system, whereas emulation simulates different hardware and processor configurations in software.
Emulators are what allow you to run old Commodore 64 or NES games on a PC, for example.
How Do You Safely Run an Untrusted Executable File on Linux
Security
Self-Hosting Security Guide for your HomeLab (video)
Ways to Use a Virtual Machine
- 20 Ways to Use a Virtual Machine (and other ideas for your homelab) (video)
- Server and ports
8個DevOps好用工具大介紹
http://www.ithome.com.tw/news/99307
Puppet
http://www.ithome.com.tw/news/99285
Chef
http://www.ithome.com.tw/news/99304
Jenkins
http://www.ithome.com.tw/news/99305