Add a swap partition, example:
The recommended size is 2 times the actual memory. Create a swap file, bs value is fixed.
--16G
dd if=/dev/zero of=/swapfile bs=1024k count=16384
--5G
dd if=/dev/zero of=/swapfile bs=1024k count=5120
--8G
dd if=/dev/zero of=/swapfile bs=1024k count=8120
Among them, the value of count should be no need to be an integer multiple of 1024.
mkswap /swapfile
swapon /swapfile
--------------------------------
Check swap file information exists that is hanging success
vi / etc / fstab
/swapfile swap swap defaults 0 0
shut down
swapoff /swapfile