Here is how to install kubectl on Rocky Linux 9. Tested and verified.
Prerequisites
- Rocky Linux 9 installed and updated
- Root or sudo access
- Internet connection
Step 1: Update System
sudo dnf updateStep 2: Add Official Repository
kubectl should be installed from the official repository to get the latest stable version and security updates.
# Add the official kubectl repository
# Check kubectl documentation for the latest repo URL
sudo dnf install -y curl gnupg2Step 3: Install kubectl
sudo dnf install -y kubectlStep 4: Verify Installation
kubectl versionExpected output should show the installed version.
Step 5: Post-Install Configuration
# Enable and start the service (if applicable)
sudo systemctl enable --now kubectl
# Verify status
sudo systemctl status kubectlTroubleshooting
Package Not Found
Make sure the repository was added correctly:
# List configured repositories
dnf repolistPermission Denied
Ensure your user has the correct group membership:
sudo usermod -aG kubectl $USER
newgrp kubectlUninstall
sudo dnf remove -y kubectlRelated Guides
About the Author
I am Luca Berton, AI and Cloud Advisor. Book a consultation to get help with your infrastructure setup.