Install Debian on Virtualbox

Install Debian Linux on VirtualBox. You can play with Linux even on Windows, before you completely move to Linux.

This is a beginner friendly tutorial, with quazillion screenshots.

Download Debian ISO image

Download the current Debian ISO image. You can find it by Googling/Duckducking "debian non-free live iso".

https://cdimage.debian.org/images/unofficial/non-free/images-including-firmware/current-live/amd64/iso-hybrid/debian-live-10.7.0-amd64-xfce+nonfree.iso

The correct image is

Debian live iso is a typical Linux iso, so it's a couple of gigabytes and takes a while to download.

Create a New Virtual Machine

Install VirtualBox if you don't have it yet. If you're running Linux, it's usually just 'sudo apt-get update && sudo apt-get -y install virtualbox'. If your current computer (host) is Windows or OSX, download VirtualBox installer and run it.

Start VirtualBox. From the menus, select Machine: New...

You can now see a new virtual machine on the left in VirtualBox Manager.

Insert Debian ISO Image as a Virtual CDROM

Select your VM "DebianTeroKarvinenCom" and click "Settings".

You now have a virtual computer, with a virtual CDROM in a virtual drive. We're ready to boot.

Boot to Desktop - Choose to Live

On VirtualBox Manager, double click your new virtual machine DebianTeroKarvinenCom to boot it.

Bootloader appears. In addition to this cool menu, bootloader is also responsible for loading the kernel - in this case, the Linux kernel.

Choose to Live. That's the default option, and it's chosen automatically if you just wait a couple of seconds. Usually, you should boot to live desktop even if you're going to install. That way, you can test Linux before you decide to install. And often the installer on Live mode is faster than the other installers.

A live desktop appears. Do you mean you can use Linux without installing? Yes.

Let's test that everything works. On top left, open "Applications" menu, choose "Web Browser". I googled "Tero Karvinen", clicked the top link and saw my homepage. Then I closed the browser. This tests the basic functionality of mouse, keyboard, network and display.

Run the Installer - and Use a Good Password

Backups? On a real computer, this would be the time to check that we have backups. But this is an empty virtual machine.

Run the installer, it's on the bottom left of the desktop: "Install Debian".

On "Debian GNU/Linux Installer" (Calamares)

 

 

 

Solve a Black Screen with xforcevesa (optional)

On my system, the virtual machine just booted to a black screen. As most of my students don't see this problem, maybe it's just me. So if you see a login screen, just log in and enjoy your machine.

Here is a nice trick for black screens: xforcevesa. I have also used this with tricky physical computers giving me black screen.

Reboot (Machine: Reset). Keep clicking ESC while the computer boots, so that you land on GRUB Bootloader menu. If you miss it, just reboot and ESC harder.

On the default option "Debian GNU/Linux", click "e". Find the line that starts with "linux". Add the boot parameter "xforcevesa" to it. Press control-X to boot.

What does xforcevesa mean?

The boot start. In my case, I immediately noticed changes compared to black screen problem. I could see a text cursor blinking, then some funny letters and finally, the login screen. Thanks, xforcevesa!

First Login

A login screen greets you. Type your login name and your password. They are the ones you chose in the installer.

You're in!

"Welcome to the first start of the panel": "Use default config".

Now you can try browsing the internet to verify that everything works.

Well done! You've installed Debian.

First Steps

Open the terminal: Applications: Terminal Emulator.

Don't type the dollar sign "$" below, it's the prompt.

Update the list of what's available. Type this command to the prompt, and give your password when asked. Your password is not echoed on the screen, you type it blind.

$ sudo apt-get update

So 'sudo' means use superuser privileges. You are automatically member of sudo group as the first user created in the installer. 'apt-get' is the package manager, it installs software. And "update" just updates information about what we could install.

Upgrade everything. Everything? Latest versions for this Debian? Security updates? Command line apps? Desktop apps? Servers? Yes.

$ sudo apt-get -y dist-upgrade

Here, "-y" says yes to stupid questions. "dist-upgrade" means upgrade everything. It installs the latest versions of all software.

This will take a while, as it upgrades everything. Don't interrupt the upgrade while it's working, and don't close the window before it's done. Normally, 'apt-get dist-upgrade' does not need a reboot. But here, the kernel "linux-image*" was upgraded, so we need to reboot soon.

Install a firewall and turn it on.

$ sudo apt-get -y install ufw
$ sudo ufw enable

And reboot. On top-left "Applications" menu: Log out: Restart.

After the reboot, log in.

Now your Linux has the latest security updates, and it's protected by a firewall. And you did it on the command line. You've got a good start with this Linux thing...

Well done! Enjoy your Linux desktop!

What next?

Install Guest Additions for Good Resolution (optional)

The Problem - Virtual Desktop is Too Small

With a real computer, you might be on your way now. But with VirtualBox, we still need to install drivers for our virtual devices. Why is the screen so small? If you stretch the window, your desktop doesn't get bigger, but you just get ugly, gray sorrow borders. You need to install VirtualBox Guest Additions. Also, guest additions will allow you to copy-paste between your host computer (the real physical one) and the guest (virtual) one.

The Solution - VirtualBox Guest Additions

From the "Devices" menu: "Insert Guest Additions CD image...". If prompted to download it, accept the download.

Applications: File Manager. To mount the CDROM, click on the CDROM icon on the left "VBox_GAs...".

Open Applications: Terminal Emulator. Remember not to type the prompt "$" below.

Change to the directory of guest additions CDROM, and list the files in it.

$ cd /media/*/VBox*
$ ls

Run the installer script, using the sudo powers you have

$ sudo bash BoxLinuxAdditions.run

So it likely says "blah blah blah".. "Running kernel modules will not be replaced until the system is restarted". It also says the same thing in a techinical way "modprobe vboxsf failed". So let's reboot, so we can start using the kernel modules (virtualbox virtual device drivers) we just built.

Applications: Log out. Click "Restart".

Now we have a big desktop, with good resolution.

And we have copy-paste between host and guest machines. It's in Devices: Shared Clipboard: Bidirectional.

Now it's a good time to save your success. Machine: Take snapshot...

Now you've set up your virtual Debian. Enjoy your Linux!