I recently attempted to install Flarum on an AWS Lightsail instance. I wanted to share a with others my headache in regards to the missing VENDOR directory and composer create-project exiting with a "killed" code.
As it turns out, 512MB of RAM may not be enough to run Composer in order to install dependencies.
My System: Ubuntu 20.04 | 512MB RAM
What I tried to correct the "killed" error:
[1]Reinstall Flarum using the create-project command
[2]Reinstall Composer
[3]Check ALL permissions
[4]Restarting my Lightsail instance
[5]Upgrading Composer
[6]Manually re-adding all PHP extensions
None of these worked.
What did in the end is as follows:
Create a Swap File
First, create a file that will be used as swap:
sudo fallocate -l 2G /swapfile
If the fallocate utility is not present on your system, or you get an error message saying fallocate failed: Operation not supported, use the following command to create the swap file:
sudo dd if=/dev/zero of=/swapfile bs=1024 count=2097152
Set the file permissions to 600 to prevent regular users to write and read the file:
sudo chmod 600 /swapfile
Create a Linux swap area on the file:
sudo mkswap /swapfile
You should get the following output
Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
no label, UUID=fde7d2c8-06ea-400a-9027-fd731d8ab4c8
Activate the swap file by running the following command:
sudo swapon /swapfile
To make the change permanent open the /etc/fstab file:
sudo nano /etc/fstab
and paste the following line in /etc/fstab
/swapfile swap swap defaults 0 0
Verify that the swap is active by using the swapon command, as shown below:
sudo swapon --show
After this is done, return to your Flarum install directory and run the following:
This assumes your Flarum install directory is /var/www/html/forum
sudo rm -rf /var/www/html/forum
Next, recreate the FORUM folder
sudo mkdir /var/www/html/forum
Last, set the permissions that the folder needs ( maybe not to what I use as it could be a security risk )
sudo chmod -R 777 /var/www/html/forum
Now you should be all set!
Enter the "forum" folder with
cd /var/www/html/forum
And now run the "composer create-project" command again.
Hope this helps!