The cloud server no default swap, as follows:
[root@myhost ~]# free -m total used free shared buff/cache available Mem: 1839 694 77 0 1068 949 Swap: 0 0 0
Create a swap partition, the swap should be set on how much of it?
4GB or 4GB or less of memory systems, the minimum required 2GB swap space; greater than 4GB and less than 16GB memory system, minimum required 4GB swap space; greater than 16GB and less than 64GB memory system, minimum required 8GB swap space; greater than 64GB and less than 256GB memory the system requires a minimum 16GB swap space.
Add a swap partition:
IF = dd / dev / ZERO of = / = 1K the swapfile BS COUNT = 2048000 2. Create SWAP file # the mkswap / the swapfile 3. Activate SWAP file # the swapon / the swapfile 4. Check SWAP information is correct # the swapon -s 5. The added to fstab file to start automatically when the system boot # echo "/ var / swapfile swap swap Defaults 0 0" >> / etc / fstab 6. check with the command free 2G swap to take effect # free -m # grep SwapTotal / proc / meminfo 7 The release SWAP file # swapoff / swapfile 8. delete SWAP file # rm -fr / swapfile