PRE-SETUP
1. How Many Drives and Sizes Needed?
-
Main Drive:
- Purpose: Primary installation with partitions for Proxy, GitLab, Frontend, Backend.
- Specs: 1000GB external drive (e.g.,
/dev/sdd
).
-
Backup Drive:
- Purpose: Mirror of the main drive for recovery in case of failure.
- Specs: Equal size to main drive (1000GB).
-
Recovery Drive:
- Purpose: Bootable AlmaLinux environment to work on other drives.
- Specs: 32GB USB stick (or larger if tools/environment require more space).
2. What Do We Need to Create Them?
Machines Needed:
- A working machine with AlmaLinux installed or bootable.
- A second machine (optional but preferred) for testing/recovery while working on the main.
Environments Required:
-
Primary Machine:
- AlmaLinux minimal or full environment.
- Tools installed (see below).
-
Recovery Environment:
- Bootable USB or external drive running AlmaLinux (live environment).
Tools to Install:
-
For Partitioning and Filesystems:
parted
xfsprogs
(for XFS filesystem tools)util-linux
(for tools likewipefs
andblkid
)
-
For Backups and Recovery:
dd
(for cloning drives/partitions)sgdisk
(for partition table backups)rsync
(for incremental file backups)
-
Optional:
btrfs-progs
(if using BTRFS in the future).
3. Why Do We Need Three Drives and How They Work Together?
-
Main Drive:
- Acts as the primary working drive, partitioned and formatted for Proxy, GitLab, Frontend, and Backend.
-
Backup Drive:
- An exact replica of the main drive. Used for quick recovery if the main drive fails.
- Backup created periodically using
dd
orrsync
.
-
Recovery Drive:
- Bootable drive containing a full AlmaLinux environment with tools preinstalled.
- Used to work on and repair either the main or backup drive without risking a running environment.
COMPLETE LIST OF STEPS WITH EXAMPLE COMMANDS
Step 1: Prepare Recovery Drive
-
Download AlmaLinux ISO and create a bootable USB:
sudo dd if=alma-linux.iso of=/dev/sdx bs=4M status=progress
-
Boot into the recovery environment and ensure tools are installed:
sudo yum install -y parted xfsprogs util-linux
Step 2: Zero Out the Main and Backup Drives
-
Completely wipe the drives:
sudo dd if=/dev/zero of=/dev/sdx bs=1M status=progress
Step 3: Partition the Main Drive
-
Open
parted
:parted /dev/sdx
-
Set partition table to GPT:
mklabel gpt
-
Create partitions:
-
ESP:
mkpart ESP fat32 1MiB 513MiBset 1 boot on
-
Boot:
mkpart primary xfs 513MiB 1537MiB
-
Root:
mkpart primary xfs 1537MiB 3GiB
-
Swap:
mkpart primary linux-swap 3GiB 20GiB
-
Proxy:
mkpart primary xfs 20GiB 70GiB
-
GitLab:
mkpart primary xfs 70GiB 370GiB
-
Frontend:
mkpart primary xfs 370GiB 470GiB
-
Backend:
mkpart primary xfs 470GiB 570GiB
-
Extra Space:
mkpart primary xfs 570GiB 100%
-
-
Exit
parted
:quit
Step 4: Format Partitions
-
Format each partition as needed:
-
ESP:
mkfs.fat -F32 /dev/sdx1
-
XFS Partitions:
mkfs.xfs /dev/sdx2
mkfs.xfs /dev/sdx3
mkfs.xfs /dev/sdx5
mkfs.xfs /dev/sdx6
mkfs.xfs /dev/sdx7
mkfs.xfs /dev/sdx8
mkfs.xfs /dev/sdx9 -
Swap:
mkswap /dev/sdx4
-
Step 5: Label Partitions
-
Add labels to make partitions easy to identify:
fatlabel /dev/sdx1 ESP
xfs_admin -L "boot" /dev/sdx2
xfs_admin -L "root" /dev/sdx3
xfs_admin -L "proxy" /dev/sdx5
xfs_admin -L "gitlab" /dev/sdx6
xfs_admin -L "frontend" /dev/sdx7
xfs_admin -L "backend" /dev/sdx8
xfs_admin -L "extra" /dev/sdx9
Step 6: Create the Backup Drive
-
Clone the main drive to the backup drive:
sudo dd if=/dev/sdx of=/dev/sdy bs=1M status=progress
Step 7: Verify Setup
-
Check partition layout:
parted /dev/sdx print
-
Check mounted filesystems:
lsblk -f
This ensures all drives are properly set up and ready for use.
Before Phase 3: Reboot and Enter Installer
-
Mount the Partitions:
-
Mount the root partition:
mount /dev/sda3 /mnt
-
Create and mount the boot partition:
mkdir -p /mnt/boot
mount /dev/sda2 /mnt/boot -
Create and mount the EFI partition:
mkdir -p /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi -
Enable swap:
swapon /dev/sda4
-
-
Reboot the system and boot into the regular AlmaLinux installer.
-
Select Custom Installation for partition setup.
-
Ensure Bootloader Configuration:
- Disable adding a new bootloader.
- Use existing partitions for boot.
-
Map partitions in the installer:
/dev/sdb1
→/boot/efi
/dev/sdb2
→/boot
/dev/sdb3
→/
/dev/sdb4
→swap
-
Reformat Existing Partitions:
- Ensure all selected partitions are reformatted to avoid conflicts.
-
Verify settings before proceeding with the installation.
Post-Installation: Configure Additional Partitions
-
Mount GitLab, Frontend, and Backend Partitions:
-
GitLab:
mkdir -p /mnt/gitlab
mount /dev/sdx6 /mnt/gitlab -
Frontend:
mkdir -p /mnt/frontend
mount /dev/sdx7 /mnt/frontend -
Backend:
mkdir -p /mnt/frontend
mount /dev/sdx7 /mnt/frontend
-
-
Verify Mounts:
lsblk -f
-
Update
/etc/fstab
for Persistent Mounts:-
Add entries for the partitions:
/dev/sdx6 /mnt/gitlab xfs defaults 0 0
/dev/sdx7 /mnt/frontend xfs defaults 0 0
/dev/sdx8 /mnt/backend xfs defaults 0 0
-
-
Test Mounts:
-
Remount all filesystems to ensure no issues:
mount -a
-
CLI Installation Addendum
For users comfortable with the command line, detailed CLI instructions for manual installation will be added as a separate guide. This guide will include all commands and steps for installing AlmaLinux without the graphical installer, including creating necessary directories, mounting partitions, and setting up the base system.
This addendum will help users who prefer or require CLI-only environments while ensuring consistency with the graphical installation process.
Code Glossary
This section provides a quick reference for common commands used throughout the setup process. Each command includes a brief explanation and example to help users understand and execute them effectively.
-
lsblk
:-
Lists information about block devices (e.g., partitions, mount points).
-
Example:
lsblk -f
-
-
parted
:-
A partition management tool.
-
Example commands:
parted /dev/sdxmklabel gptmkpart primary xfs 1MiB 500MiBparted /dev/sdx print
-
-
dd
:-
Utility for copying and converting data at the byte level.
-
Example:
dd if=/dev/sdx of=/dev/sdy bs=1M status=progress
-
-
ls -l
:-
Displays detailed information about files and directories, including partition sizes and types.
-
Example:
ls -l /dev/disk/by-label
-
-
mount
andumount
:-
Used to attach and detach filesystems.
-
Examples:
mount /dev/sda1 /mnt/boot/efiumount /mnt/boot/efi
-
-
mkdir
:-
Creates directories.
-
Example:
mkdir -p /mnt/boot/efi
-
-
Other Frequently Used Tools:
-
blkid
: Lists block device attributes.blkid /dev/sda1
-
swapon
andswapoff
: Enables or disables swap partitions.swapon /dev/sda4swapoff /dev/sda4
-