Alpine is a fantastic Linux distribution. It doesn’t contain bloat; it’s quick to get running, and it so small. It’s powerful and has plenty of uses in real-world scenarios, but I think it’s great for learning how to use Linux. This guide will cover how to get Alpine running in a virtual machine with VirtualBox.

Installing VirtualBox

To start, you’re going to want to install VirtualBox from its official site. As of writing this, the most recent version of VirtualBox is version 6.0, but you should download whatever version is most current for you. Click on the appropriate link for your operating system under “platform packages” and install VirtualBox with the installer. Once installed, you should have an application that looks like this:

Creating an Alpine Virtual Machine

Next, we have to download Alpine itself. Alpine can be downloaded from it’s official site. On the downloads page, there are a few versions of Alpine for different purposes. We want to get the “Standard” version of Alpine. You’ll need to download either the x86 or x86_64 version, depending on your machine’s architecture. For most modern systems, the x84_64 version will be work.

Once downloaded, you should have a file with a .iso extension. This file represents Alpine and is what we need to give to VirtualBox to create a new Alpine virtual machine. To create a new virtual machine, click the “New” button.

You can name it whatever you’d like, and you can store it wherever you’d like. For the type, we want to select Linux. For the version, we want to select “Linux 2.6 / 3.x / 4.x (64-bit)”. While the type will always be Linux, the version may change in the future. You’ll have to research what version of Linux Alpine is using if the option above is no longer available in your version of VirtualBox.

After we press next, we are presented with a window asking how much memory we want to let the virtual machine borrow from our computer. Alpine is small and doesn’t ask for much. You can probably get away with giving it 1024 megabytes, but I gave it 2048 to make it more flexible.

After we confirm the amount of memory, there is a “Hard Disk” window asking if we want to create a hard disk now. Of course, we need somewhere to store our data, so select “Create” to see a new window pop up. Keep selecting “Next” until you see the “File location and size” window. Here we decide how large our virtual machine can be. The default is 8 gigabytes, and that’s a little small. I like to give mine 32 gigabytes just to be safe. The virtual machine will only be as large as what we install on it anyway. The number we’re setting in this window is the /maximum/ virtual machine size.

After we create our hard drive, we’re done creating the virtual machine! You should now see an entry in VirtualBox with the name that you specified at the beginning. Now we can start actually using Alpine. Wonderful!

Configuring Alpine

To start Alpine, click the green “Start” arrow. VirtualBox will present to you a window titled “Select start-up disk”. VirtualBox needs to know what operating system you’d like to install, so we’ll select the Alpine ISO file we downloaded earlier.

If you did everything right, you should see a window that looks something like this:

Like any other operating system, Linux has users and a login system. The first thing we need to do is log into Alpine. By default, there is only one user on Alpine: root. Where it says “localhost login”, type in “root” and press enter. Now you’re in and using Linux! Very cool. Right now, we’re using Alpine, but it’s not installed. This means that anything we do on it right now won’t persist, and if we want our data to stay, we have to install it.

To set up Alpine, type in setup-alpine and press enter. The first thing Alpine will ask you to do is set up your keyboard. If you’re in the US, type in “us” and press enter where it asks you to select your keyboard layout. It will then ask for your keyboard variant. Type “us” again and press enter.

Next, it will ask you to select the machine’s hostname. We can change this later, so the default is fine. Just press enter. After that, it will ask you to select your default interface, which is essentially a device that allows you to connect to a network such as the internet. The default is what we need here, as well. Press enter. Now it’ll ask you how you want to receive your IP address, and as usual, the default is fine. Press enter. Next up is manual network configuration, press enter to use the default.

After that group of setup, you’ll be asked to create a password for the user “root” that we logged in with earlier. Enter a password that you like and press enter. Note that you won’t see anything being typed as you type out the password. This is for security reasons so people can’t see how long your password is, but rest assured that you are actually typing something in. After that, just re-type the password in to confirm it and press enter.

After the password is set, we get back to the rest of the setup. You’ll be prompted for your timezone. If you don’t know the proper listing for your timezone (it’s particular), you can just press enter to use the default. My timezone is “America/New_York”, so that’s what I used. Next up is a proxy URL. We don’t need one, so just press enter. Chrony will work for our NTP client, so press enter again. It may take a moment to set up, so give it a minute.

Now Alpine needs to install some packages, and it wants to know where to download them from. There’s an extensive list of mirrors to download from, and we have to pick which one we like best. Alpine can go through all 46 and see which one is fastest, but that takes some time. If you’re okay with waiting, just press enter to have it detect the fastest for you. I’m going to use “r” for random because I’ve always had more success with it.

Now Alpine is ready to start downloading some tools, and it prompts you to select what SSH server you prefer. OpenSSH will work, so press enter to select the default.

Finally, it’s time to select the disk that we want to install Alpine on to. The next few steps are the last ones. Since we only have one disk, there’s only one option. Type in “sda” and press enter. Next, it wants you to select how you want to use that disk. We’re trying to use Alpine like a conventional operating system, so we want to use it as a “sys” drive. Type in “sys” and press enter. When it asks you to erase the disk, type in “y” and press enter. Alpine may take a few minutes to complete the process, but once it’s done, Alpine is installed!

We have to do just a few things in VirtualBox to make the changes take effect. First, shut off Alpine by typing in “poweroff” and pressing enter. Next, in VirtualBox, press the “Settings” button to bring up the settings menu. In here, select the “Storage” category.

When we initially selected the ISO file when starting the virtual machine, VirtualBox created a virtual disk that essentially tricked the virtual machine into thinking we put the file on a CD drive. If we leave the drive connected, our Virtual Machine will always boot it instead of our installed version of the operating system. To fix this issue, we have to remove the disk. You can do so by selecting the disk, clicking the CD icon on the right panel, and selecting the “Remove Disk from Virtual Drive” option.

Now, if you try to start the virtual machine again, you should notice some differences. For example, it will wait three seconds before booting entirely. The ultimate test to see if you did everything correctly is at the login screen. At the “localhost login” prompt that you used earlier, type in “root” again and press enter. If it prompts you for a password, then you correctly installed Alpine! Type in the password you set earlier. If you see no errors, you’re good to go. This means that Alpine was installed and was able to retain the password that you entered earlier.

If you got here, good job! If you didn’t get the same result, make sure to re-read the instructions and follow them carefully. Small typos can lead to significant errors.

Now that you have a Linux virtual machine ready to go, you’re ready to start learning Linux. If you’re up for it, try “Starting Linux: Hard Mode”.