Here is a quick guide for composer setup on a DirectAdmin server (if you want to make it available for all users).
We will use Directadmin Composer plugin – you can get one here
First of all, we will need root access to install this plugin. Here is the list of commands for that:
cd /usr/local/directadmin/plugins;
wget https://github.com/Marco129/DirectAdmin-Composer/archive/master.zip;
unzip master.zip;
mv DirectAdmin-Composer-master directadmin-composer;
rm -f master.zip;
sh directadmin-composer/scripts/install.sh;
Most probably, you will get this:
[root@server plugins]# sh directadmin-composer/scripts/install.sh
mkdir: cannot create directory `/usr/local/directadmin/plugins/directadmin-compo ser/data': File exists
Plugin is now installed!
You can just ignore this error message – composer is not installed.
In order to make it available to everyone by simply typing composer from the command line, you need to copy it into /usr/local/bin folder.
cp /usr/local/directadmin/plugins/directadmin-composer/data/composer.phar /usr/local/bin/composer
You’re done! Now you can run composer via command line as any user.
Let’s install asset plugin (of course, not as root, you should log in as a regular user first):
composer require fxp/composer-asset-plugin
You should get something like this:
[yii2@server public_html]$ composer require fxp/composer-asset-plugin
Using version ^1.4 for fxp/composer-asset-plugin
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing fxp/composer-asset-plugin (v1.4.4): Downloading (100%)
Writing lock file
Generating autoload files