How to install a Debian 12+ LVM

Introduction

Before installing a Debian 12 LVM image onto your hardware, it is important to know it's fundamental use-cases. LVM (Logical Volume Management) allows the user to have a more hands on approach with their disk space. This allows for more flexible use-cases in comparison to the traditional partitioning handled by the deb (short for Debian) installer.

LVM is not recommended for beginners in Linux systems, as it requires a higher level of involvement compared to the default partitioning setup.

Prerequisites

Downloading the Debian image

Firstly, in order to download the Debian image, we need to navigate to Debians website.

Now, you will be presented with multiple hyper links but we want to focus on the "Left side" of the website where it says "Download an Installation Image" and right below it, you will see:

The difference between the two is substantial. If you are in an area or plan to go into a remote service location with limited access to the internet, it is Highly recommended you download the "Complete Installation Image"
However, this installation is substantially larger than the minimal image (small insallation image) which is recommended if your in an area or will stay in an area with High-Speed internet.

Before we install the image, we need to establish wether if your system is x32 of x64. You can safely assume your system is x64 if you are modern hardware as most systems with modern CPU's are running x64. If your hardware is running x32, be sure to download the 32-bit ISO.
To easily establish if your system is 32 or 64 bit, do a simple search of your CPU(s) and OEM's will outline if they are 64-bit supported.

You may simply press the "X-bit PC netinst iso" to download the iso of your choice
It is highly recommended by me to download via torrents as this saves the server hosting the website the trouble of having to do P2P HTTPS downloads. Torrenting will allow for much faster download speeds as well. Or if all else fails, use HTTP/HTTPS mirros.

VMware Player installation

This install was done using VMware Workstation 17 Player 17.0.2 Licensed.

Now before we finalize everything, we want to press "Customize Hardware"

Once that's finished, press close and press "Finish" on the install wizard.

Now to setup the LVM disks, we need to create them. I will be creating 2 VD's (Virtual Disks) for this example.

When this is done, boot up your VM!

Initializing Debian

It is crucial to know that CTRL+ALT is the key to stop sending key/mouse strokes to the VM and back to the host OS.

Upon hearing the initial beep (assuming you have a sound card installed), use the arrow keys to navigate from now on as your mouse will not work and navigate to "Install" which is the second option and press enter to confirm

When starting the installer, you will be greeted with a "Select a Language" screen. Choose your primary Language, for this guide, I will be referring to everything in English/United States. You are more than free to translate this page if needed.

You will then be prompted for the hostname which will be fefaulted to "debian" but I will call mine "deblvmfinal" for the sake of this guide.

When it comes to hostnames, you can most likely skip over this as you will know when to use this screen but for now, let's skip over it and just press enter assuming nothing is in the text prompt

Your root account is now being initalized. This is the most important account to keep track of. Your root password is crucial to remember so be sure to set a strong password and confirm it.

The next screen will ask for your main non-root user account. I will be calling mine "tux" as this is something i've picked up from my Linux teacher in College as a fun fact.
Set the main accounts password accordingly.
Do NOT use the same password as your root account for your main account. This is a severe security risk.

After that, you will be prompted to do more localization.

The screen after that is the most important however. Be sure to select and enter the "Guided- use entire disk and set up LVM" as this is what this guide is for.

Ensure your using your main disk (I know my main disk based off the 25GB displayed in the configurator) and format it while pressing "Seperate /home partition"
Again, ensure your using the correct disk and press "Yes" on all the confirmation screens.

After a short while, you will be presented with a screen asking to scan more media for Debian, go ahead and press "No".
You will then have more localization to do and then you will be asked to selected a Debian archive mirror. The default "deb.debian.org" is ideal but it is up to you to decide which is closer and best for your needs.

The next screen will prompt for your consent to participate in the "Popularity-Contest" this is not necessary or required and I personally press "No" but this is ultimately up to you.

The next screen after is important. This is your "Desktop Enviroment" (DE) manager that you are chosing to install. The default is GNOME but I personally like the aesthetics of "KDE Plasma". This is all personal preference however.

It is also recommended to install the "SSH server" if your planning on doing anything remote with this hardware. As for my final, this is required so i will go ahead and press SPACE to select it.

At this point in time, the machine will begin deploying debian onto your main drive. Grab yourself a nice cup of tea or coffee if that's more your style and kick back while you watch 0's and 1's do their thing.

You will be prompted to install GRUB onto a drive. Ensure you have your main drive selected and confirm it.

After this, you will be done with installing Debian!

Welcome to Debian!

Welcome to your shiny new install of Debian and your very aesthetically appeasing DM! But, we are professionals here of course so it's time to boot up the good old terminal!

It is called "Konsole" for KDE Plasma, I will go ahead and pin it to my toolbelt on the bottom.

Now, launching the terminal, The first thing I like to do when installing a new Linux OS is to run the simple command

This ensures your system is up to date and the latest packages and mirrors are supplied for the remainder of this guide.

Considering this is a new installation, you won't have many packages/dependencies so it should not take too long.

Setting up the LVM

Now that we have our Debian installed and updated, we want to know where our disks are located. Run the command parted -l to see all disks connected to your system. It is recommended to note down the mounts of these drives (for ex: "/dev/sda: 10GB Drive 1" etc)

Creating PV's

In-Order to create PV's (Physical Volumes) we want to use the command pv using the root account.

To create a PV

After this is done, we want to ensure our PV's are created using the pvs & pvdisplay command and you will see your drives listed.

Creating VG's

After creating our PV's, we want to create our VG's (Volume Groups)using the command vg.

To create a VG

After this is done, let's validate our VG's by executing
vgs && vgdisplay

Creating LV's

After creating our VG's, it is now time to create our LV's (Logical Volumes) using the command lv

To create a LV

Then execute lvs & lvdisplay to ensure the LV's are created.

Wrapping up our LVM FS

Now that your brain is steaming and your fingers are on fire, let's wrap things up with a pretty bow on top!

Making our LV mountable

Using the typical Linux FS ext4, let's format our LV to be mountable so we can use it.

Ta-da! You now have mounted your LV's. Now upon system rboot, you will have this unmounted by default so we need to edit our fstab to mount this automagically.

Using your Text Editor of choice, edit /etc/fstab
Add

Now we are officially done with our LVM setup!

Final assignment extra programs

Below are the requirements for the final running all commands with the root user.

Installing and configuring sudo

This is a powerful addition to give a user. Be sure you understand the complications that come with giving a user sudoer permissions

Setting up the Serial Console

In the VM settings:

Installing a webserver (NGINX)

When installing a webserver, it is important to know how your serving it. There are two major competitors in this field, "apache" and "NGINX." To describe the difference between these two offerings is something that is out of the scope of this guide. It is recommended to do your own research. I will personally be using "NGINX."

To install NGINX:

It's that simple! Visit http://localhost:80 to view your webpage!

To edit your files:

Add additional users

To add additional users to the VM:

My personal creature-comforts

OhMyZsh!(https://ohmyz.sh/)

BASH as good as it is, lacks the eye candy aka the bloat. But I want to feel comfortable using my shell with plugins and what not.

Ta-Da! It's that simple to swap your shell to something else. However, I also like to run chsh -s $(which zsh) and relogin to my accounts to ensure the "change shell" command worked as stated above.

Neofetch

Ah, what would a Linux user be without his fancy little logo being displayed everytime they login to their shell? Here's how easy it is to install neofetch

Then just add clear & neofetch
to your file on an empty line and call it a day!