✿ Nice photo prop - Suitable for Cool and Vintage Ins style. It will be more beautiful and eye-catching if you fill the bottle with colored water or p... read more
When running Amazon Linux as your operating system, you may encounter the error “-bash: amazon-linux-extras: command not found” preventing you from installing important add-ons.
This frustrating error means the amazon-linux-extras utility is not available on your system’s path. But there are steps you can take to properly configure your Amazon Linux environment and regain access to amazon-linux-extras.
In this comprehensive guide, we’ll explain what causes the “command not found” error for amazon-linux-extras in Amazon Linux and outline actionable solutions to fix it.
Overview of the “amazon-linux-extras command not found” Error
The Amazon Linux-extras utility enables easy installation of additional components like databases, languages, and monitoring tools needed for Amazon Linux-based workloads.
However, if not configured correctly, running amazon-linux-extras can produce the following error:
-bash: amazon-linux-extras: commandnotfound
This fails because the amazon-linux-extras command line program is not available in the operating system’s PATH variable. So when you invoke it from the bash shell, it is unable to locate the executable.
Below we’ll explore the underlying reasons why amazon-linux-extras can become unavailable in Amazon Linux.
What Causes the “command not found” Error for amazon-linux-extras
There are a few key reasons why amazon-linux-extras may suddenly become unrecognized after previously working:
The amazon-linux-extras package is not installed
The executable path is not listed in the PATH variable
There are permission issues on the installed files
The bash shell profile is corrupt
Let’s examine each cause further.
The amazon-linux-extras Package is Not Installed
The most straightforward explanation is that the amazon-linux-extras package is not yet installed on the system.
This open source utility is distributed as an add-on bundle for Amazon Linux rather than included in the base image.
So if you launch a fresh instance, until you install the appropriate amazon-linux-extras package, running the command will fail with “not found”.
Executable Path Not in PATH Variable
Even if amazon-linux-extras is actually present on the system, the executable program path may not be listed in the PATH environment variable.
Most Linux distributions automatically add the install directory of packages to PATH during post-installation steps.
But if this fails or PATH gets modified incorrectly later, the operating system won’t find amazon-linux-extras even though it exists.
File Permission Issues
For amazon-linux-extras to correctly run, the installed files must have execute permissions enabled for the root or ec2-user account.
If permissions get changed incorrectly, the OS is unable to actually invoke amazon-linux-extras even though other checks pass.
Corrupt Bash Shell Profile
The bash shell uses a profile script (normally /etc/profile) to initialize environment settings like PATH.
If this startup script becomes corrupted or changed, it can prevent expected PATH modifications from taking effect, hiding access to amazon-linux-extras.
Now that you know what causes the “command not found” error, let’s go through the specific steps to resolve it.
Fixing the “amazon-linux-extras command not found” Error
To troubleshoot and fix the amazon-linux-extras not found error in Amazon Linux, follow this step-by-step process:
Verify amazon-linux-extras is actually installed
Check PATH variable for the executable path
Confirm file permissions allow execution
Load profile scripts manually if still failing
Optionally try re-installing the amazon-linux-extras bundle if problems persist after the above process.
Let’s look at how to perform each step in more detail.
1. Check If the amazon-linux-extras Package Is Installed
First, verify if amazon-linux-extras is present on the system with the rpm or yum utilities:
Greetings! I am Ahmad Raza, and I bring over 10 years of experience in the fascinating realm of operating systems. As an expert in this field, I am passionate about unraveling the complexities of Windows and Linux systems. Through WindowsCage.com, I aim to share my knowledge and practical solutions to various operating system issues. From essential command-line commands to advanced server management, my goal is to empower readers to navigate the digital landscape with confidence.
Join me on this exciting journey of exploration and learning at WindowsCage.com. Together, let’s conquer the challenges of operating systems and unlock their true potential.