VirtualBox Installation on macOS

VirtualBox Installation

Running virtualization on your laptop/desktop or home lab provides an easy way to learn and test various operating systems, including AWS EC2 instances. Also, it can serve a development environment for testing code and configurations. While there are various virtualization solutions such as VMware, VirtualBox offers a free solution that is well supported in the open source community.

Main website: https://www.virtualbox.org Downloads for various OSes: https://www.virtualbox.org/wiki/Downloads

macOS Installation

  1. Download VirtualBox-7.0.4-154605-OSX.dmg
  2. To run the installer, double-click VirtualBox-7.0.4-154605-OSX.dmg
  3. Double-click VirtualBox.pkg
  4. Click Continue
  5. Select the location and click Install
  6. Click Close when done

Installing Debian Linux

  1. Debian downloads can be found at https://www.debian.org/download
  2. Download the version for your CPU
  3. Open VitrualBox
  4. Click New


  5. Enter Name for the virtual name
  6. Select Location
  7. Select other for ISO and locate the Debian ISO you downloaded
  8. Click Next


  9. Enter Usename and Password for the installation
  10. Enter Hostname
  11. Select Guest Additions for the additional tools
  12. Click Next


  13. Select the Memory and CPU
  14. Click Next


  15. Select Create Virtual Disk Now and select the disk size
  16. Click Next


  17. Verify settings and click Finish
  18. Wait until the installation finishes

Debian Setup

Add user to sudoers

Note: Install VIM as VI doesn’t work well with VirtualBox

sudo apt install vim
EDITOR=vim visudo
usermod -aG sudo username
visudo
username ALL=(ALL) NOPASSWD:ALL

Install OpenSSH

sudo apt install openssh-server
sudo systemctl start ssh
sudo systemctl status ssh

Installing Ubuntu Linux

  1. Ubuntu downloads can be found at https://ubuntu.com/#download
  2. Download the version for your CPU
  3. Open VirtualBox 


  4. Click New 


  5. Enter Name for the virtual name
  6. Select Location
  7. Select other for ISO and locate the Ubuntu ISO you downloaded
  8. Select Skip Unattended Installation
  9. Click Next


  10. Select the Memory and CPU
  11. Click Next


  12. Select Create Virtual Disk Now and select the disk size
  13. Click Next


  14. Verify settings and click Finish
  15. Wait until the installation finishes

Amazon Linux 2

Useful Linux image to run locally is Amazon Linux 2 which is the default Linux when you provision an AWS EC2 instance. Great and free way to test your image before you deploy live.

Setup

Instructions can be found at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-2-virtual-machine.html

Note: Select the instructions for Oracle VirtualBox

Recommended network configuration

Since most of this is used for development and testing, I recommend using the DHCP option. Configuration is below.

local-hostname: amazonlinux
# eth0 is the default network interface enabled in the image. You can configure static network settings with an entry like the following.
network-interfaces: |
  auto eth0
  iface eth0 inet dhcp

VirtualBox Tips

Do not allow VirtualBox to limit screen size as it may be difficult to read. To change the display settings, select Preferences -> Display -> Maximum Guest Screen Size should be set to None.

VirtualBox Networking Chart

Chart below compares different network adapter options for VirtualBox. Important information depending on your connectivity requirements. In general, the bridged option works the best.

NetworkVM <-> HostVM1 <-> VM2VM -> InternetVM <- Internet
Host-Only++
Internal+
Bridged+++
NAT+Port Forwarding
NAT++Port Forwarding

Leave a Reply

Your email address will not be published. Required fields are marked *