mkdir /swap
# config 32G swap
dd if=/dev/zero of=./swapfile bs=1G count=32
# grant permission
chmod 600 /swap/swapfile
chmod 600 /swap
mkswap /swap/swapfile
swapon /swap/swapfile
swapon -s
# append to /etc/fstab
echo '/swap/swapfile swap swap defaults 0 0' >> /etc/fstab