Skip to content

Instantly share code, notes, and snippets.

@maherelgamil
Created June 8, 2021 05:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maherelgamil/6ad8b3d5b7dbbba3fd2e38afce052f69 to your computer and use it in GitHub Desktop.
Save maherelgamil/6ad8b3d5b7dbbba3fd2e38afce052f69 to your computer and use it in GitHub Desktop.
Install composer latest version on Ubuntu 20.04
#!/usr/bin/env bash
set -e
set -x
# Update server
sudo apt update
# Install some needed packages
sudo apt install php-cli unzip
# Download and Install Composer
cd ~
curl -sS https://getcomposer.org/installer -o composer-setup.php
# Verify that the downloaded installer matches the SHA-384 hash
HASH=`curl -sS https://composer.github.io/installer.sig`
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
# Install Composer
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment