I quickly checked this by

$ free -m

And the output suggested that there is no swap file provisioned. This is how the output looked –

     total   used   free   shared   buff/cache   available
Mem:  492     109    280      4         102         366
Swap:  0       0      0

Well, so we know the solution for this one, yes, we need to setup a swapfile. The no-frills procedure I followed to setup a swap file of 2 gigs is as below

  1. Allocate 2 Gb to swap file
$ sudo fallocate -l 2G /swapfile

2. Set appropriate permissions for the swap area file

$ sudo chmod 600 /swapfile

3. Setup the swap area using the space allocated above

$ sudo mkswap /swapfile

4.Enable the swap area

$ sudo swapon /swapfile

5. Veify that swap area has been enabled

$ sudo swapon -s


Filename    Type     Size       Used     Priority
/swapfile   file     2097148    44088    -1

6. To make the swap file permanent, we need to add it to /etc/fstab file. Add the following line to the /etc/fstab file

/swapfile   none    swap    sw    0   0

Note: Swap is not RAM

By toihid