How To: Install Homebrew on Amazon Linux
Published: 2024-06-02 12:48:52

# How To: Install Homebrew on Amazon Linux

Homebrew, often referred to as "brew," is a popular package manager for macOS and Linux. It simplifies the installation of software by automating the download, configuration, and setup processes. While traditionally associated with macOS, Homebrew can also be installed on Linux distributions, including Amazon Linux. This guide will walk you through the steps to install Homebrew on an Amazon Linux system.

## Prerequisites

Before you begin, ensure you have the following:

- An Amazon Linux instance up and running.
- SSH access to your Amazon Linux instance.
- Basic knowledge of the Linux command line.

## Step 1: Update Your System

First, it's a good practice to update your system to ensure all packages are up-to-date.

```sh
sudo yum update -y
```

## Step 2: Install Required Dependencies

Homebrew requires several dependencies to be installed on your system. These include Git, GCC, and other development tools. Install them using the following command:

```sh
sudo yum groupinstall 'Development Tools' -y
sudo yum install curl file git -y
```

## Step 3: Install Homebrew

Now that the dependencies are in place, you can install Homebrew. The official installation script can be downloaded and executed with the following command:

```sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

During the installation process, you will be prompted to provide your sudo password and to confirm the installation path.

## Step 4: Configure Your Shell

After installing Homebrew, you need to configure your shell to include Homebrew in your PATH. You can do this by adding the following line to your shell profile file (e.g., `~/.bash_profile`, `~/.bashrc`, or `~/.zshrc`):

```sh
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bash_profile
```

Then, apply the changes by sourcing the profile file:

```sh
source ~/.bash_profile
```

## Step 5: Verify the Installation

To ensure that Homebrew is installed correctly, run the following command to check its version:

```sh
brew --version
```

You should see output similar to:

```sh
Homebrew 3.x.x
Homebrew/homebrew-core (git revision xxxxx; last commit yyyy-mm-dd)
```

## Step 6: Install Packages with Homebrew

Now that Homebrew is installed, you can start using it to install packages. For example, to install `wget`, you can use the following command:

```sh
brew install wget
```

## Troubleshooting Tips

- If you encounter issues with permissions, ensure that your user has the necessary privileges to install software and modify system files.
- If Homebrew commands are not recognized, double-check that the Homebrew path is correctly added to your shell profile and that you have sourced the profile file.

## Conclusion

Congratulations! You have successfully installed Homebrew on your Amazon Linux instance. With Homebrew, you can easily manage and install various software packages, making your development environment more robust and flexible. For more information on using Homebrew, you can refer to the [official Homebrew documentation](https://docs.brew.sh/).

By following this guide, you should have a functional Homebrew installation ready to handle your package management needs on Amazon Linux. Happy brewing!


---


> https://stackoverflow.com/questions/51667876/ec2-ubuntu-14-default-password