How to use the VirtualBox unattended installation feature

How to use the VirtualBox unattended installation feature

Jack Wallen shows you how to do an unattended installation of Linux with the new release of VirtualBox 7.0 to help make your virtual machine deployment even easier.

Modern Office: Portrait of Motivated Black IT Programmer Working on Laptop Computer.
Image: Gorodenkoff/Adobe Stock

VirtualBox 7.0 is now available to install and it offers a host of very important new features. One of the more impressive features is the addition of unattended install configuration within the GUI. Now you no longer have to run those unattended installations from the command line.

SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)

But it’s not all roses with the new feature, as there’s one aspect that can be a bit tricky. Let’s dive in and find out how it works.

What is an unattended installation?

Before we dive into this, you might need to know what an unattended installation is. Simply put, you configure the installation before starting the VM, and VirtualBox takes care of everything — even creating your default user.

The one caveat to the VirtualBox unattended installation is that it does not add your user to the sudo group. Given that you cannot access the root user without sudo privileges, this can be a problem. Fortunately, there’s a way around it.

What you’ll need to do an unattended installation in VirtualBox

The only things you’ll need for this are a running instance of VirtualBox 7.0 and an ISO image to use for the installation. If you’ve yet to upgrade to VirtualBox 7.0, find out how here. You can do an unattended install for any Linux guest.

How to create a VM via an unattended installation

You’ll immediately notice the VM creation wizard in VirtualBox 7.0 is different from previous iterations. You’ll also notice that the Unattended Installation step is enabled by default.

When you get to the unattended installation screen of the wizard (Figure A), you’ll need to fill out the username, password, hostname and domain name.

Figure A

The Unattended Guest OS Install Setup screen of the VirtualBox wizard.
The Unattended Guest OS Install Setup screen of the VirtualBox wizard.

Once you’ve filled out this information, click Next and you can then configure your Base Memory, CPU and storage in the resulting two screens. The final screen (Figure B) displays the settings for the virtual machine.

Figure B

The Virtual Machine Summary page for our new VM.
The Virtual Machine Summary page for our new VM.

Click Finish and the installation will start. You won’t have to do anything at this point but wait until the machine reboots and presents you with the login prompt. You should see the prompt for the user you added during the configuration of the VM. Log in with that username and the password you created and you’re there. Almost.

That darned caveat

After an unattended installation, you’ll find your user doesn’t have sudo access. Since you don’t have sudo access, you don’t have access to the root user, which means you can’t do anything that requires privilege escalation. What do you do? Here are the steps:

  1. Reboot the machine.
  2. As soon as the VM starts to boot, hold down the shift key.
  3. Using your cursor keys, select Advanced Options.
  4. Select root.
  5. If you’re asked for a password, type the password you created for the standard user.
  6. Once at the root prompt, type sudo usermod -aG sudo USER, where USER is the username you created for the unattended installation.
  7. Reboot the machine with the command reboot.

Your user now has access to sudo, which means you can do all the admin tasks you need on your virtual machine.

Congratulations: You just did your first unattended installation of a virtual machine with VirtualBox.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

Source of Article