Skip to main content

LFCS: Operations & Deployment (25%)

This section covers system administration tasks related to configuring the kernel, managing processes and services, scheduling jobs, managing software, recovering systems, and working with virtualization, containers, and SELinux.


Goals

Operations Deployment25%

  1. Configure kernel parameters, persistent and non-persistent
  2. Diagnose, identify, manage, and troubleshoot processes and services
  3. Manage or schedule jobs for executing commands
  4. Search for, install, validate, and maintain software packages or repositories
  5. Recover from hardware, operating system, or filesystem failures
  6. Manage Virtual Machines (libvirt)
  7. Configure container engines, create and manage containers
  8. Create and enforce MAC using SELinux

1. Configure Kernel Parameters

Learn

  • Difference between temporary (runtime) and persistent kernel parameters.
  • Tools: sysctl, /etc/sysctl.conf, and /etc/sysctl.d/*.conf.

Commands

# Show all parameters
sysctl -a

# Set a runtime parameter (non-persistent)
sudo sysctl net.ipv4.ip_forward=1

# Persist parameter across reboots
echo "net.ipv4.ip_forward = 1" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

# Modern persistent configuration (preferred)
echo "net.ipv4.ip_forward = 1" | sudo tee /etc/sysctl.d/99-custom.conf
sudo sysctl --system

Exercises

  1. Enable IP forwarding temporarily and verify:
    sysctl net.ipv4.ip_forward
    
  2. Make IP forwarding permanent using /etc/sysctl.d/.

2. Manage Processes and Services

Learn

  • Identify, monitor, and troubleshoot processes.
  • Manage services with systemd.

Commands

# Process management
ps aux | grep <name>
top
htop        # if installed
kill <PID>
kill -9 <PID>

# Systemd service management
systemctl status <service>
systemctl start <service>
systemctl stop <service>
systemctl enable <service>
systemctl disable <service>
systemctl restart <service>
systemctl reload <service>

# View logs for a service
journalctl -u <service>

# List active services
systemctl list-units --type=service

Exercises

  1. Find the PID of a running process and stop it gracefully.
  2. Enable and start a service at boot time.
  3. View service logs with journalctl.

3. Manage Scheduled Jobs

Learn

  • Use cron for recurring tasks (user or system-level).
  • Use at for one-time scheduled jobs.

Commands

# List user cron jobs
crontab -l

# Edit user cron jobs
crontab -e

# System-wide cron directories
ls /etc/cron.daily/
ls /etc/cron.weekly/

# At job example
echo "touch /tmp/testfile" | at now + 1 minute
atq        # list scheduled at jobs
atrm <job_number>

Exercises

  1. Schedule a script to run every day at 3 AM.
  2. Schedule a one-time task using at.
  3. Check /etc/cron.daily/ for system maintenance tasks.

4. Software Management

Learn

  • Install, update, and remove software using your system’s package manager.
  • Manage repositories and dependencies.

Commands

# Debian/Ubuntu
sudo apt update
sudo apt install <package>
sudo apt remove <package>
dpkg -l | grep <package>
dpkg -s <package>

# Manage repositories
sudo add-apt-repository ppa:<repo>
cat /etc/apt/sources.list.d/*.list

# RHEL/CentOS
sudo yum install <package>
sudo yum remove <package>
rpm -qa | grep <package>
rpm -qi <package>

# Repository management
yum repolist

Exercises

  1. Install curl and verify installation.
  2. Remove a package and confirm removal.
  3. List all enabled repositories.

5. Recover from Hardware, OS, or Filesystem Failures

Learn

  • Boot into rescue or recovery mode.
  • Use Live CD/USB for system repair.
  • Use fsck to check and repair filesystems.

Commands

# Filesystem check (unmounted partition)
sudo fsck /dev/sdX1

# Mount for inspection or repair
sudo mount /dev/sdX1 /mnt

# Kernel/hardware diagnostics
dmesg | less
journalctl -xb

# Disk health (if smartmontools installed)
sudo smartctl -a /dev/sdX

Exercises

  1. Simulate a corrupted filesystem on a test partition and repair it using fsck.
  2. Boot into rescue mode and inspect partitions with lsblk.
  3. Review logs with journalctl -xb.

6. Virtual Machines (libvirt)

Learn

  • Manage VMs using libvirt tools (virsh, virt-install).
  • Control VM lifecycle and connect via console.

Commands

virsh list --all
virsh start <vm>
virsh shutdown <vm>
virsh destroy <vm>        # Force shutdown
virsh console <vm>

# Virtual network management
virsh net-list
virsh net-start default

Exercises

  1. Create a VM using virt-install.
  2. Start, stop, and connect to the VM via console.
  3. Verify virtual networks using virsh net-list.

7. Containers (Docker / Podman)

Learn

  • Create, start, stop, and manage containers and images.
  • Understand container networking and volumes.

Commands

# Docker examples
docker run -it --name mycontainer ubuntu bash
docker ps
docker stop mycontainer
docker rm mycontainer
docker images
docker rmi <image>

# Volumes and networks
docker volume ls
docker network ls

# Podman equivalents (rootless alternative)
podman run -it --name mycontainer ubuntu bash
podman ps
podman images
podman rm -a

Exercises

  1. Create an Ubuntu container and install curl inside it.
  2. Commit the container as a new image:
    docker commit mycontainer ubuntu-with-curl
    
  3. Remove the container and image.
  4. List container networks and volumes.

8. SELinux (Mandatory Access Control)

Learn

  • SELinux modes: enforcing, permissive, disabled.
  • Troubleshoot SELinux denials and manage contexts.

Commands

# Check SELinux status
sestatus

# Change mode temporarily
sudo setenforce 0    # permissive
sudo setenforce 1    # enforcing

# Check logs for denials
ausearch -m avc

# Check and restore file contexts
ls -Z /path
restorecon -Rv /path

# Manage custom contexts
sudo semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?"
sudo restorecon -Rv /web

Exercises

  1. Switch SELinux to permissive mode and verify.
  2. Trigger an SELinux denial (e.g., mislabel file) and view logs with ausearch.
  3. Restore a file’s correct SELinux context.

🧪 Exam Tips

  • Practice all commands without sudo, as exam environments often run as root.
  • Understand the difference between runtime vs persistent configurations:
    • Kernel parameters (sysctl)
    • SELinux modes
    • Service enablement
  • Use lab VMs to safely experiment with:
    • Containers and virtual machines
    • Cron jobs and recovery procedures
  • Review logs regularly (journalctl, dmesg, ausearch).

Summary:
This guide now comprehensively covers all Operations Deployment (25%) objectives:

Objective Status Configure kernel parameters Manage processes & services Manage scheduled jobs Manage software packages & repos Recover from failures Manage virtual machines Manage containers Configure and enforce SELinux