Increasing Swap Space Using a Swap File on Linux
Step 1: Turn Off the Existing Swap
Step 2: Create a New Swap File
Create an 8GB swap file:
Adjust the count value to change the size of the swap file.
Step 3: Set the Correct Permissions
Step 4: Set Up the Swap Area
Step 5: Enable the Swap File
Step 6: Make the Swap File Permanent
Add to /etc/fstab: