I often get questions from people asking me how to install Linux, and they expect me to give them a four sentence answer that explains everything in detail. To avoid that in the future i’d like to have something I can point people to, and it will not be a four sentence solution this time. This article will focus on Installing Debian 8 with an encrypted file system on a virtual computer. I will focus on installing Debian on a virtual machine because Debian isn’t exactly a user friendly distribution to start of with and you don’t want to immediately mess up your system. The procedure of installing Debian 8 on a Virtual Machine is almost exactly the same as the procedure of install Debian 8 on a real computer. This tutorial comes with screenshots to clarify what’s going on. Don’t pay attention to the fact that the language in the screenshot is dutch.
Keep in mind that this tutorial doesn’t take the new UEFI boot system into account and assumes that you’re installing on an MBR based system. If you don’t know what UEFI based booting or MBR based booting means then I’d suggest you click the links and do some research to understand what it means. It’s not crucial to this tutorial but it’s good to learn anyway.
At this point, you may want to go ahead and download yourself a Debain 8 installation ISO from the debian website. You’ll need this ISO soon in this tutorial so don’t forget where you save the download. You’re going to download the ‘net install’ CD-ROM ISO, so make sure your computer is hooked up to the internet before starting the installation. For this tutorial you’re going to need the 32Bit version, click here to download.
I’m also going to assume that you’ve got VirtualBox installed on your Windows or Mac system. I’m not going to cover how to install virtualbox in this tutorial. If you don’t have VirtualBox installed yet, then you’re about to download an install it using this link.
Last but not least, you need your brain. Pay attention to whats happening and apply logic whenever something isn’t going to plan. Revise your steps and approach them using some common sense and stay calm. Try to be problem solving, use google or come to my forum for help. Images throughout this tutorial are clickable for a lager version.
Setting up a virtual machine with VirtualBox
We’re going to set up a virtual machine specifically for Debian with 1024 MB of system memory. The virtual machine will have a fixed size disk with a capacity of 5 GB. We’re going to mount our freshly downloaded Debian 8 ISO to the virtual CD-ROM drive and start the installation process. Fire up your VirtualBox and get ready to create a virtual machine by clicking on the blue button.
A new window will pop up asking you to give the new virtual machine a name, to declare the type of operating system it will be running and the version of the operating system you’ll be running. I choose to name it ‘Debian 8.1 32bit’ because it sufficiently describes the virtual machine. The name isn’t important, you can name it ‘linux’ or whatever else you want. I’ve set the type to Linux and the version ( architecture really ) to 32Bit. Make sure your window looks like the picture below and hit next.
After hitting the next button you’re to set the total amount of memory the machine may consume. I’m installing this virtual machine on a system that has 4 GB’s of ram in total so for me it’s safe to go for 1024MB, or 1GB. It’s more than enough. If you’re on a system with less RAM, then 512MB should also be enough. A typical basic Debian system only consumes around 100 MB, sometimes even less so don’t worry. Adjust the slider to either 512MB or 1024MB and hit next.
Time to pick the type of your virtual hard-drive. You can choose various types here and they are presented for compatibility reasons but the default should be fine if you’re not planning to share this virtual drive with other types of visualization solutions. Select VDI and hit next.
The nest step is to select if you want a dynamic sized disk or a fixed size disk. If you pick dynamic then your virtual drive host file will grow according to the demand of the guest operating system. This can be buggy in some cases and I personally don’t recommend it. Choosing a fixed size emulates a real drive better, full is full right? Check the fixed size option and hit next.
Because you’ve chosen a fixed size you should also set the maximum size of the disk. I’ve chosen 5 GB because for a Debian base system it’s more than enough. The purpose of this Debian installation is providing you, the reader, with a safe Debian environment to mess around in without the risk of breaking your current installation of Windows. Adjust the slider or type ‘5 GB’ without single quotes to set the 5 GB limit.
After you’ve hit next in the previous dialogue you’ll notice a progress bar while the virtual drive file is created. This may take a few minutes depending on the speed of your host drive. When it’s done you’re virtual machine is created and you’ll be back on the VirtualBox main screen. Notice the entry to the left, your new virtual machine is now listed.
Configuring the virtual machine
You’ve created the virtual machine, good job. Lets now do something with it. We have to configure the virtual machine to make it start the Debian 8 install CD you’ve downloaded previously. If you’ve not opened up Virtualox yet, do so. Highlight your virtual machine and click the orange gear icon, settings. You’ll see this windows.
All the settings for your virtual machine are located right here. We no have to mount the Debian 8 installer ISO we’ve downloaded previously, to the virtual CD-ROM drive. When you start your virtual machine, it will recognize the virtual drive as empty and will attempt to start from the virtual CD-ROM, like any other MBR based bios would do, if configured correctly. So to the left of the dialogue you see the settings categories, click the one that reads ‘storage’. The virtual storage device settings pop up on the left side of the dialogue.
On the storage tab, locate the device tree and collapse the tree that reads ‘Controller: IDE’ there should be a virtual CD-ROM drive. Highlight that. Now locate the little CD-ROM icon with the down-arrow, it should be next to the CD/DVD attribute selection box. Here’s an image.
Click this CD-ROM icon to get a list with a few options. You should click the option that says something ‘choose a virtual CD/DVD image’, i don’t quite remember what the English version of VirtualBox reads. This is where you need to locate the ISO file you’ve downloaded. Click the ISO file in the open-file dialogue and hit ‘OK’. The virtual CD/DVD image file should now be mounted to the virtual CD/DVD-ROM drive, and is now set up as a second default boot device. You can confirm this because the entry in the device tree has changed to read the label of the virtual CD-ROM file as follows.
Hit the ‘OK’ button on the storage settings dialogue and you’ll land right back to the main screen. You’re all set to start the Debian 8 installation. All you have to do is highlighting the virtual machine in your list, and click the green arrow that reads start.
Installing the Debian 8 Gnu/Linux distribution
Allright sparky, you got this far so don’t give up now. It’s time to get the Debian 8 installation going. This will be a standard Debian installation except for the encrypted partitions so it will nog be that difficult. You have to pay attention at some crucial steps such as partitioning the drive and setting up usernames and passwords. If you need to get some coffee, walk your dog, feed the cats or need to go to the bathroom then now is the time. If you start the installation process it’s probably best you keep going until you’re finished. This may take you up to anywhere from 15 to 30 minutes depending on how fast you get this tutorial.
So lets get started, fire up your computer or VM and make sure you boot the ISO you’ve downloaded, either via a real CD-ROM, or via a virtual CD-ROM file using a virtual machine. When the Installer boots, you’ll see this screen.
We’re going to perform a standard installation so highlight ‘Install’ with the arrow keys and hit enter. Your computer will be busy for a few seconds getting the installer going, but when it’s done you’ll see a screen that enables you to select a language. Choosing the language will automaticaly set the locales (date/time notation, currency, timezone and overall language) so it’s a good idea to really choose your native language. For the purpose of this installation I’ve choosen English. Navigate the bar using the up and down arrow keys and hit enter. Here’s a screenshot.
Next up is your location, it also determines your timezone and other locales such as repository mirror locations. I choose United States but you can pick your own by navigating with the up and down keys and hitting enter. You can also use the TAB key to switch between the dialogue buttons and menu content. It’s a handy thing to keep in mind. Here’s a screenshot on selecting the location.
Next up is your keyboard. You should select the proper keymap, if you’re location is the United States or the Netherlands you’d select the American English keymap. Assuming the previous lets select American English and hit enter.
The installer has some information to work with for you to install Debain 8. The computer will be busy with a few progress bars and depending on the speed of your computer it will take up a few seconds maybe a minute. You’ll see something like this and it’s perfectly fine.
After this the installer wants to know a if you want to set a hostname. This can be anything you want for the purpose of this tutorial, but if you’re setting up a system that’s directly hooked up to the internet and have a fully qualified domain name you should probably enter that. I named the machine ‘virtual-debian-8.1’ but you may as well name it ‘i-have-ablack-cat’ for all I care. Just give it a name.
Now we’re going to have to provide the installer with a root password. You have to type it once, and then once again to confirm you’ve typed it correctly. One word of advice, don’t use the root account as your normal account to perform day to day tasks, especially when you’re using a desktop system. The root account should be for initial setting up and system troubleshooting only! Type your new root password, and confirm it:
After confirming your root password you’ll be asked to enter a name for the regular user account. This may be the same as your username. Enter the username here, and if you’re presented with a dialogue asking you to enter your username again enter the same one. After that enter a new password for that username and verity it:
There is an important step looming, but first we have to set the time zone. Because I’ve set my options are limited to that location. For the sake of this tutorial I’ll select ‘Eastern’, you choose whatever is relevant to your location. After selecting the timezone the installer is going to load some additional components. The partition manager for example.
We’re at an important step, so pay attention. We’re going to create an encrypted hard disk with encrypted partitions. There are several ways to do this, you can create everything manually and give each partition it’s own encryption like I did on my home system, or you can let the installer do most of the work and encrypt every partition using the same pass-phrase. It doesn’t really matter which route you take, your data will be relatively secure. The advantage of doing everything yourself and encrypting every partition with a different pass-phrase gives slightly more security and control, but comes with the downside of typing up to 6 pass-phrases at boot. For the purpose of this tutorial we’ll let the installer do most of the work. Navigate to the line that reads ‘Guided – use entire disk and set up encrypted LVM’ and hit enter.
Next you have to select the physical disk to setup the encrypted LVM on. If you’re installing Debian 8 on a VM the disk selection screen will look like the following picture, of not be extremely careful with that. The device identifier (sda) usually means the first disk, (sdb) the second and so on. Highlight your disk and press enter.
Next you have to tell the installer how you would like to arrange the partitions. Choices are to install everything into a single partition. The upside of this is you’ll have the full 5 GB for the whole file-system, downside is that when you reinstall you’d have to restore backups of all your user data. A separate /home partition, the upside is you store all the user-data in the /home partition and when you re-install the base system you won’t have to restore your backups. The downside is you file-system table will be slightly more complicated. And separate /home /var and /tmp partitions is only useful if you have a server with a huge load that require multiple disks to take advantage of multiple drive controller channels and is generally not recommended unless you know what you’re doing. Go with a separate /home partition to make your life easier when re-installing Debian 8.
At this point you’re ready to write the partitioning scheme to the disk. after that the LVM can be configured. When the LVM is configured you can’t make changed to the partition layout anymore so be sure you’re all right with it before choosing yes in this following screen.
Next up is some formatting. Ge ahead and get a cup of tea while the installer does it’s thing. This may take a while and you want to complete this step to ensure slightly better quality encryption.
After zeroing every bit on your drive it’s time to enter the passphrase. A good passphrase is a word or a phrase that has at least 15 characters or more. It’s a good thing to go with the recommended minimum of 20 if you are about to store very sensitive data on your drive. Enter a passphrase and verify it. Remember this passphrase well otherwise you won’t be able to recover the data!.
Time to finish partitioning and write everything to your encrypted disk. Select the line that reads ‘Finis partitioning and write changes to disk’ and press enter.
Core packages will now be downloaded from the internet and installed. This may take up to a few minutes depending on the total bandwidth of your internet connection.
When base system installing is done, you’re ready to pick a country to choose a repository mirror from. It’s good to pick a repository mirror that’s in your country, preferably close to where you live to optimize download speeds and availability. For the sake of this tutorial i’ve chosen the United States.
For picking a server I personally always choose an FTP server. This protocol is originally designed for larger file transfers so why not use it. You’re free to choose another but for the most reliable results in obtaining Debian packages I would recommend ftp.us.debian.org. You will use this mirror whenever you want to download software for your Debian installation. We will get to installing software in another tutorial. For now just select the top server and press enter.
You will be prompted with a dialogue that asks you what software you want to install from the previously selected repository. This is a convenient place to select a desktop environment if you would want one. We are however NOT going to install a desktop environment because I will teach you Debian the hard way. Use the arrow keys to navigate and space to select/deselect. Deselect everything except for the ‘standard system utilities’, you’re going to need those otherwise you’re left with just a core system. I don’t know what will happen but logic dictates you’ll probably end up making a mess trying to compile the tools you need. Make sure the software selection looks exactly like the following screenshot, use tab to highlight the ‘continue’ button and press enter.
We’re almost done installing. We now have to make sure the system can boot from the hard drive. You’ll get a dialogue that asks if you want to install GRUB boot loader to the master boot record of your hard drive. You want this otherwise you’re Debian won’t start. Select yes and press enter. Afther that you’ll select the hard drive where you just installed Debian to and also press etner.
That’s it, you’re done. Congratulations! But lets not celebrate yet, we still need to verify everything. Hit continue, and your system will reboot. After your PC, or VM boots up again you’ll see this screen:
Just press enter to continue booting Debian 8. After a few lines you will be asked for a passphrase. Yes, the one you need to enter to access your encrypted drives before then can be mounted by the startup sequence. Enter your passphrase in the following screen. You may not see the characters you type as stars. Just confidently type your passphrase and press enter. Nothing will happen if you mistype it, you’ll just be asked again.
This will boot your system like it should. If everything went according to plan, you’re now left with a login prompt. Enter either your username or type root followed with it’s password. Remember, you will not see the password in the form om * characters, just type the password and press enter, this is normal.
Now it’s time to celebrate, you’re done installing Debian 8. That wasn’t so hard now was it?
I understand that after this tutorial you’re left with a bare Debian 8 installation with just some system tools hooked up to the internet. I plan to write more articles very soon, to start off with a few commonly used terminal commands. I will also write an article explaining Unix type file-systems, how to navigate the file-system, some file attributes and a few examples.
Thanks for reading.