In which folder should I install Composer on a shared linux server? The "Questions that may already have your answer" do give various instructions on how to install Drush and/or Composer, but they don't address my question. I did come across this comment: 

Q: drush - which folder for install on VPS / root server (newbie):
A: "You can install Drush in the folder of your choice. Preferably outside www-directory."

My question: I'm not sure if this is applicable to Composer as well? 
And if it is applicable to Composer as well, why do people give specific folders into which Composer must be installed into?

The reason for my concern into which folder I install Composer is because I want to run it without problems (in any case with as little as possible).

I'm listing the different options:


mdir bin, cd bin, install Composer in [~/bin] directory.
Install in /home/username/bin
Install in [~/bin] and move to /usr/local/bin
Install in the /usr/local/bin folder 
That is a hidden folder, I can access it if I say "cd /usr/local/bin" in my terminal, but it doesn't show in the file manager of cpanel. How does that relate to /home/username/bin (or doesn't it)?
Install in the public_html folder (home/username/public_html)
One article says that Drupal is installed in the /var/www/drupal folder.
Another articles says that Drupal is installed in domains/websitename.com/htdocs/www


It seems to me that the [~/bin] directory is the preferred one?
TL;DR My recommendation would be /usr/local/bin

It doesn't really matter as long as the directory is in the PATH of all users, and as long as it is not one of the locations which the OS wants full control over (those would be primarily /usr/bin and /bin).  For most situations, a reasonable location is /usr/local/bin because it should already be in the system's default PATH and it is intended precisely for this purpose -- local installations which are not part of the OS proper.

For Linux, you might want to refer to the LHS entry; this standard codifies usage inherited from the original Unix.

If it's convenient for you, installing in $HOME/bin and then moving to a system-wide location is fine.  In fact, most make install etc facilities expect you to be doing something like this.