Create a Linux Swap File
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
To make the change permanent open the /etc/fstab
file and append the following line:
/swapfile swap swap defaults 0 0
sudo swapon --show
sudo free -h
References
https://linuxize.com/post/create-a-linux-swap-file/