I forgot to set up a swap partition during setup, so figured I'd use a swap file instead, in case I messed up the Mac OSX boot partition.
First, create an empty file. To know how much you need, see here. In this example, I'm using a 1GB (1024mb) swap file. Use the following command to make it:
sudo mkdir /swapfile
sudo dd if=/dev/zero of=/swapfile/1024mb.swap bs=1024 count=1048576
Now convert it into a swapfile by typing:
sudo mkswap /swapfile/1024mb.swap
Now to install it!
sudo swapon /swapfile/1024mb.swap
Check if it works. The file should now be listed after typing:
And lastly, automate it so it's used after ever reboot.
sudo vi /etc/fstab
Add in the following line at the end (each part is separated by tabs)
/swapfile/1024mb.swap none swap sw 0 0