Tree Hut Aurora Nights Shea Sugar Scrub | Exfoliating Body Scrub Removes Dead, Dry Skin for a Soft & Hydrated Feel | Nourishing Essential Body Care | 18 fl oz.
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: command not found
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:
rpm -qa | grep amazon-linux-extras
yum list installed | grep amazon-linux-extras
If there are no results, you’ll need to install amazon-linux-extras with:
sudo yum install -y amazon-linux-extras
Once in place, the command should be accessible. But if not, keep checking the next troubleshooting steps.
2. Confirm Executable Path in PATH Variable
Even with amazon-linux-extras installed, the executable may not be in PATH.
Check with:
echo $PATH
Look for the path like /usr/bin in the output. If not there, add it:
export PATH=$PATH:/usr/bin
Now try accessing amazon-linux-extras again.
3. Verify File Permissions on Executable
Make sure permissions allow executing amazon-linux-extras with:
ls -al /usr/bin/amazon-linux-extras
The file should be owned by root and have x execute flags set.
If missing execute access, update permissions:
chmod 755 /usr/bin/amazon-linux-extras
With correct permissions, give running amazon-linux-extras another test.
4. Manually Load Profile Scripts
If it still fails, try manually loading the bash shell’s expected profile scripts:
source /etc/profile
Then:
source ~/.bash_profile
This will force load the PATH updates. Now see if amazon-linux-extras runs without issues.
Re-installing amazon-linux-extras
As a last resort, you can try fully re-installing amazon-linux-extras:
sudo yum remove -y amazon-linux-extras
sudo yum install -y amazon-linux-extras
Then re-check PATH settings and permissions. This should reset any corrupt files or registry issues.
Following the detailed troubleshooting steps above should resolve problems accessing amazon-linux-extras in Amazon Linux. But let us know in the comments if any issues crop up!
Installing Add-Ons with amazon-linux-extras Once Fixed
Once you have fixed the “command not found” error and have access to amazon-linux-extras again, here is a quick example on using it to install add-ons:
sudo amazon-linux-extras install nginx1
The above will setup the Nginx web server from the available extras bundles.
Some of the other useful addons provided by amazon-linux-extras include:
- Java runtimes
- MySQL and PostgreSQL databases
- Php-fpm and Varnish caching
- Docker and Kubernetes clusters
With Amazon-linux-extras back up and running, get your Amazon Linux instance ready to serve production workloads!
Let us know in the comments if you have any other issues or questions related to amazon-linux-extras.
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.