RED HAT ENTERPRISE LINUX

RHEL Lightspeed

AI-Driven Server Management

CIS126RH | RHEL System Administration
Mesa Community College

Learning Objectives

1
Understand RHEL Lightspeed

What it is, how it works, and its role in system administration

2
Access and configure Lightspeed

Enable the service and connect via web console or CLI

3
Use Lightspeed for common tasks

Get commands, explanations, and troubleshooting assistance

4
Apply best practices

Effective prompting, verification, and understanding limitations

What is RHEL Lightspeed?

RHEL Lightspeed is Red Hat's generative AI assistant for Linux system administration. It provides natural language interaction for command generation, explanations, troubleshooting, and learning — directly within RHEL.

Traditional Approach

Search documentation
Browse man pages
Look up syntax online
Trial and error
Ask colleagues

With Lightspeed

Ask in plain English
Get contextual commands
Receive explanations
Learn as you work
Instant guidance

Key benefit: Lightspeed is trained specifically on RHEL, providing accurate, version-appropriate guidance rather than generic Linux advice.

How Lightspeed Works

Your Question
Lightspeed AI
Response
You Review & Execute

Lightspeed provides:

  • Commands — Ready-to-use shell commands for your task
  • Explanations — Understanding of what commands do and why
  • Guidance — Step-by-step procedures for complex tasks
  • Troubleshooting — Diagnosis and solutions for problems
  • Learning — Context and background to build your skills
Important: Always review AI suggestions before executing. You are responsible for what runs on your system.

Accessing Lightspeed

# Prerequisite: System must be registered with Red Hat
[root@server ~]# subscription-manager status
System Status: Current

# Install web console (Cockpit) if not present
[root@server ~]# dnf install cockpit
[root@server ~]# systemctl enable --now cockpit.socket

# Access web console at https://your-server:9090
# Look for the Lightspeed icon in the interface
Access MethodHowBest For
Web Console (Cockpit)https://server:9090Interactive chat interface
CLIlightspeed "question"Scripts, quick lookups
VS Code ExtensionRHEL AI extensionDeveloper workflows
Requirement: Active RHEL subscription required. Lightspeed is included at no additional cost with Standard and Premium subscriptions.

Web Console Interface

👤 You
How do I check disk space usage on this server?
🤖 Lightspeed
To check disk space usage, use these commands:

df -h — Shows filesystem disk space usage in human-readable format

du -sh /path — Shows the size of a specific directory

The -h flag displays sizes in KB, MB, GB rather than raw bytes.
👤 You
Which directory is using the most space?
🤖 Lightspeed
To find the largest directories, run:

du -h --max-depth=1 / | sort -hr | head -20

This scans from root, shows one level deep, sorts by size (largest first), and displays the top 20.

Command Line Access

# Ask Lightspeed a question from the command line
[root@server ~]# lightspeed "How do I restart the Apache web server?"

To restart the Apache web server on RHEL, use:

  systemctl restart httpd

To check the status after restarting:

  systemctl status httpd

If you want Apache to start automatically at boot:

  systemctl enable httpd
CLI usage pattern: Put your question in quotes. The response is printed to stdout — you can pipe it, redirect it, or paste commands directly into your terminal.

CLI Examples — find and explain

# Quick command lookup
[root@server ~]# lightspeed "command to find files larger than 100MB"

find / -type f -size +100M -exec ls -lh {} \;

This searches from root (/) for files (-type f) larger than 100MB
(-size +100M) and displays details for each match.
# Ask Lightspeed to explain a command you don't understand
[root@server ~]# lightspeed "explain: tar -czvf backup.tar.gz /home"

This command creates a compressed archive:
  tar     - tape archive utility
  -c      - create new archive
  -z      - compress with gzip
  -v      - verbose (show files being archived)
  -f      - specify filename (backup.tar.gz)
  /home   - directory to archive
Learning tip: Use explain: prefix to get a breakdown of any command. This turns every unfamiliar command into a learning opportunity.

Task: User Management

👤 You
Create a new user 'devuser' with home directory, add to wheel group for sudo, and set password to expire in 90 days
🤖 Lightspeed
Here's how to create and configure the user:

useradd -m -G wheel devuser Creates user with home directory (-m) and adds to wheel group (-G wheel)

passwd devuser Set the initial password (you'll be prompted)

chage -M 90 devuser Sets maximum password age to 90 days

Verify: id devuser and chage -l devuser
Notice: Lightspeed provides commands with explanations — not just syntax, but what each flag does and how to verify the result.

Task: Service Management

👤 You
The nginx service failed to start. Help me troubleshoot.
🤖 Lightspeed
Let's diagnose the nginx startup failure:

1. Check service status and recent logs:
systemctl status nginx
2. View detailed journal logs:
journalctl -xeu nginx
3. Test configuration syntax:
nginx -t
4. Check if port 80/443 is in use:
ss -tlnp | grep -E ':80|:443'
Common causes: config syntax error, port conflict, permission issue, or missing SSL certificate.
Troubleshooting pattern: Lightspeed gives a systematic diagnostic workflow — not just one command, but a sequence that narrows down the root cause.

Task: Firewall Configuration

👤 You
Allow HTTP and HTTPS traffic through the firewall permanently
🤖 Lightspeed
To permanently allow web traffic through firewalld:

firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https firewall-cmd --reload
The --permanent flag saves the rule to survive reboots.
The --reload applies changes without dropping connections.

Verify with: firewall-cmd --list-services

To also open port 8080 for a custom app:
firewall-cmd --permanent --add-port=8080/tcp && firewall-cmd --reload

Task: Storage Management

[root@server ~]# lightspeed "extend the root logical volume by 5GB"

To extend the root LV by 5GB, follow these steps:

1. Check available space in the volume group:
   vgs

2. Extend the logical volume:
   lvextend -L +5G /dev/mapper/rhel-root

3. Resize the filesystem (for XFS):
   xfs_growfs /

   For ext4 filesystems use instead:
   resize2fs /dev/mapper/rhel-root

4. Verify the new size:
   df -h /
XFS vs ext4: Lightspeed correctly identifies that RHEL 9 uses XFS by default (xfs_growfs), and also provides the ext4 alternative — showing awareness of your distribution's defaults.

Storage: Follow-up Questions

[root@server ~]# lightspeed "my volume group has no free space, options?"

Options when VG has no free space:

1. Add a new disk/partition as physical volume:
   pvcreate /dev/sdb1
   vgextend rhel /dev/sdb1

2. Reduce another logical volume (if possible):
   lvreduce -L -5G /dev/mapper/rhel-home
   (Warning: resize filesystem FIRST before reducing LV!)

3. Add a virtual disk (if VM) and extend

4. Use thin provisioning for future flexibility
AI adds safety notes: Notice the explicit warning about resizing the filesystem before reducing an LV — skipping this step causes data loss. Lightspeed surfaces these critical caveats.

Task: Security & SELinux

👤 You
Apache can't read files in /var/www/custom even though permissions are correct. SELinux is enforcing.
🤖 Lightspeed
This is likely an SELinux context issue. Let's diagnose and fix:

1. Check current context:
ls -lZ /var/www/custom
2. Check for recent denials:
ausearch -m avc -ts recent
3. Fix the context (set to httpd content type):
semanage fcontext -a -t httpd_sys_content_t "/var/www/custom(/.*)?" restorecon -Rv /var/www/custom
semanage adds the rule persistently; restorecon applies it to existing files.
SELinux expertise: This is one of the most common RHEL troubleshooting scenarios. Lightspeed correctly diagnoses, checks audit logs, and provides the persistent fix — not a temporary workaround.

Learning with Lightspeed

[root@server ~]# lightspeed "explain the difference between systemctl start and enable"

These commands serve different purposes:

systemctl start <service>
  - Starts the service immediately
  - Does NOT persist across reboots
  - Use when you need the service running now

systemctl enable <service>
  - Creates symlinks so service starts at boot
  - Does NOT start the service immediately
  - Use to ensure service runs after reboot

Common pattern - do both:
  systemctl enable --now <service>

The --now flag combines both: enables AND starts immediately.
Learning mode: Ask "explain the difference between" for concept comparisons. Lightspeed provides structured explanations that build lasting understanding.

Deep Concepts with Lightspeed

[root@server ~]# lightspeed "what are cgroups and why do they matter?"

Cgroups (control groups) are a Linux kernel feature that:

- Limit resources (CPU, memory, I/O) for process groups
- Isolate processes from each other
- Account for resource usage
- Enable containerization (Docker, Podman use cgroups)

In RHEL, systemd uses cgroups v2 to manage service resources.
You can limit a service's memory with:
  systemctl set-property httpd MemoryMax=512M

Ask about "why" not just "how": Lightspeed explains underlying concepts, relationships between technologies, and the reasoning behind design decisions — turning administration tasks into learning opportunities.

Writing Effective Prompts

Less Effective

"fix my server"

"network not working"

"help with files"

"make it faster"

More Effective

"Apache returns 503 errors after reboot"

"Can't ping gateway 192.168.1.1 from ens33"

"Find all .log files larger than 100MB in /var"

"Reduce memory usage of MySQL service"

Effective prompts include:

  • Specific symptoms — What exactly is happening (not just "broken")
  • Context — Service name, version, filesystem path, error code
  • Expected vs. actual — "It should do X but instead does Y"
  • Constraints — "Without downtime", "on RHEL 9", "using firewalld"

Verifying Suggestions

# Before running any suggested command:

# 1. Ask Lightspeed to explain if you're unclear about what it does
[root@server ~]# lightspeed "explain: rm -rf /var/log/old/*"

# 2. Check if paths/service names match YOUR system
#    - Paths may differ from the suggestion
#    - Service names can vary by version
#    - Your system config may differ from defaults

# 3. For destructive operations, verify paths before executing
[root@server ~]# ls /var/log/old/          # Confirm directory exists and contains expected files
[root@server ~]# rm -rf /var/log/old/*      # Then execute
Golden rule: Never copy-paste and execute a command you don't understand — even from Lightspeed. Ask for an explanation first. You are responsible for what runs on your system.

Limitations and Boundaries

Understanding Lightspeed's limitations helps you use it effectively and avoid frustration.

Lightspeed CanLightspeed Cannot
Provide commands and explanationsExecute commands on your system
Offer general RHEL guidanceKnow your specific system state
Explain concepts and best practicesGuarantee correctness in all cases
Suggest troubleshooting stepsSee your error messages automatically
Help with documented featuresKnow about unreleased features
Provide general security guidanceAudit your specific security posture
Share context: Lightspeed cannot see your system. Paste error messages, describe your setup, and share relevant output for better answers.

Workflow Integration

Lightspeed fits into your existing workflow as an assistant, not a replacement for documentation, testing, or critical thinking.

Task/Problem
Ask Lightspeed
Review Response
Verify/Test
Execute

Good Uses

  • Quick syntax lookups
  • Troubleshooting starting points
  • Learning new concepts
  • Exploring options and approaches

Supplement with Documentation

  • Critical production procedures
  • Compliance-required tasks
  • Novel or highly specific scenarios
  • Security-critical configurations

Practical Examples

# "How do I..." questions
"How do I schedule a job to run every Sunday at 3am?"
"How do I check which process is using port 8080?"
"How do I mount an NFS share permanently?"

# Troubleshooting questions
"SSH connection times out to server, but ping works fine"
"Disk shows full but du says only 50% used"
"Service starts then stops immediately"
# Explanation requests
"Explain what this cron entry means: */15 * * * *"
"What's the difference between kill and kill -9?"
"Why does rsync use -a flag by default?"

# Best practice questions
"What's the recommended way to update packages safely?"
"How should I structure sudoers for a dev team?"
"Best practices for SSH key management?"

Security Considerations

Important: Be mindful of what information you share with AI services, especially in enterprise environments.

Safe to Share

  • Generic error messages
  • Public command syntax questions
  • General configuration approaches
  • Conceptual questions
  • Anonymized log snippets

Avoid Sharing

  • Passwords or API keys
  • Internal hostnames or IP addresses
  • Customer data
  • Proprietary configurations
  • Security vulnerability details
Enterprise policy: Check your organization's AI tool usage policy. Some environments restrict what data can be sent to cloud services.

Best Practices

Do

  • Write specific, detailed prompts
  • Include error messages and context
  • Ask for explanations, not just commands
  • Verify suggestions before executing
  • Use Lightspeed to learn, not just complete tasks
  • Test on non-production first
  • Ask follow-up questions to clarify
  • Cross-reference docs for critical tasks

Do Not

  • Run commands you don't understand
  • Share sensitive information
  • Trust AI blindly without verification
  • Skip testing for production changes
  • Use as sole source for critical procedures
  • Ignore your own system knowledge
  • Expect AI to know your specific setup
  • Disable your critical thinking

Key Takeaways

1

RHEL Lightspeed: AI assistant for RHEL administration. Access via web console (Cockpit) or CLI. Trained specifically on RHEL for accurate guidance.

2

Capabilities: Commands, explanations, troubleshooting, and learning. Ask in plain English, get contextual RHEL-specific guidance.

3

Effective Use: Write specific prompts with context. Ask for explanations not just commands. Use for learning, not just task completion.

4

Responsibility: Always verify before executing. AI assists — you decide. Never run commands you don't understand.

Graded Lab

  • Access Lightspeed via web console (Cockpit) and explore the chat interface
  • Ask Lightspeed how to create a user with specific requirements; evaluate the response
  • Describe a service failure and follow the troubleshooting guidance step by step
  • Request a full explanation of an unfamiliar command using the explain: pattern
  • Ask about best practices for a common administration task
  • Practice writing effective prompts with specific context and constraints

Next: Navigating the Filesystem Hierarchy