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. Lightspeed assists - you decide and verify.

Accessing Lightspeed

RHEL Lightspeed is available through the web console (Cockpit) and as a command-line tool. It requires a RHEL subscription with Lightspeed entitlement.

Access MethodInterfaceBest For
Web Console Browser-based chat in Cockpit Interactive exploration, visual learners
CLI Tool Command-line interface Quick queries, scripting integration
# Check if system is registered with Red Hat
[root@server ~]# subscription-manager status
System Status: Current

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

# Access web console at https://server:9090
# Look for Lightspeed icon in the interface

Web Console Interface

👤 You
How do I check disk space usage on this server?
🤖 Lightspeed
To check disk space usage, you can 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 df command shows mounted filesystems and their usage. The -h flag displays sizes in KB, MB, GB rather than 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.
Conversational: Lightspeed remembers context. Ask follow-up questions to refine results or get more details.

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

# 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.

# Get explanation of a command
[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

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 with: id devuser and chage -l devuser
Notice: Lightspeed provides commands, explains what each does, and suggests verification steps. This helps you learn while accomplishing the task.

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 already in use:
ss -tlnp | grep -E ':80|:443'

Common causes: configuration syntax error, port conflict, permission issue, or missing SSL certificate.
Troubleshooting flow: Lightspeed provides a systematic approach - check status, examine logs, test configuration, check for conflicts.

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
👤 You
Also open port 8080 for a custom application
🤖 Lightspeed
firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --reload
Verify: firewall-cmd --list-ports

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 /

Note: Ensure your volume group has at least 5GB free space.
If not, you'll need to add a physical volume first.

[root@server ~]# lightspeed "my volume group has no free space, what are my 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!)

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

4. Use thin provisioning for future flexibility

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
The semanage command adds a rule, restorecon applies it recursively.
SELinux tip: Don't disable SELinux to "fix" problems. Lightspeed helps you solve issues properly by setting correct contexts.

Learning with Lightspeed

Lightspeed is not just for getting tasks done - it is a powerful learning tool. Ask for explanations, concepts, and best practices.

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

These commands serve different purposes:

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

systemctl enable 
  - 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 
  
The --now flag combines both: enables AND starts immediately.

[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

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 server"

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

"Reduce memory usage of MySQL service"

Effective prompts include:

  • Specific symptoms - What exactly is happening or not happening?
  • Context - What service, path, or component is involved?
  • Goal - What are you trying to accomplish?
  • Constraints - Any limitations or requirements?

Verifying Suggestions

Critical practice: Always understand and verify AI-generated commands before executing them. Lightspeed is a tool, not an authority.

# Before running any suggested command:

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

# 2. Check if it's appropriate for YOUR system
# - Paths may differ
# - Service names might vary
# - Your version might need different syntax

# 3. Test on non-production first when possible

# 4. Have a rollback plan for changes

# 5. For destructive operations, verify paths carefully!
[root@server ~]# ls /var/log/old/    # Check what's there first
[root@server ~]# rm -rf /var/log/old/*  # Then execute
Trust but verify: AI can make mistakes, misunderstand context, or give correct-but-inappropriate advice for your situation.

Limitations and Boundaries

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

Lightspeed CanLightspeed Cannot
Provide commands and explanations Execute commands on your system
Offer general RHEL guidance Know your specific system state
Explain concepts and best practices Guarantee correctness in all cases
Suggest troubleshooting steps See your error messages automatically
Help with documented features Know about unreleased features
Provide general security guidance Audit 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 you didn't know existed
  • Getting command explanations

Still Essential

  • Understanding your systems
  • Testing before production
  • Reading official documentation
  • Building foundational skills
  • Critical thinking and verification

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, 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/IP addresses
  • Customer data
  • Proprietary configurations
  • Security vulnerability details
Enterprise policy: Check your organization's policies regarding AI tool usage. Some environments restrict what can be shared with external 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 with documentation 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
  • Stop learning fundamentals
Key mindset: Lightspeed accelerates your work and learning. It does not replace your expertise, judgment, or responsibility.

Key Takeaways

1

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

2

Capabilities: Commands, explanations, troubleshooting, learning. Ask in plain English, get contextual guidance.

3

Effective Use: Write specific prompts with context. Ask follow-ups. Use for learning, not just task completion.

4

Responsibility: Always verify before executing. AI assists - you decide. Maintain security awareness.

Graded Lab

  • Access Lightspeed via web console and explore the interface
  • Ask Lightspeed how to create a user with specific requirements
  • Describe a service failure and follow troubleshooting guidance
  • Request explanation of an unfamiliar command
  • Ask about best practices for a common administration task
  • Practice writing effective prompts with good context

Next: Navigating the File-system Hierarchy