How to increase swap space in Linux

When a Linux system has an out-of-memory error or runs out of RAM, i.e. can no longer store data in the virtual memory, it will temporarily use swap space in order to increase the size of the virtual memory available. A swap file or one or multiple dedicated swap partitions can be used by the Linux system on a logical volume or a regular filesystem.