From 92817fef32d929e35514bf772d2a0878f7228d02 Mon Sep 17 00:00:00 2001 From: waldek Date: Mon, 21 Feb 2022 12:11:45 +0100 Subject: [PATCH] Quite a few updates --- essential/readme.md | 128 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 121 insertions(+), 7 deletions(-) diff --git a/essential/readme.md b/essential/readme.md index 68abc88..3ab5867 100644 --- a/essential/readme.md +++ b/essential/readme.md @@ -11,7 +11,7 @@ ### Who is behind this project? * Who is [Richard Stallmann](https://en.wikipedia.org/wiki/Richard_Stallman)? -* Who is [Linux Torvalds](https://en.wikipedia.org/wiki/Linus_Torvalds)? +* Who is [Linus Torvalds](https://en.wikipedia.org/wiki/Linus_Torvalds)? ### What is the deal with 'GNU-slash-Linux'? @@ -39,25 +39,59 @@ ## How to create a virtual machine -Step by step walk-through of a VM creation in virtualbox with some notes on each step with best practice pointers. +In order to run virtual machines, or VM's, we need a **host** program. +One of the most popular ones out there is called `virtualbox`. +It should be installed on your machine but in case it's not you can download it [here](https://www.virtualbox.org/wiki/Downloads). +If you **expand** the section below you'll see a step by step walk-through of a VM creation in virtualbox with some notes on each step with best practice pointers. +
+ Expand me... + +**Nice!** + +1. Name your machine and select *linux* if it's not chosen automatically. ![virtualbox setup](../assets/2022-02-18-122703_1920x1080_scrot.png) +1. Set the amount of RAM for your machine. +This can be anything between an absolute minimum and your physical machine's limit. +You can't *magically* use more RAM than physically available! ![virtualbox setup](../assets/2022-02-18-122833_1920x1080_scrot.png) +1. You need a virtual hard drive to store the OS and all your data to. ![virtualbox setup](../assets/2022-02-18-122930_1920x1080_scrot.png) +1. The format doesn't matter that much. +I always go for the default one. ![virtualbox setup](../assets/2022-02-18-122943_1920x1080_scrot.png) +1. Most of the time you'll want dynamic size meaning the disk **file** will only take up as much **space** as it needs. +For example, if you set a size of 50GB for your disk and your OS plus personal files take up 12GB, the actual space this image takes op on the physical disk of your **host** will be about 12GB. ![virtualbox setup](../assets/2022-02-18-122951_1920x1080_scrot.png) +1. We'll soon discover **how much space** a basic Linux installation takes up but for now I would recommend the following. + * **with** a graphical environment: 20GB + * **without** a graphical environment: 10GB (minimal/server/headless install) ![virtualbox setup](../assets/2022-02-18-123011_1920x1080_scrot.png) +1. By default your machine will have only **one** CPU core but you can add more via the settings. +This is something you can change whenever you need more processing power but the same rule as with the RAM applies, it's not a magical way to add resources to your machine. ![virtualbox setup](../assets/2022-02-18-123047_1920x1080_scrot.png) +1. Last but not least we need to insert the installation disk into the virtual machine and boot it up! ![virtualbox setup](../assets/2022-02-18-123121_1920x1080_scrot.png) +
## Breakdown of the Debian installation All right, enough talking, let's get started! I'll install a full blown and modern graphical Debian machine and I would like you to **not** do it yourself but take **notes** on each step so you'll be able to reference your notes later **when** I ask you to install a machine yourself. +Below is a gain a step by step walk through with some of my tips but a more details guide can be found in the [Debian Administrator Handbook](https://debian-handbook.info/browse/stable/sect.installation-steps.html). +This book is a real *bible* of information and I highly advise you to read through it. -* [step by step](https://debian-handbook.info/browse/stable/sect.installation-steps.html) installation instructions - * **don't set a root password, use `sudo` instead** - * **stress the graphical/minimal difference** +My most important notes would be the following. + +* **Read** each section carefully and you'll know what to do. +* Don't set a root password but use `sudo` instead. +* Don't install a graphical environment if you don't need one. +It's a lot easier to add one later than to remove it. +* Don't forget to install `grub` at the end otherwise your installation will not be able to boot. +You *can* recover from this mistake with [supergrub2](https://www.supergrubdisk.org/super-grub2-disk/) but that's for an other day. + +
+ Expand me... ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_32_45.png) ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_32_57.png) @@ -91,6 +125,7 @@ I'll install a full blown and modern graphical Debian machine and I would like y ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_50_38.png) ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_50_55.png) ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_51_07.png) +
### Exercise @@ -103,22 +138,48 @@ Can you install extra software? ## Quick look at an idle system +You can inspect the system by running the *gnome task manager*. +It lists all your running processes, sorted by CPU percentage, in the first tab which can give you a good idea of what's happening on your system. +Note that an idle system uses almost **no resources**! +Plus, a fresh install, with quite a few essential programs such as a browser, music player, text editor, etc only takes up about 5GB of disk space! +This is mind blowing compared to a windows installation. +How is this possible? +That's the magic of a good package manager! + +
+ Expand me... + ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_53_40.png) ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_54_33.png) ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_54_41.png) +
## Package managers -* what is a [package manager](https://en.wikipedia.org/wiki/Package_manager) +What is a [package manager](https://en.wikipedia.org/wiki/Package_manager) ### Graphical installation +Modern Linux has come a long way and it's now quite usable without any command line knowledge. +We can install extra software from the graphical environment if we want. + +Let's look for `vlc`, a popular open source video player. +When we look for it from `activities` we *see* a reference to it via the `software` program. +If we click on it we'll be take to a sort of *app or play store* where we can choose to install or uninstall programs. +Because adding and removing software from our machine is quite *invasive*, we need to **prove** we have the right to do so. +A prompt will pop up where you'll need to input **your** password. +If your password does not work, you probably set a `root` password and you should use that one instead. + +
+ Expand me... + ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_51_24.png) ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_52_06.png) ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_52_15.png) ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_52_36.png) ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_52_46.png) ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_52_53.png) +
### Command line installation @@ -245,8 +306,11 @@ waldek@hellodebian:~$ sudo reboot now Please create a second virtual machine and install a **minimal** Debian. Minimal means **no graphical environment**. I advise you to **not** set a root password. + Once this machine is up and running, install a few programs. The only one we saw up until now is `htop` but maybe try out `bmon`, `elinks` and/or `ranger`. +Once these are installed have a look at the running services and programs via `htop` and compare it to both your graphical installation **and** your graphical install but running in `multi-user.target`. + ## Guest additions @@ -354,7 +418,7 @@ You can also enable copy/paste and drag and drop between your host and VM now. We'll be using a few new *words* to reference the command line such as *shell*, *bash* and *terminal* through out the course. They all pretty much mean the same thing but with some small, and not so important, differences between them. Essentially a command line is a **textual interface** for humans to operate a computer. -What is very important to understand is that textual command and graphical actions operate on the same computer. +What is very important to understand is that textual commands and graphical actions operate on the **same** computer. For example, if you create a file via the command line, it will show up in you file explorer and vice versa. The graphical and textual interfaces are just different *representations* of the same machine. @@ -410,5 +474,55 @@ But what happens if you **close** vlc? The commands you typed get executed! This is an illustration of the **sequential** nature of a command line. +Now, I don't think we have sufficiently *proven* that `date` is a full blown program so let's dig a bit deeper. +``` +waldek@hellodebian:~$ which vlc +/usr/bin/vlc +waldek@hellodebian:~$ which date +/usr/bin/date +waldek@hellodebian:~$ which which +/usr/bin/which +``` +There is quite bit to *unpack* in the example above. +First, what on earth is `which`? +Well, it's *also* a program and it's sole purpose in life is to tell you **where** a program is located on your system. +Because `which` by itself does not make a lot of sense it needs what we call an **argument**. +Here the argument is the name of the program we want to know it's location of. +The existence of arguments is the second big thing we discovered here. +The third new thing we can observe here is what we call **paths**, meaning locations on the system. +For example, `vlc` is a *binary* program located in a **folder** called `bin` which is located in a folder called `usr` which is at the *root* of your system. +If this sounds complicated, don't worry, we'll go into detail a bit later. + +Now that we know **where** some of our programs are located, let's find out **what** they are. +The methodology is the same as with `which` but we'll use an other program called `file` who's purpose in life is to tell more about the **content** of a certain file. +Logically, `file` needs an argument and this argument is the **path** to the file you want to inspect. + +``` +waldek@hellodebian:~$ file /usr/bin/vlc +/usr/bin/vlc: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=51c40f8234213415771b3a344cab25a140543f8a, for GNU/Linux 3.2.0, stripped +waldek@hellodebian:~$ file /usr/bin/date +/usr/bin/date: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=b740f054aaef6a85aff024858c914c7eae70a6a5, for GNU/Linux 3.2.0, stripped +waldek@hellodebian:~$ file /usr/bin/which +/usr/bin/which: POSIX shell script, ASCII text executable +waldek@hellodebian:~$ file $(which which) # this is some command line kung fu... +/usr/bin/which: POSIX shell script, ASCII text executable +waldek@hellodebian:~$ +``` + +Here we learn that both `vlc` and `date` are **executables**, compiled for an x86-64 system. +I would say they are both created *equally* no? +Both are actual programs. +But what about `which`? +It's also an executable but not compiled, it's a *POSIX shell script*. +So not all programs *are* created equally? + +### Compiled vs interpreted + +Executing a file, or program, means you take this file and tell the computer it needs to execute the actions that are stored in the file. +Compiled programs contain actual [instructions](https://en.wikipedia.org/wiki/Instruction_set_architecture#Instructions) the computer understands out of the box. +This means that programs that are compiled are always compiled for a specify architecture which in our case is x86-64. +On a Raspberry Pi this would be armhf or arm64. + +## `root` and `/` and `/root` are not the same thing