Install Composer globally on VPS


I’m trying to install Composer and make it available globally on my VPS. The instructions I’ve read say to execute:

$ curl -sS | php
$ sudo mv composer.phar /usr/local/bin/composer

Unfortunately I can’t run sudo with my default account. After a bit of reading I foudn that you can create an admin account that has sudo permissions, but when I set that account up it can’t see my domain. If I attempt to modify the domain so it runs under a different account it doesn’t give me the option of the admin account but does allow me to specify a new account. If I type in the name of the admin account it says I can’t use that name as it already exists.

Am I doing something stupid? I just can’t find a way to run sudo under the default account that the domain belongs to, and I can’t find a way to access the domain from the admin account.


For security reasons, we require the admin account on a VPS or dedicated server to be used exclusively for system administration; it cannot be used to host web sites.


Thanks, Andrew.

I totally understand the security concerns. Does that mean there’s no way to move Composer into /usr/local/bin/ then? Or perhaps another way to achieve this?


You’ll need to install Composer using the admin account, then log out of that account and into the appropriate user for your site to manage that.


Excellent. I was concerned that running it under the admin account wouldn’t then carry over to the user account, but all is now fine. Phar doesn’t exist in the default version of PHP (CLI) so I had to run “export PATH=/usr/local/php56/bin:$PATH”

Thanks for your help.