Installing SnapCraft on Rocky Linux 8 – A No‑Fuss Guide
If you’re running a fresh Rocky 8 box and need to build snap packages, the first thing you’ll want is the snapcraft CLI. This guide walks through getting that installed without any of the usual “you’ve got to do X, then Y” nonsense.
Prerequisites: What You Need
- Root (or sudo) access
- An active internet connection
- A clean installation of Rocky Linux 8
No fancy build tools yet; we’ll pull them in as needed.
Enable the EPEL Repository
Snapd isn’t in Rocky’s default AppStream or Base repos, so you have to tap into EPEL first. It’s the official “extra packages for Enterprise Linux” repo and contains snapd plus its dependencies.
sudo dnf install epel-release -y
without EPEL, dnf won’t know where to fetch snapd from, and you’ll get that annoying “No package found” error.
Install snapd with DNF
With EPEL enabled, the real magic begins:
sudo dnf install snapd -y
After installation, you need to enable and start the snap socket service:
sudo systemctl enable --now snapd.socket
snapd runs as a daemon that listens on a Unix socket. If it’s not enabled, the snap command will refuse to run.
Verify snapd is Running
Make sure everything’s humming:
systemctl status snapd.socket
You should see “active (running)”. If not, double‑check that you ran the enable/now command and that no firewall or SELinux policy is blocking it.
Install SnapCraft
Now that snap itself works, pull in SnapCraft:
sudo snap install --classic snapcraft
The --classic flag tells snapd to give SnapCraft unrestricted access to your filesystem. Without it, the confined version would be unable to see source code or build artefacts and would fail immediately.
Confirm the Installation
Test that everything wired up correctly:
snapcraft --version
You should see something like 2.1.0 (or whatever the latest release is). If it prints a version, you’re good to go.
Common Pitfalls and Quick Fixes
I’ve seen this happen after a bad driver update:
If your kernel was upgraded without rebooting, snapd might not load the required modules. Reboot first.
- Error: snapcraft: command not found
Fix: Ensure you logged out and back in so that your shell picks up the new $PATH. Alternatively, run /usr/bin/snapcraft.
- Error: cannot find snapd.socket
Fix: Run sudo systemctl enable --now snapd.socket again. On some minimal installs, you might also need to install libudev.so via dnf groupinstall "Core".
Optional: Build SnapCraft from Source (for the adventurous)
If you want the bleeding‑edge version or need custom patches:
sudo dnf groupinstall "Development Tools" -y git clone https://github.com/snapcore/snapcraft.git cd snapcraft make install
This pulls in Go, compiles SnapCraft, and installs it to /usr/local/bin. It’s a bit more work but guarantees you’re on the latest commit.
That’s all there is to it. Grab your Rocky 8 machine, follow these steps, and you’ll be packaging snaps before the next coffee break.