root@tokyo:~# apt-get install -y dphys-swapfile
After that /etc/dphys-swapfile needs to be edited:
root@tokyo:~# vi /etc/dphys-swapfile
Here you can make various settings but for now let’s just use double the size of the RAM for the SWAP that should be created by changing
#CONF_SWAPFACTOR=2
to
CONF_SWAPFACTOR=2
Close and save /etc/dphys-swapfile and restart dphys-swapfile.
root@tokyo:~# /etc/init.d/dphys-swapfile restart
If you run
root@tokyo:~# top
you now can see your SWAP.