Networking and System AdministrationUnit 29 min read
Linux Installation, Boot Process, Package Mgmt & CLI Admin
Unit 2 of Networking and System Administration covers Linux installation methods (text/graphical), the boot process (GRUB, initramfs, runlevels), package management (RPM, DEB, yum/dnf/apt), and essential command-line administration (file operations, permissions, processes). Learn how to configure a minimal Linux system
Key Concepts and Installation Methods
1. Linux Installation Methods
Linux can be installed in multiple ways, each suited for different scenarios:
Text-Based vs. Graphical Installation
- Text-based: Faster, less resource-intensive, preferred for servers or remote installations.
- Graphical: User-friendly, ideal for beginners or desktop systems.
Installation Media
- USB/DVD: Most common method.
- Network (PXE): Used in large-scale deployments (e.g., corporate environments).
- Cloud (AWS, Azure, GCP): For virtualized or cloud-based Linux instances.
Partitioning Schemes
Linux supports various partitioning schemes, including:
- MBR (Master Boot Record): Legacy, supports up to 4 primary partitions.
- GPT (GUID Partition Table): Modern, supports up to 128 partitions, required for systems >2.2TB.
The Linux Boot Process
The boot process is a critical sequence that loads the operating system into memory. Here’s a step-by-step breakdown:
1. BIOS/UEFI Initialization
- The system’s firmware (BIOS/UEFI) performs a Power-On Self-Test (POST) to check hardware.
- Detects bootable devices (e.g., USB, HDD, network).
2. Bootloader (GRUB)
- GRUB (GRand Unified Bootloader) is the default bootloader in most Linux distributions.
- Allows selection of the OS/kernel to boot (useful for dual-boot systems).
- Loads the kernel and initramfs (initial RAM filesystem).
sequenceDiagram
participant BIOS
participant GRUB
participant Kernel
participant Initramfs
participant RootFS
BIOS->>GRUB: Load bootloader
GRUB->>Kernel: Load kernel + initramfs
Kernel->>Initramfs: Mount root filesystem
Initramfs->>RootFS: Hand over control
RootFS->>Systemd: Start services3. Kernel Initialization
- The kernel initializes hardware (CPU, memory, storage).
- Loads drivers and mounts the root filesystem.
4. Init System (systemd)
- systemd is the default init system in modern Linux distributions.
- Manages services, processes, and system states (runlevels).
Runlevels (SysVinit) vs. Targets (systemd)
| SysVinit (Runlevels) | systemd (Targets) |
|---|---|
| 0: Halt | poweroff.target |
| 1: Single-user | rescue.target |
| 2: Multi-user (no NFS) | multi-user.target |
| 3: Multi-user (text) | graphical.target |
| 5: Multi-user (GUI) | |
| 6: Reboot | reboot.target |
Package Management in Linux
Linux distributions use different package management systems:
1. RPM (Red Hat Package Manager)
- Used by RHEL, CentOS, Fedora.
- Commands:
rpm -ivh package.rpm # Install rpm -e package # Erase (remove) rpm -qa # Query all installed packages
2. DEB (Debian Package)
- Used by Debian, Ubuntu.
- Commands:
dpkg -i package.deb # Install dpkg -r package # Remove dpkg -l # List packages
3. Advanced Package Managers
- yum/dnf (RHEL/Fedora): Handles dependencies automatically.
dnf install package # Install (Fedora/RHEL 8+) yum install package # Install (older RHEL/CentOS) - apt (Debian/Ubuntu): Uses
.debpackages.apt update # Update package list apt install package # Install
Comparison Table
| Feature | RPM (yum/dnf) | DEB (apt) |
|---|---|---|
| Distro | RHEL, Fedora | Debian, Ubuntu |
| Dependency Handling | Automatic (yum/dnf) | Automatic (apt) |
| Package Ext. | .rpm |
.deb |
| Default CLI | dnf, yum |
apt, apt-get |
Command-Line Administration
1. File Operations
| Command | Description |
|---|---|
ls |
List files/directories |
cd |
Change directory |
pwd |
Print working directory |
mkdir |
Create directory |
rm |
Remove files/directories |
cp |
Copy files |
mv |
Move/rename files |
touch |
Create empty file |
cat |
Display file content |
grep |
Search text in files |
2. File Permissions
Linux uses rwx (read, write, execute) permissions for users, groups, and others.
chmod 755 file.txt # Owner: rwx, Group/Others: r-x
chown user:group file.txt # Change owner/group
Permission Table
| Number | Permission |
|---|---|
| 4 | r-- (Read) |
| 2 | -w- (Write) |
| 1 | --x (Execute) |
| 7 | rwx (Full) |
3. Process Management
| Command | Description |
|---|---|
ps |
List processes |
top/htop |
Interactive process viewer |
kill |
Terminate a process |
killall |
Kill all processes by name |
pgrep |
Find process IDs by name |
pkill |
Kill processes by name |
Process States
stateDiagram-v2
[*] --> Running
Running --> Sleeping
Running --> Stopped
Running --> Zombie
Sleeping --> Running
Stopped --> Running
Zombie --> [*]In the Real World
eSewa (Nepal)
- Uses Linux servers for backend services (e.g., payment processing, user authentication).
- Package management (yum/dnf or apt) ensures software updates are secure and consistent.
- GRUB bootloader is used in their data center servers for reliable booting.
Ncell (Nepal)
- Linux-based routers manage network traffic for millions of subscribers.
- Firewall rules (iptables/nftables) are configured via CLI to filter malicious traffic.
- Systemd ensures critical services (like billing systems) restart automatically after crashes.
Daraz (Global)
- Ubuntu servers handle order processing, inventory management, and user logins.
- Cron jobs automate tasks like sending order confirmations or updating product listings.
- SELinux/AppArmor enforces security policies to prevent unauthorized access.
Worked Example: Configuring a Minimal Linux Server
Scenario: You need to set up a web server on a CentOS 7 machine with:
- Only essential services running.
- Automatic security updates.
- Basic firewall rules.
Step 1: Install Minimal Linux
- Boot from CentOS 7 ISO (USB/DVD).
- Choose "Server with GUI" (if needed) or "Minimal Install".
- Partition using LVM (Logical Volume Manager) for flexibility.
Step 2: Configure Bootloader (GRUB)
- Edit
/etc/default/grubto set default boot options:GRUB_TIMEOUT=5 GRUB_DEFAULT=0 - Update GRUB:
grub2-mkconfig -o /boot/grub2/grub.cfg
Step 3: Install Essential Packages
- Update package lists:
yum update -y - Install Apache (httpd) and firewalld:
yum install httpd firewalld -y
Step 4: Configure Firewall
- Allow HTTP/HTTPS traffic:
firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https firewall-cmd --reload
Step 5: Enable Automatic Updates
- Install yum-cron for automatic updates:
yum install yum-cron -y systemctl enable yum-cron systemctl start yum-cron
Step 6: Start Services
- Enable and start httpd and firewalld:
systemctl enable httpd systemctl start httpd systemctl enable firewalld systemctl start firewalld
Result: A secure, minimal Linux web server ready for deployment.
Exam Tip
- Understand the Boot Process: Be able to explain BIOS → GRUB → Kernel → systemd in detail. Expect questions on GRUB configuration or runlevels/targets.
- Package Management: Know the difference between RPM (yum/dnf) and DEB (apt). Practice installing/removing packages in a lab.
- File Permissions: Memorize chmod numbers (e.g.,
755,644) and chown syntax. Common exam questions test setting permissions for web directories. - Process Management: Know how to list (
ps), kill (kill), and monitor (top) processes. Expect a question on process states (Running, Sleeping, Zombie). - Real-World Scenarios: Relate concepts to eSewa (payment systems), Ncell (networking), or Daraz (web servers). For example:
- "How would you secure a Linux server hosting an eSewa payment gateway?" → Firewall rules, SELinux, automatic updates.
- "What bootloader does Ncell use in its routers?" → GRUB or custom firmware.
Based on the TU BIM syllabus for Networking and System Administration (IT271), unit 2.
Discussion
Loading…