DEV Community

Gabriel Mediotti Marques
Gabriel Mediotti Marques

Posted on • Updated on

How to setup a VM on VirtualBox (Oracle) and connect over PuTTY

  • Download de Oracle VM Virtual Box and an OS .iso (for this tutorial, we'll use an Ubuntu 20.04 .iso)

Setting VirtualBox up.

  • After downloaded and installed, setup the new VM.
    • Create a new VM clicking on the blue sign.
    • Set a name to the VM.
    • Choose the right type and version of the OS (In this case, it'll be Linux/Ubuntu (64-bit)
    • Set the amount of memory that will be used by the VM (always remember, if your system usually uses something around 6 to 8GB of RAM and you only have 8GB, the sum of the VM dedicated memory and the usual memory can't exceed the whole amount of memory in the computer)
    • Create a new virtual hard disk
    • Choose the "VDI" option
    • Choose Dynamically allocated
    • Choose the amount of size that you plan to allocate for the VM's disk (Always remember that you can't exceed the amount of disk size that your computer is using)
  • Click in the VM an then click in the engine sign "Settings"
  • In the System tray, set the amount of CPU cores for the VM (Go under 50% of CPU)
  • In the Display tray, set the video memory to maximum.
  • In the Storage tray, select the Empty item under the "Controller IDE", on the right side it'll pop an "Attributes" section, click the blue disk and choose the .ISO file to install the OS.
  • In the Network tray, enable the Adapter 1 and Adapter 2.
    • In Adapter 2, choose the Host-only Adapter option, and the name will automatically swap to "VirtualBox Host-Only Ethernet Adapter".
  • The VirtualBox setup is concluded.
  • Start the VM an install the OS.
  • For Ubuntu, install the net-tools over terminal and then get the IP using the "ifconfig" command.

Alt Text
The IP of the VM is 192.168.56.101.

Setting PuTTY up

  • Download the PuTTY and install it.
  • First you'll need to generate the SSH keys.
    • Open the PuTTYgen program.
    • Click on "Generate".
    • Move the mouse over the blank area to generate some randomness.
    • Set a key passphrase (password) to the generated key.
    • Save the public and the private keys (remember the path to find those keys)
    • Close the program.
  • Open the PuTTY program.
  • Go to Connection-SSH-Auth and browse the private key file.
  • Go back to Session.
  • Type the IP Address of the VM and select the connection type (SSH).
  • Done!

If everything went good, you'll get a terminal window in the client computer asking to login in the OS.

Troubleshooting

  • If you can't confirm the settings of the new VM on VirtualBox and it says that your computer doesn't allow virtualization, check if the virtualization is enabled in the BIOS menu.

Feel free to add comments about the tutorial and help to improve it!
Peace :D

Top comments (0)