DEV Community

Cover image for KodeKloud Days 5-8: SELinux and Cron Jobs
Elijah
Elijah

Posted on • Originally published at elijahu.me

KodeKloud Days 5-8: SELinux and Cron Jobs

"Plot twist: Not every Linux is Ubuntu. Also, KodeKloud's UI is testing my patience like a buffering Netflix video at 3%. 📡💀"

Week two of the 100 Days challenge, and I got hit with a reality check: Ubuntu isn't the only Linux distro. After years of Ubuntu-centric DevOps tutorials, KodeKloud threw CentOS Stream at me and watched me flail.

Here's what I learned (and broke) this week.

Day 5: SELinux Configuration - The "Wait, This Isn't Ubuntu?" Moment

My confident first attempt:

sudo apt update
sudo apt install -y selinux-basics
Enter fullscreen mode Exit fullscreen mode

Result: Command not found.

Turns out I was on CentOS Stream, not Ubuntu. Different package manager, different everything.

# Check your OS FIRST (lesson learned)
cat /etc/os-release

# CentOS uses dnf, not apt
sudo dnf install -y selinux-policy selinux-policy-targeted

# Edit SELinux config
sudo vi /etc/selinux/config
# Change SELINUX=enforcing to SELINUX=disabled
Enter fullscreen mode Exit fullscreen mode

Why this surprised me: Every DevOps tutorial I've ever done uses Ubuntu. AWS tutorials? Ubuntu. Docker labs? Ubuntu. Kubernetes courses? Ubuntu. So encountering CentOS felt like showing up to a JavaScript class and being handed Assembly code.

Lesson learned: Always check /etc/os-release before assuming you know what distro you're on. Package managers are not interchangeable, despite what my Ubuntu-trained muscle memory believes.

Day 6: Cron Jobs - Easier Than Expected

Set up a cron job to echo "hello" to /tmp/cron_text every 5 minutes.

# Install cron daemon
sudo dnf install -y cronie
sudo systemctl enable --now crond

# Add the job (as root)
sudo su -
echo "*/5 * * * * echo hello > /tmp/cron_text" >> /var/spool/cron/root

# Verify
crontab -l
Enter fullscreen mode Exit fullscreen mode

Cron syntax breakdown for */5 * * * *:

  • Position 1 (*/5): Every 5 minutes
  • Position 2 (*): Every hour
  • Position 3 (*): Every day of month
  • Position 4 (*): Every month
  • Position 5 (*): Every day of week

Translation: "Run this every 5 minutes until the heat death of the universe."

Day 7: Passwordless SSH - The Magic of Public Keys

Set up passwordless SSH from jump host to all app servers. Because typing passwords repeatedly builds carpal tunnel, not character.

# Generate SSH key pair
ssh-keygen -t rsa -b 4096

# Copy to servers (the easy way)
ssh-copy-id tony@stapp01
ssh-copy-id steve@stapp02
ssh-copy-id banner@stapp03

# Test it
ssh tony@stapp01 hostname  # No password prompt = success
Enter fullscreen mode Exit fullscreen mode

The critical part: SSH is extremely picky about permissions.

Required permissions:

~/.ssh/                → 700 (drwx------)
~/.ssh/authorized_keys → 600 (-rw-------)
~/.ssh/id_rsa         → 600 (-rw-------)
~/.ssh/id_rsa.pub     → 644 (-rw-r--r--)
Enter fullscreen mode Exit fullscreen mode

Get these wrong and SSH will silently ignore your keys like you ignored the documentation.

Day 8: Ansible Installation - Version Hell

Install Ansible. Sounds simple until they want a specific version available globally on all servers.

# Wrong: User installation
python3 -m pip install --user ansible

# Right: Global installation
sudo python3 -m pip install "ansible==4.8.0"

# Verify
ansible --version
which ansible  # Should show /usr/local/bin/ansible
Enter fullscreen mode Exit fullscreen mode

The difference:

  • --user → Installs in ~/.local/bin (current user only)
  • sudo pip install → Installs in /usr/local/bin (all users)

Always use quotes around version specifiers: "ansible==4.8.0" not ansible==4.8.0. Shell expansion will mess you up.

Week 2 Stats

  • Package managers tried: 2 (apt failed, dnf worked)
  • Cron jobs created: 3 (one per server)
  • SSH key pairs generated: 1 (4096-bit RSA)
  • Ansible installations: 2 (user then global)
  • "Not Ubuntu" realizations: 1 (the CentOS surprise)
  • Times I typed apt on CentOS: ~5 (muscle memory is stubborn)

Key Takeaways

Commands I now know by heart:

cat /etc/os-release          # Always check your distro
crontab -l                   # List cron jobs
ssh user@host hostname       # Test passwordless SSH
ansible --version            # Verify Ansible installation
Enter fullscreen mode Exit fullscreen mode

Mistakes that taught me:

  1. Always check your OS before running commands
  2. SSH permissions must be exactly right
  3. Global vs user installations matter
  4. Version management is not optional

What's Next

Days 9-12 coming up:

  • Ansible playbooks (finally using what I installed)
  • Docker fundamentals
  • Network configuration
  • More troubleshooting (probably)

Full Article

This is a condensed version. For the complete writeup with more details, all the commands, and the full story of my UI struggles:

👉 Read the full article

Following this challenge? Drop your "wrong distro" moment in the comments. The first time you tried Ubuntu commands on CentOS, or vice versa. We've all been there. 😅

Top comments (0)