How to add a swap file in a Linux system

This is already part of the install_elive_on_server.sh script that's being worked on by @Thanatermesis .
The embedded part reads as:

  # create a swap file
    if [[ "$( cat /proc/meminfo | grep -i memtotal | head -1 | awk '{print $2}' )" -lt 1500000 ]] && ! installed_check "swapfile" 1>/dev/null 2>&1 && ! swapon -s | grep -qs "^/" ; then
        if el_confirm "\nYour server doesn't have much RAM, do you want to add a swapfile?" ; then
            is_wanted_swapfile=1
        fi
    fi

    if ((is_wanted_swapfile)) ; then
        if ! [[ -s "/swapfile.swp" ]] ; then
            dd if=/dev/zero of=/swapfile.swp bs=1M count=1000
            chmod 0600 /swapfile.swp
            mkswap /swapfile.swp
            swapon /swapfile.swp
            addconfig "/swapfile.swp swap swap defaults 0 0" /etc/fstab
        fi

        installed_set "swapfile" "Swap file is created and running, special 'swappiness' and 'watermark_scale_factor' configurations added in /etc/sysctl.conf to not bottleneck the server's disk"
    fi
    # tune
    if swapon -s | grep -qs "^/" ; then
        addconfig "vm.swappiness = 10" /etc/sysctl.conf
        addconfig "vm.watermark_scale_factor = 500" /etc/sysctl.conf
    fi
   

It should be quite usable as a standalone and you could put together a few screenshots as a walkthrough/Howto ... maybe you could even repackage it in a simple GUI. :magick: