If you wish to enable swap on your server, there are a handful of methods that can be used. The below examples assume you are using CentOS or RedHat RHEL OS.
Using example swap mount point: /root/cp-swap
Commands (run as root):
fallocate -l 2G /root/cp-swap
ls -al /root/cp-swap
Verify swap is enabled by running this command.
To make the change permanent, add the following line to your /etc/fstab file.
Add line to /etc/fstab file:
/root/cp-swap swap swap defaults 0 0
Please use extreme caution when modifying the /etc/fstab file. It is responsible for the mounting of the partitions on the server. If unfamiliar with the file, we would recommend having a qualified System Adminstor make the change.
For RedHat RHEL OS:
RedHat has multiple ways of enabling swap. Please refer to their documentation for instructions.