The amazon-linux-extras command not found error usually means you’re on AL2023 or the extras tool isn’t installed on AL2.
You typed amazon-linux-extras, hit Enter, and your shell pushed back with a message. The upside is that this error narrows the problem to a short list of causes. Most of the time, it’s not a broken repo or a bad command. It’s the wrong OS generation or a missing tool.
This guide is built to get you unstuck. First you’ll confirm what Amazon Linux you’re running. Then you’ll use the matching fix path, with copy-paste commands and checks after each step.
Amazon Linux Extras Command Not Found With A Fast Fix Map
If you only read one section, read this one. The “extras” command is an Amazon Linux 2 feature. Amazon Linux 2023 moved to a different model, so the command isn’t there. Once you know your release, the rest is mechanical.
| What You’re On | Why The Command Fails | What To Do Next |
|---|---|---|
| Amazon Linux 2023 | No amazon-linux-extras tool exists on this release |
Use dnf and AL2023 repos for the package you want |
| Amazon Linux 2 | The package that provides the tool is missing or your path is odd | Install the tool, then enable the topic and install with yum |
| Container Or Minimal Image | Extras tooling is often trimmed out to keep the image small | Install what you need with the image’s package manager, or switch base image |
Amazon’s own docs describe the Extras Library as an Amazon Linux 2 feature, with “topics” that you list and install through the amazon-linux-extras command. You can read that straight from AWS here: AL2 Extras Library.
Why This Error Shows Up So Often
Lots of tutorials still paste amazon-linux-extras install for things like nginx, Docker, or language runtimes. That worked on Amazon Linux 2, so it spreads. Then people launch an Amazon Linux 2023 AMI, follow the same steps, and boom.
There are also legit Amazon Linux 2 cases. A hardened AMI can omit tools, a container image can cut them, or a path setting can hide a binary that’s already on disk. The goal is to identify which bucket you’re in before you start changing repos at random.
Confirm Your Release And Package Manager First
The fastest way to stop guessing is to check /etc/os-release. It’s present on Amazon Linux 2 and Amazon Linux 2023. You can do this without sudo.
- Print The OS Release — Run the command below and look for
VERSION_IDandNAME.
cat /etc/os-release
On Amazon Linux 2 you’ll see something like “Amazon Linux 2”. On Amazon Linux 2023 you’ll see “Amazon Linux” with a 2023 version identifier. Now check which package tool is wired up.
- Check For Dnf — If this returns a path, you’re aligned with Amazon Linux 2023’s default tooling.
command -v dnf && dnf --version
- Check For Yum — Amazon Linux 2 uses yum, even if dnf is present for compatibility on some images.
command -v yum && yum --version
AWS states that Amazon Linux 2023 uses dnf as the default package manager. That’s in the Amazon Linux 2023 user guide here: Package management tool (AL2023).
Fix The Missing Tool On Amazon Linux 2
If you confirmed Amazon Linux 2 and the command still fails, treat it like any missing binary. First check if the file exists, then install the package that provides it, then verify it runs.
- Check If The Binary Exists — This tells you if it’s installed and in your path.
command -v amazon-linux-extras || ls -l /usr/bin/amazon-linux-extras
If /usr/bin/amazon-linux-extras exists but command -v returns nothing, your PATH may be missing /usr/bin. That’s rare on EC2, more common in stripped containers.
- Print Your Path — You want to see
/usr/binin the output.
echo "$PATH"
- Install The Extras Package — If the binary truly isn’t present, install it from the standard repos.
sudo yum makecache
sudo yum install -y amazon-linux-extras
- List Available Topics — This should print a list of topics you can enable.
amazon-linux-extras list
From there, you enable a topic and install it. AWS documents the pattern as listing topics and then installing a topic with sudo amazon-linux-extras install topic in its Extras Library guide. You can cross-check the exact syntax here: Using the Extras Library.
What The Extras Library Changes On Your System
When you enable a topic, you’re not installing “a repo” in the abstract. You’re telling yum that a new set of RPMs is allowed for this host. Under the hood, the topic drops repo metadata and package markers that yum can track. That’s why the clean flow is: enable with amazon-linux-extras, then install with yum.
AWS also lets you pin to a specific topic version when you need repeatable builds. You install the topic with a topic=version form, then keep your yum installs consistent across instances.
- List Topic Versions — Scan the list output for the version column so you can pick an exact build.
- Install A Versioned Topic — Add
=versionfor each topic you want to pin.
amazon-linux-extras list
sudo amazon-linux-extras install topic=version
Now apply it to your real target. If you’re installing nginx, Docker, or a runtime, you want to keep your steps tidy: enable the topic, then install packages through yum so the system’s dependency solver stays consistent.
- Enable The Topic — Replace
topicwith what you see in the list output. - Install The Package — Use yum to install the package names that topic exposes.
sudo amazon-linux-extras enable topic
sudo yum clean metadata
sudo yum install -y package-name
If the error you started with was amazon linux extras command not found, this Amazon Linux 2 path is the cleanest fix when you’ve confirmed you’re on AL2.
Use The Right Replacement On Amazon Linux 2023
On Amazon Linux 2023, skip extras and go straight to dnf. Many packages that used to be “extras topics” are now regular packages, often with versioned names. Start by searching, then install, then lock in a sane update approach.
- Search The Repos — Use search terms to find the package name AWS chose for AL2023.
sudo dnf search nginx
sudo dnf search docker
sudo dnf search nodejs
- Install The Package — Pick the exact package name from the results and install it.
sudo dnf install -y nginx
Spotting The Right Package Name On AL2023
AL2023 often publishes multiple streams of the same tool as separate package names. That’s the rough equivalent of “topics” on AL2, but it’s done with plain repos and plain package names. So you don’t enable anything first. You just install the name you want.
You’ll often see names like nodejs20, php8.2, or python3.11 in the search output.
- List Candidate Packages — Use a tighter query when the results list is long.
- Inspect The Package Info — Confirm the repo and version before installing.
sudo dnf search nodejs
sudo dnf info nodejs20
One AL2023 wrinkle catches people: repositories are pinned to a specific release version on an AMI. AWS explains that you apply updates by moving the system to the latest available release version, or by launching a newer AMI. That detail is laid out here: Managing repos and OS updates (AL2023).
If you’re looking for packages that used to come from EPEL on Amazon Linux 2, read Amazon’s AL2023 EPEL guidance. It points to EPEL9 and also to SPAL for many EPEL packages built for AL2023. Start here: EPEL on Amazon Linux 2023.
Edge Cases That Make The Error Stick Around
Sometimes the command is missing for a good reason. That doesn’t mean you’re stuck. It means the shortest path is different. These cases show up a lot in pipelines, containers, and locked-down images.
Minimal Container Images
Many container bases drop anything that isn’t required to run your app. If you built on an AL2 base and expect extras, check the image tags and the Dockerfile history. Switching to a fuller base image can be faster than trying to bolt on missing tooling.
- Verify The Base Image — Print
/etc/os-releaseinside the container and confirm the version. - Install With Yum Or Dnf — Use the package tool that matches the image’s release.
cat /etc/os-release
Non-Interactive Shells
CI shells can run with a trimmed PATH. When the tool exists but the shell can’t find it, call it with a full path to prove the point. Then fix the shell profile or the job runner config.
- Run The Full Path — This bypasses path issues and tells you if the binary works.
/usr/bin/amazon-linux-extras list
Repo Metadata Problems
If you’re on Amazon Linux 2 and the package install fails with repo errors, clean metadata and rebuild caches. This is plain yum hygiene, but it clears lots of “No package found” dead ends.
- Clean Yum Caches — This clears stale metadata.
- Rebuild The Cache — This pulls fresh repo data.
sudo yum clean all
sudo yum makecache
Locked-Down Hosts And Proxies
If your instance sits behind a proxy or runs with strict egress rules, package installs can fail in ways that look like missing commands. You can check connectivity to repos before you change anything else.
- Test Repo Reachability — Try a metadata refresh and watch for timeout or DNS errors.
- Verify Time Sync — Bad time can break TLS and stop repo downloads.
sudo yum makecache
timedatectl status
If you reached this section because amazon linux extras command not found keeps popping up in scripts, pin down the OS release in your automation. It removes guesswork and stops copy-pasted commands from drifting across AMIs.
A Scroll-Friendly Checklist You Can Reuse
This checklist is meant to be copyable into a runbook. It keeps the flow tight, and it reduces the odds of breaking your package state with half-fixes.
- Identify The Release — Run
cat /etc/os-releaseand write down the version. - Confirm The Package Tool — Check
dnfon AL2023 oryumon AL2. - Test The Extras Binary — On AL2, run
amazon-linux-extras listbefore changing anything. - Install The Missing Tool — On AL2, install
amazon-linux-extrasif the binary isn’t present. - Search Before Installing — On AL2023, run
dnf searchto find the exact package name. - Keep Updates Predictable — On AL2023, follow AWS guidance on release-version updates or AMI refresh.
- Recheck After Each Step — Run the command that failed and confirm the new output.
If you want the official reference pages in one place, AWS maintains a landing page for Amazon Linux documentation, with separate guides for AL2 and AL2023: Amazon Linux Documentation.
Once your checklist step 1 and step 2 match the OS you’re on, the rest is just clean package work. No guessy repo edits. No random blog commands. Just the right tool for the right Amazon Linux release.
