Memory requirement to build Linux Server¶
Thank you to Minthos.
As i discovered on my poor PC, about 1280Mo of RAM is required to build the Linux Server.
It includes the RAM used by the kernel and the Linux Services.
What can you do if you lack of memory ?
Create a temporary swap file.
sudo dd if=/dev/zero of=/mnt/512Mb.swap bs=1M count=512
The swap size is equal to bs * count.
1M * 512 = 512M in that example.
Change count value as you need
sudo mkswap /mnt/512Mb.swap
sudo swapon /mnt/512Mb.swap
To disable the swap file:
sudo swapoff /mnt/512Mb.swap
The swap file is added to the swap partition.
To add permanently the swap file, edit /etc/fstab and add the following line:
/mnt/512Mb.swap swap swap defaults 0 0
Tell the build system to use temporary files instead of pipes, by having it omit "-pipe" from the build flags. I don't know how much memory this saves.
Tell make to not launch any parallel jobs by removing -j2 or setting it to -j1. If you only have one CPU core, this won't slow the compile down much (might actually speed it up due to less swapping). (Conversely, if you have many cores and lots of memory, you should set a higher -j number to speed up compilation).
Read this: http://hostingfu.com/article/compiling-with-gcc-on-low-memory-vps