sudo fallocate -l 4G /swapfile
- Creates a 4GB swapfilesudo chmod 600 /swapfile
- only root accesssudo mkswap /swapfile
- Mark as a swap spacesudo swapon /swapfile
- Enables itecho "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
- Persist it over reboots