To install the AWS CLI on CentOS, Red Hat, or Fedora, using the built-in package managers like yum or dnf is a reliable method. This approach ensures that the AWS CLI is installed correctly, along with all necessary dependencies. It also integrates the tool seamlessly into the system, allowing for easy updates and management through the package manager.

For users on CentOS and Red Hat, the installation process leverages the default yum repository, where the AWS CLI is available as an RPM package. This method is straightforward and requires only a few terminal commands. By using yum or dnf, you avoid potential issues that might arise from using alternative installation methods like pip, ensuring a smoother setup.

In Fedora, the process is nearly identical. The dnf package manager handles the installation, ensuring that all dependencies are resolved automatically. This consistency across Linux distributions simplifies the management of AWS CLI installations, especially for those managing multiple environments.

Steps to install AWS CLI on CentOS, Red Hat or Fedora:

  1. Open the terminal application.
  2. Enable the EPEL repository on your system.
    $ sudo dnf install --assumeyes epel-release
    [sudo] password for user:
    Last metadata expiration check: 0:12:47 ago on Fri 05 Nov 2021 06:25:23 AM +08.
    Dependencies resolved.
    ================================================================================
     Package                   Architecture   Version          Repository      Size
    ================================================================================
    Installing:
     epel-release              noarch         8-11.el8         extras          24 k
    Installing weak dependencies:
     epel-next-release         noarch         8-11.el8         extras          11 k
    
    Transaction Summary
    ================================================================================
    Install  2 Packages
    
    Total download size: 35 k
    Installed size: 38 k
    ##### snipped
  3. Install the AWS CLI package using yum or dnf.
    $ sudo dnf install --assumeyes awscli
    Extra Packages for Enterprise Linux 8 - x86_64  7.4 MB/s |  11 MB     00:01    
    Extra Packages for Enterprise Linux Modular 8 -  43 kB/s | 955 kB     00:22    
    Extra Packages for Enterprise Linux 8 - Next -  301 kB/s | 1.3 MB     00:04    
    Last metadata expiration check: 0:00:03 ago on Fri 05 Nov 2021 06:39:02 AM +08.
    Dependencies resolved.
    ================================================================================
     Package            Arch   Version                              Repo       Size
    ================================================================================
    Installing:
     awscli             noarch 1.18.156-2.el8                       epel      2.1 M
    Installing dependencies:
     python3-botocore   noarch 1.18.15-1.el8                        epel      4.5 M
     python3-colorama   noarch 0.4.3-1.el8                          epel       35 k
     python3-docutils   noarch 0.14-12.module_el8.5.0+761+faacb0fb  appstream 1.6 M
     python3-jmespath   noarch 0.9.0-11.el8                         appstream  45 k
     python3-pyasn1     noarch 0.3.7-6.el8                          appstream 126 k
     python3-rsa        noarch 4.7.2-1.el8                          epel       61 k
     python3-s3transfer noarch 0.3.4-1.el8                          epel      108 k
    
    Transaction Summary
    ================================================================================
    Install  8 Packages
    
    Total download size: 8.5 M
    Installed size: 62 M
    ##### snipped
  4. Verify the installation by checking the AWS CLI version.
    $ aws --version
    aws-cli/1.18.156 Python/3.6.8 Linux/4.18.0-240.22.1.el8_3.x86_64 botocore/1.18.15
  5. Configure the AWS CLI to connect to your AWS account.
Discuss the article:

Comment anonymously. Login not required.