I have two Linux boxes, one of which doesn't have much RAM or disk space. How would I go about setting up a swap file on the second machine for the first to use?
You have lots of choices. You can use NBD a network block device. You can set up an NFS mount and swap over it. You can swap over CIFS.
Mount a network drive.
Create a file on it of the appropriate size. (You can use dd if=/dev/zero of=/path/to/swapfile bs=xxx count=xxx)
dd if=/dev/zero of=/path/to/swapfile bs=xxx count=xxx
Make that file a swap device. (Use mkswap.)
Mount it (Use swapon.)
Configure it for permanent use. (Depends on your distribution. Check /etc/fstab.)
3 years ago