Recently, I ran into the following error while installing some software on Ubuntu 14.04:
virtual memory exhausted: Cannot allocate memory
Not good - but the fix is easy – add some swap space to your instance. The following
is a list of commands you can use to successfully resolve this problem:
85 cd /
87 sudo dd if=/dev/zero of=swapfile bs=1M count=3000
88 sudo mkswap swapfile
89 sudo vi /etc/fstab
As you can see, you now have 3GB of swap space on your device !!! Not - EC2 comes with ZERO swap
space by default - so it might be no a surprise if you are seeing this issue - especially on a t2.micro
instance.