create a swapfile
# 1. create the designated file:
sudo fallocate -l 1G /swapfile
# 2. restrict access:
sudo chmod 600 /swapfile
# 3. define file as swap area:
sudo mkswap /swapfile
# 4. activate the swap:
sudo swapon /swapfile
######################################
# deactivate swap and remove file:
sudo swapoff /swapfile && sudo rm /swapfile