Sometimes when using centos, I find that the memory is not enough, so I think of swapping the system price to alleviate the memory problem, first check free -m and find that Swap is not enabled at all, and the memory is almost used up, so.....
[Note: If Swap already exists, attach the closing method] Close Swap: sudo swapoff /var/swapfile
Open 1024M Swap:
dd if=/dev/zero of=/var/swapfile bs=1M count=1024
Re-designate the Swap file:
mkswap /var/swapfile
Reopen the Swap file:
swapon /var/swapfile
Modify fstab to make Swap boot up automatically:
we /etc/fstab
Add the content (if you already have it, you don’t need to add the following content):
/var/swapfile swap swap defaults 0 0
View again: