Introduction to Linux – Installation

Reading Time: 6 minutes

Part 1 – Installation and Basic Terminology

GNU / Linux is a multiuser and a multitasking general purpose operating system. A lot of people shy away from using its desktop version since it demands that the user knows some technical things in order to use it properly. However it’s not very difficult once you grasp some of the very basic concepts which are used in all popular Desktop versions of other operating systems as well.

GNU / Linux provides complete transparency when it comes to usage. What this means is not only you get to see the good things but also the bad things viz errors, warnings in a full blown technical manner. But once you understand how it all works there’s no going back to anything else since GNU / Linux is better in most things than everything else out there.

Learning Topics

TopicDescription
InstallationUnderstanding how to install a GNU / Linux distribution, the terms used and what they mean to make the correct decisions at the time of installation.
File System LayoutUnderstanding the File System Layout and File System Hierarchy Standard.
Linux CommandsLearning to use the Linux Command line.
Automating tasks with Scripts.Learning how to write Linux Shell Scripts.

Installing Linux

GNU / Linux is made up of several components of software and there are many distributions out there which make the installation quite easier. In a nutshell there are two major components

  1. The software which can be run on the Operating System. These software programs are generally open sourced GNU versions (GNU Not Unix) of popular programs found in the Unix systems, in addition several other Linux specific programs are also available.

  2. The kernel which helps in running programs and also provides device management viz files, devices etc.

In order to have a functional Operating System we need both, the software and the kernel. Since the software part mostly comes from GNU and kernel is Linux kernel, the Operating System itself is known as GNU / Linux however the distributions are free to label their version of the bundle, for example some popular distributions are Ubuntu, RedHat, SuSE, Fedora, Kali, Android (though not directly usable as a desktop system).

Booting From an USB / Optical drive

Usually the distribution would be available as bootable ISO image from the respective distribution website. However some distributions might not be able to boot on newer machines which have Secure Boot (EFI / UEFI) enabled in their BIOS. An UEFI enabled machine requires that the operating system which is being booted is signed digitally (well actually the boot loader needs to be signed) by the signer available on your board’s (Mother Board) firmware.

Some Linux distributions are able to boot with UEFI enabled however if you choose one that doesn’t work then you’ll have to disable UEFI in BIOS and choose instead legacy boot option.

Setting up a Dual Boot / Multi boot

If you want to have a Dual boot system. Say Windows and Linux both installed on the same machine, you’ll probably want to use a distribution which supports UEFI. Also the order of installation is extremely important, the boot loader for Linux for x86 / x86_64 systems is GRUB which is capable of detecting and co-existing with previously installed boot loaders. It does this through chain loading which works like below,

  1. First GRUB gets control and checks if it has earlier recorded any other Operating System boot loaders.

  2. Then it presents the user with a selection screen which shows which other operating systems are present.

  3. It then uses the boot loader of the selected entry to boot into.

Note that it transfer control to the boot loader of the selected operating system but doesn’t boot the OS itself unless it had an entry to boot it.

With the above concept out of the way it’s straight forward to know that any boot loaders (operating systems) which can’t co-exist with other need to be installed first. Thus to make your machine dual bootable

  1. Install Windows First 
  2. Install Linux Distro(s)

However note that if you upgrade your Windows it might re-write the MBR(Master Boot Record) and you won’t be able to boot the Linux distributions then. To fix this you’ll have to re-install GRUB and configure it for Dual Boot again.

Suse Installation Screen

This is the first installation screen, once you select Installation a Linux kernel is loaded first and then installation process is started beginning with probing the hardware and loading the necessary device drivers. The device drivers are loaded as kernel modules which can be thought of as a plugin to the kernel. Once loaded these become part of the running kernel and if a module behaves badly then it can crash the system.

In case you’re facing an issue with a particular module while installing, for example your WiFI hardware isn’t fully supported by the open sourced driver and requires a binary

blob or a firmware update then you might want to disable that particular module during installation. For example machines that have a NVIDIA graphics card, the driver is proprietary and made available for free by NVIDIA and needs to be installed separately post installation.

Terminology Used

Term UsedDescription
Frame Buffer or Frame Buffer deviceYour graphics output device. Could be a monitor / TV or a dedicated Graphics card.
Desktop EnvironmentThe work environment, it could be a GUI or console only. The GUI ones are called Desktop environments and multiple desktop environments available, some are extremely graphics heavy while others are extremely light. Two of the most popular ones are GNOME and KDE. If you’re planning to also use a VNC connection it’s recommended to go with GNOME though.
X Window SystemThis is the original Windowing system and was the de-facto Windowing system for Linux but some distributions have adopted a new Windowing system now.
Wayland – WestonThis is a relatively new Windowing system found mostly with KDE environment.
Hard drives / SATA disksThe parallel ATA drives (ATA) drives appear as /dev/hd* while the serial ATA drives (SATA) drives appear as /dev/ sd*. The * is replaced by an alphabet for a disk and for a partition it also appends the partition number. For example

  • /dev/sdb -> is the second SATA disk drive (whole)

  • /dev/sdb1 -> is the first partition of the second SATA disk drive

These devices are also known as block devices since they operate on chunks of blocks of bytes rather than individual bytes.
Disk ParitionsAs shown in the example above Disk Partitions appear as just separate devices and not as any labels. There are 2 formats available

  1. GPT Partition (GUID Partition Table) -> This allows for multiple partition entries and also has a backup saved near the disk’s end.

  2. MBR Partition (Master Boot Record) -> This only allows for 4 partitions and they can be of either a Primary or an Extended partition. A primary partition can be used to boot from the device while an extended partition contains other partitions under it.
RAID and Logical Volumes / Logical Volume Mangar (LVM)This is mostly used where data needs to have a fail safe switch and is done using multiple disks. In this case two or more physical disks are combined together to be viewed as a single disk. More physical storage can be added / removed at any time.

  1. Volume Group -> A collection of physical disks combined together to be viewed as a single physical disk.

  2. Logical Volume -> This is the actual disk seen by the programs when opening / saving files. After creating a Volume Group the logical volume can be created on top of it specifying the size. It can also be increased later on by adding more physical storage to the volume group. However resize2fs is required to resize the file system created on top of it.
Swap PartitionWhen running Linux on a system with lesser memory this can come useful. The Swap partition is a specific area of disk used entirely by the kernel for storing live contents of RAM when memory is required for the kernel to operate properly.

Ideally it should be twice the size of your RAM, however if there’s enough RAM available you may not require it at all or give it lesser space since it won’t be available to user.

It can also be turned on / off dynamically using swapon and swapoff commands.
File SystemA file system is what is used by user programs to store and retrieve files. There are numerous file systems available for the Linux kernel and all are available as loadable kernel modules. Major file system modules available are ext4, btrfs, squashfs, nfs , xfs etc.

To load a specific kernel module you can use the command modprobe or insmod.

To create a file system we can use
mkfs.<fs_type> <block device>

For example

  • mkfs.ext4 /dev/sda1

  • mkfs.xfs /dev/sda1

File Systems are always made on either logical volumes or partitions but never directly on the whole disk as such without the proper alignment options in place.
Mount pointA block device which has been properly formatted with a file system needs to be mounted first before it can be used.

A mount point is a directory where a block device is mounted under. It can also be thought of attaching the file system present on the block device under the directory so it can be usable.

For example: Consider we’ve a directory named /mnt and a block device /dev/sda1 and we would like to mount (attach) the file system on this block device to /mnt. So we can do that using
mount -t <fs_type> /dev/sda1 /mnt

Now the files on the block device can be accessed under
the /mnt directory.
NOTE that the module of fs_type must be loaded before we can mount since that module is actually the file system driver which understands the particular file system.
Mount BoundarySome operations are allowed only on one block device. For example let’s consider there are two block devices /dev/sda1 and /dev/sda2 and these are mounted on /mnt1 and /mnt2 respectively.

Now if we wanted to create a soft link of a file from /mnt1/ file1 to /mnt2/file2 that wouldn’t be possible since these are two separate file system instances.

Partitioning Scheme

The image to the left shows the expert partitioning mode. You might not want to do this on your first try though!
You can control how much space you want and how many partitions you want. No need to configure RAID if you’re not using at least 3 “real physical disks”.

Packages and Package Database

Each software is called as a “package” and these packages are available as an installable unit. Unlike other Operating Systems where an executable takes over and installs the files, most Linux distributions bundle a tool to install packages. Most popular installable units are .deb and .rpm with .rpm being the most widely available. RPM (RPM Package Manager) packages are installed via rpm tool while .deb packages are installed via dpkg tools.

When a package is installed via any of the above, it’s meta-data, is stored in a system-wide database which can be looked up later using the same tools. The meta-data includes information about what files does a package provides, where has it been installed, version, license etc. However it’s not required to install any package to use it, if you can compile it you can always use it without system- wide installation

Package Repositories (“repos”)

Package repositories are stores from where you can lookup and install any software available. These repositories could either be via internet or they could be setup using a local media or a directory. The repositories available via internet could be either official repositories or you can also have non- official repositories, however if you choose to use any un-official repository then you might not get the support from your distribution vendor for the same. An example is shown below

YAST Repos

As can be seen in the image, multiple repositories can be configured for a system and if they’re enabled they would be searched for a package if not already installed on the system. The official packages are usually signed with a gpg signature and SuSE by default doesn’t allow a non- signed package to be installed. If you still need to install such a package use the – – no-gpg-checks option from the command line tool zypper to install such a package.

Device Types

Linux classifies every device as a file. This is an abstraction presented to the user space programs implying that you can open / read / write to a device in pretty much the same way as a regular file. Not all devices are same and thus need to be identified using their characteristics. The device file supported by Linux are

Device Types

Device TypeClassification
Symbolic LinksA symbolic link is a disk based pointer which needs to point to a real file somewhere on the disk. The contents of a symbolic link is the path to the real file. These files show up with the letter l in front when ls -l is used. An example is shown below
lr-xr-xr-x 1 root wheel 0 Dec 1 09:12 stderr -> fd/2
Unix Domain SocketsOne way of communication is through the use of sockets. Sockets have the same abstraction as other device files however Unix Domain sockets can actually be seen through file listing (not TCP/IP or UDP). These appear with the symbol s in front when ls -l is used. An example is shown below
srw-r--r-- 1 root wheel 0 Dec 1 09:13 /var/tmp/ filesystemui.socket
DirectoriesThese are special entries which can hold other file system entries. Sort of a container, these appear with the letter d when ls -l is used. An example is shown below
drwxr-xr-x 3 root wheel 96 Dec 11 19:49 Volumes
Block DeviceA block device is typically a storage device for example a hard drive, a zip drive etc. These show up the a letter b in front when ls -l is used. An example is shown below
brw-r----- 1 root operator 1, 0 Dec 1 09:12 disk0
Character DeviceThese really are general purpose devices and at times doesn’t even represent a physical device. These could be a frame buffer device, a clock , random number generator etc. These can be identified with a letter c in front when ls -l is used. An example is shown below
crw-rw-rw- 1 root wheel 14, 0 Dec 11 19:29 /dev/random
Regular FilesThese are files anything not from the above options. These can be binary or text. These files appear with no letter when ls -l is used. An example is shown below
-rwxr-xr-x 1 root wheel 1331248 Jan 1 2020 zsh

Kernel Modules

A kernel module is an extension code for the kernel which, when loaded, becomes part of the running kernel code. Since it’s not possible to compile kernel every time a new device is added to the system, kernel modules are used to provide “extra” functionality much like a plugin to an application software.

Most kernel modules provide drivers viz file system drivers, device drivers or some core kernel extensions viz SELinux. You can even write an extremely simple “hello world” kernel module and load it, we’ll do this later in this series. The kernel modules or “kernel objects” usually end up with an extension “ko” post compilation.

Loading a kernel module

Most devices would work out of the box with Linux as most distributions include a lot of drivers, even when the device isn’t present on the system. However since most of the source code is available for the drivers nothing stops you from tweaking it and using that tweaked driver instead.

When you plugin a USB device, the USB hooks allow the driver to be loaded automatically without your intervention. However if that USB device class isn’t present in the hook or you’re adding a new USB device to your system then it might need to be loaded by yourself. For this purpose there are actually two commands, however you’ll need superuser access to run these commands

Loading Kernel Modules

CommandDescription
insmodThis command loads a kernel module. It requires the path where the kernel module is present and doesn’t check if any required dependent modules are already loaded or not. An example invocation is shown below
insmod <path_to_my_kernel_module>
modprobeThis command loads the kernel module from a pre- configured standard location on the system by default (/lib/modules/`uname -r`)

It also checks for dependencies for a module generated using depmod and attempts to load them first before loading the dependent module. An example invocation is shown below
modprobe <module_name>

The module name is the name of “ko” file not the path to the file itself.

Leave a Reply