Install Composer in Ubuntu

Rather than adding a composer.phar file to each project it can be easier to install composer to your linux distribution’s bin folder.

#ensure php cli is installed
apt-get install php5-cli

cd /usr/bin
#install composer, notice the sudo to allow us to write to /usr/bin
php -r "readfile('https://getcomposer.org/installer');" | sudo php

#create a composer file that calls the composer.phar and add execute permission to it
sudo bash -c 'echo -e "#!/bin/bash\nphp /usr/bin/composer.phar "$@" > composer'
sudo chmod +x composer