JustToThePoint English Website Version
JustToThePoint en español
JustToThePoint in Thai

How to Create and Use Virtual Machines

Virtualization

Set up and use VirtualBox

  1. Enable Virtualization in the BIOS. Reboot your computer, enter into the BIOS (F2, Del), go to the Advanced menu. Virtualization is a CPU feature, so you need to go into the CPU Configuration and search for a setting labeled Intel (VMX), Virtualization, AMD-V, or Intel-VT, and set it to Enabled. Finally, select Save Changes & Reset to save these changes in the BIOS and exit.

    Do not edit any settings unless you really know what you are doing.

  2. Installation

    If you are a Windows or macOS user, open your web browser and go to https://www.virtualbox.org/wiki/Downloads and then download the .exe or .dmg file to your computer, double click on the file and start the installation -sweet and easy! It is not such an easy process in GNU/Linux.

  3. If you are an Ubuntu user, you can find VirtualBox in the Ubuntu Software Manager or type in your terminal: sudo apt install virtualbox. If you are an Arch user, you need to install some packages: sudo pacman -S virtualbox virtualbox-guest-iso

  4. Only ARCH. To use the USB ports of your host machine, add the current user to the vboxusers users group: sudo gpasswd -a $USER vboxusers

  5. Only ARCH. Load the VirtualBox module automatically at boot time: sudo modprobe vboxdrv

    Maybe you find the following problem: The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Try to install: sudo pacman -S virtualbox-host-dkms linux-headers

  6. Install the VirtualBox Oracle VM Virtual Extension Pack: yay -Syy && yay -S virtualbox-ext-oracle (Arch), sudo apt install virtualbox-ext-pack (Ubuntu) or download it from VirtualBox (Windows, macOS). It provides additional features (it enables USB 2.0 and 3.0 support), but it is released under a non-free license only available for personal use.

  7. ARCH. The Oracle VM VirtualBox web service, vboxwebsrv, is used for controlling Oracle VM VirtualBox remotely. Enable vboxweb to start on boot and start the service: sudo systemctl enable vboxweb.service, sudo systemctl start vboxweb.service

  8. Change Virtual Machine Folder. Virtual machines often involve really big files! File, Preferences. On the General tab, Default Machine Folder.

Create a Virtual Machine

  1. Start VirtualBox. If you are a Windows user, go to Programs, VirtualBox. If you are a macOS user, double-click on the VirtualBox icon in the Applications folder.
  2. Click New in the VirtualBox Manager Windows: Name of the VM (Ubuntu), Machine Folder is the location where this virtual machine will be stored on your computer (e.g., /media/mydisk/virtualMachines), Operating System Type (Linux), and Version (Ubuntu_64).
  3. Memory size, e.g., 8192 MB, this is the amount of RAM you want to allocate to the virtual machine. You should give half of your RAM to the Virtual Machine.
  4. Next, you must specify a Virtual Hard Disk. Typically, you will select Create a virtual hard disk now.
  5. Hard disk file type: Select VDI. Storage on physical hard disk: Select Dynamically allocated, it will only use space on your physical hard disk as it fills it up. However, a fixed-size file immediately occupies the file size specified, but it is slighter faster than a dynamically allocated file.
  6. File location and size: /media/mydisk/virtualMachines/miUbuntu/miUbuntu.vdi (40 GB).

Run your Virtual Machine

  1. Select the VM’s entry in the VirtualBox Manager list, and click Start at the top of the windows.
  2. Select start-up disk. Download an Ubuntu’s ISO, click the folder icon, and select the .iso file you have just downloaded.
  3. After you install a guest OS, either your VM or your host computer can “own” the keyboard and the mouse. To return the control of your keyboard and mouse to your host OS, press the Host Key, this is the right Ctrl or the left Command key (macOS).
  4. Install Guest Additions: Devices, Insert Guest Additions CD image… Navigate to the directory /media/yourUser/VBox_GAs_6.1.34, and run the VBoxLinuxAdditions.run script to install the Guest Additions (sudo sh ./VBoxLinuxAdditions.run), and reboot the Ubuntu guest for changes to take effect: sudo shutdown -r now
    If you are creating a virtual machine with Ubuntu, you need to previously install the following packages: sudo apt-get install build-essential gcc make perl dkms. The, reboot the virtual machine: reboot
  5. Virtual Network Adapters. Settings, Network. Change the “Attached to” property from NAT to Bridged Adapter. The virtual machine will connect to your existing WiFi or Ethernet network, e.g., enp5s0, so it allows the virtual machine to run as a member of your local network. Check the IP: ip a., e.g., 192.168.1.98

Access to your Virtual Machine from Guacamole

  1. Guacamole is a clientless remote desktop gateway.
  2. Let’s say that you have a Ubuntu in your Virtual Machine. You need to enable screen sharing in your virtual machine: Settings, Sharing, and enable Remote Desktop, Control, and Legacy VNC Protocol.
  3. Open your browser, go to your Guacamole server: https://IpServerGuacamole:8443/ Next, add a New Connection in Guacamole: Settings, Connection, New Connection, Name (myUbuntu), Location (ROOT), Protocol (VNC), Hostname (192.168.1.98), Port (5900), Authentication (Username, Password), Security Mode: NLA (Network Level Authentication).

Configuring your Virtual Machine

  1. Share Clipboards, enable drag and drop. Settings, General. Open the Advanced tab. Shared Clipboard and Drag’n’Drop: Bidirectional.

  2. Take a snapshot. Machine, Take Snapshot. If there is a failure, it allows you to fall back to a working version quickly and easily.

  3. Enable USB Access. Settings, USB. Click on the + sign to add a new device, e.g., USB SanDisk 3.2 Gen1.

  4. Enable Audio. Settings, Audio, Enable Audio Extended Features: Enable Audio Output.

  5. Shared Folders Settings, Shared Folders, +. Edit Share: Folder Path (this is the actual folder path on the host machine, e.g., ~/Dropbox), Folder Name (it is an arbitrary name you choose to have for your shared folder, e.g., Dropbox), check Auto-mount and Make Permanent.

    After that, add your (Virtual Machine -guest-) user to the group “vboxsf”: sudo usermod -a -G vboxsf $USER. Create a directory to mount the shared folder: mkdir ~/myDropbox, and mount it: sudo mount -t vboxsf Dropbox ~/myDropbox/

  6. Increase Disk Size of your existing Virtual Machine: File, Virtual Media Manager… select one of your virtual disks, and use the “Size” slider. Even though you have a larger virtual hard disk, the operating system’s main partition on your virtual hard disk is still the same size. You could use GParted live to resize your virtual machine’s partition: Settings, Storage, and browse to the GParted live ISO file on your computer, boot your virtual machine with GParted, and enlarge your main partition.

The Windows Subsystem for Linux

The Windows Subsystem for Linux lets developers run a GNU/Linux environment ‐‐ including most command-line tools, utilities, and applications ‐‐ directly on Windows.

Enable the Windows Subsystem for Linux. You must be running Windows 10 version 2004 and higher or Windows 11. You can install everything you need to run Windows Subsystem for Linux (WSL) by opening an administrator PowerShell or Windows command Prompt, typing wsl ‐‐install, and then restarting your machine. You will be asked to create a user (user name and password) for your Ubuntu. You can always open your Ubuntu, using the Start menu.

Type df -h. Each of Windows letter drives (C, D, E, etc) is treated as a mounted drive from the WSL Linux file system: /mnt/c, /mnt/d, etc.

Bitcoin donation

JustToThePoint Copyright © 2011 - 2022 PhD. Máximo Núñez Alarcón, Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.