Linux – How to strip a Linux server distro to the core

linuxUbuntu

I am finally getting used to managing a small Ubuntu server VPS. However, I know that I there must be programs installed that I don't need. Even if it is just the overhead of the Ubuntu system on top of Debian.

For example, I don't use Apache since I discovered Nginx. I don't use (S)FTP since I discovered SSH. I can replace bash with dash or OpenSSH with dropbear.

So I am wondering if there is a guide I can study or script that I can run out there which will remove all non-core parts of the system so that I can learn more about what is actually needed and how these libs work. Though I must admit that I'm no where near ready to start messing with the linux core itself.

My goal is to fit a complete PHP webserver in about 50MB so that I can give the FS and memcache all the rest of the RAM. I'm mostly interested in Debian since I know it already – but I've heard good things about CentOS also.

Best Answer

It seems that your primary objective is to get the most of your RAM for performance and not for holding bloated or unneeded software, right? if so, just disabling Apache (for instance) is enough; you don't get any benefit by uninstalling it.

Therefore, the best is to check ps fax output. You'll see every package running and how many subprocesses it's spawning. quite likely you're not running FTP, so you don't have to worry about that either.

Besides, most of the non-performance-critical services can run from inetd (or likely xinetd). In that case they're not holding any RAM until you access the right port.

In my experience, Ubuntu server (without LAMP) is very close to barebones. I usually just add ssh, nginx and whatever backserver i'm using.

If, on the other hand, you want to reduce disk usage, then you'll be better served by a different distro or (the best option, IMHO) Linux From Scratch