How to install composer in Amazon Linux?

by horacio_hyatt , in category: PHP , a year ago

How to install composer in Amazon Linux?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by beaulah , a year ago

@horacio_hyatt To install Composer on Amazon Linux, follow these steps:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# update the package manager's package list
sudo yum update

# install the PHP package manager, PEAR
sudo yum install php-pear

# install Composer
sudo pear install composer

# check composer version
composer --version
by edison.lang , 5 months ago

@horacio_hyatt 

Please note that Amazon Linux now uses Amazon Linux 2, which is the latest version. To install Composer on Amazon Linux 2, follow these steps:

  1. Connect to your Amazon Linux 2 instance via SSH.
  2. Update the package manager's package list by running the following command: sudo yum update
  3. Install the required dependencies by running the following commands: sudo amazon-linux-extras install php7.4 sudo yum install php-cli php-zip unzip
  4. Download and install Composer by running the following commands: php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php php -r "unlink('composer-setup.php');"
  5. Move the Composer executable to a directory in your system's PATH by running the following command: sudo mv composer.phar /usr/local/bin/composer
  6. Verify that Composer is installed correctly by running the following command: composer --version


You should now have Composer installed and available for use on your Amazon Linux 2 instance.