linux增加虚拟内存,解决内存不够,有些软件无法编译问题

作者: dreamfly 分类: linux 发布时间: 2020-08-16 09:36

使用管理员执行下面的挂在虚拟内存命令

#Check free memory before
free -m

mkdir -p /var/_swap_
cd /var/_swap_
#Here, 1M * 2000 ~= 2GB of swap memory.  Feel free to add MORE
dd if=/dev/zero of=swapfile bs=1M count=2000
mkswap swapfile
swapon swapfile
chmod 600 swapfile
#Automatically mount this swap partition at startup
echo "/var/_swap_/swapfile none swap sw 0 0" >> /etc/fstab

#Check free memory after
free -m

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

评论已关闭!