Installing and configuring Linux
This domain, Installing and configuring Linux, covers taking a machine from bare metal or a virtual disk to a bootable, configured host: disk layout, filesystems, persistent mounts, bootloader configuration, and post-install settings such as hostname, timezone, and the first administrative user.
Planning and layout
- Partition tables: MBR (four primary partitions, extended/logical workaround) versus GPT (many partitions, required for UEFI boot with an EFI System Partition).
- Typical layout: ESP at
/boot/efi,/boot,/, swap (partition or file), optionally separate/varand/home. LVM adds volume groups and logical volumes that can be resized. - Filesystems: ext4 (journaling, can shrink offline), XFS (large files, cannot shrink), vfat for the ESP. Create with
mkfs.ext4ormkfs.xfs, activate swap withmkswapandswapon. - Persistence lives in
/etc/fstab: device (preferUUID=), mount point, type, options, dump, fsck order.blkidprints UUIDs. - GRUB2 configuration is generated: edit
/etc/default/grub, thengrub2-mkconfig -o /boot/grub2/grub.cfgon RHEL orupdate-grubon Debian. Kernel changes may needdracut -forupdate-initramfs -u.
Worked example
Add a new 10 GB disk as /data. Partition with fdisk /dev/sdb, run mkfs.xfs /dev/sdb1, mkdir /data, read the UUID with blkid /dev/sdb1, then add UUID=... /data xfs defaults,nofail 0 2 to fstab and run systemctl daemon-reload followed by mount -a. Reasoning: the UUID survives device renaming, nofail stops a missing disk from blocking boot, and mount -a validates the entry before you reboot.
Traps
- Putting
/dev/sdXnames in fstab, where they can reorder. - Installing the bootloader to the wrong disk on a multi-disk system.
- Forgetting the ESP mount point in a UEFI install.
- Changing GRUB defaults without regenerating
grub.cfg.