Lesson 1, Topic 1
In Progress

Deploy, Configure, and Maintain Systems

1. Scheduling Tasks with at and cron

a. Using at for One-time Tasks

at allows you to execute commands at a later time.

Example:

echo "echo 'Task is running' > /tmp/at-output.txt" | at now + 2 minutes

b. Using cron for Recurring Tasks

The crontab file defines tasks to be run at regular intervals.

Example:

# Edit the user's crontab
crontab -e

# Add the line to execute a script every day at 2:30 AM
30 2 * * * /path/to/script.sh


Practical Exercise

  1. Schedule a one-time task using at.
  2. Create a cron job that runs a script every day.

2. Services and Boot Configuration

a. Starting and Stopping Services

Systemd is the init system used in recent Linux distributions. It’s used to bootstrap the user space and manage system processes.

Example:

# To start a service
systemctl start service-name

# To stop a service
systemctl stop service-name

b. Enable or Disable Services at Boot

Example:

# To enable a service at boot
systemctl enable service-name

# To disable a service from starting at boot
systemctl disable service-name


Practical Exercise

  1. Start, stop, enable, and disable a service of your choice.

3. Boot Targets

Booting into a specific target changes the state the system will start in. E.g., multi-user mode or graphical mode.

Example:

# To set the default target to multi-user (text-only mode)
systemctl set-default multi-user.target


Practical Exercise

  1. Change the default boot target, reboot, and verify.

4. Time Service Clients

NTP (Network Time Protocol) ensures that the system’s clock is in sync with servers.

Example:

# To install and enable NTP
yum install chrony
systemctl enable --now chronyd

# To synchronize immediately
chronyc tracking


Practical Exercise

  1. Set up time synchronization using NTP.

5. Software Package Management

a. Using Red Hat Network or a Remote Repository

Example:

# To install a package
yum install package-name

# To update all packages
yum update

b. From the Local File System

Example:

# To install a local RPM package
yum localinstall /path/to/package.rpm


Practical Exercise

  1. Install, update, and remove packages using yum.

6. Modifying the System Bootloader

The GRUB 2 bootloader configures boot entries.

Example:

# To modify the GRUB configuration
vi /etc/default/grub

# To regenerate the GRUB configuration after making changes
grub2-mkconfig -o /boot/grub2/grub.cfg


Practical Exercise

  1. Modify a boot parameter in GRUB and verify its effect.

Summary

Deploying, configuring, and maintaining systems are essential tasks for a system administrator. From scheduling tasks with cron and at to managing services and boot targets with systemctl, the foundational building blocks are many. Understanding software management with yum and modifying the system bootloader offers control over the system’s state and behavior.

Key Points

  1. The cron and at tools are powerful for scheduling tasks.
  2. Systemd provides management capabilities for services and boot targets.
  3. Time synchronization is crucial for system health and operations.
  4. Efficient software package management ensures system stability and security.