Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
3  
You don't use SFTP since you discovered SSH? How were you using SFTP (a component of SSH) before you used SSH, exactly? Get working on Linux From Scratch if you want total control of what's installed, I guess. –  Bill Weiss Sep 21 '10 at 17:12
    
What I mean is that before I used svn/git/scp over pure SSH I used SFTP which just added another unneeded piece to the transfer. –  Xeoncross Sep 21 '10 at 17:51

6 Answers 6

up vote 4 down vote accepted

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

share|improve this answer
1  
Linux From Scratch looks like the prefect resource for learning what is needed and why. That should help me in removing what isn't needed on my systems. Though I'm sure I'll continue to use full destros for their communities and support. It's not like I need to go off and start yet another linux flavor. –  Xeoncross Sep 21 '10 at 17:48
1  
A benefit of fully uninstalling unused packages is shorter package dependency changes, which means fewer, faster and shorter update downloads and less chance a fairly useless package will have an update issue. Also your /var partition will fill up slower/need less attention. –  kmarsh Sep 21 '10 at 20:20

You're asking what you can delete to suit your needs for a smaller server. But the way you're working it sounds like you may have a misunderstanding of the distro; Ubuntu is based on Debian, but it isn't Debian with custom packages making it Ubuntu. You can't just cut things out like the way it sounds like you want.

Plus, even if there were a script or packager, you're saying things like you don't need FTP since having discovered SSH. Well, if you were stripping a server to the "core", you may not necessarily need SSH, so automated tools might just strip that out too.

Essentially you need to intervene and figure out what you need and don't need and remove packages you don't use.

I don't know what the conditions are for your VPS, but my first reaction when people are looking to strip out a server to a minimal footprint is to tell them to look for distros that are geared for minimal footprints. Distrowatch may help you there. Ubuntu server is a general purpose OS that is not aimed at being small. If you're looking for a specialized server distro you can find them, but you'll lose some functionality that you may really be used to like the apt-get system or some other tool you've come to rely on.

Not to mention that if you just go through stripping parts out, you may end up hitting a package that you think you don't need but actually do because of some thrice-removed dependency.

End answer, I know of no such easy-automated-stripping tool for a server configuration other than the minimal configuration at install time, and I'm wary of anything that does this because it may not know what I want in the server and may remove things I want. I instead would look for a specialized distro that is geared for the server role I want, or I would use the apt-get tools to see what's installed and remove things that I don't want (since the packager may minimize my whoops-moments).

share|improve this answer
    
Well, I remember running across some really DSL distros (including DSL) and that while that does give the end result. I'm interested in learning what is or is not needed and why along the way. So I'd rather stick to full destros that I know will be around to offer support in the future. I just want to learn what isn't needed so I can remove that after each install and the easiest way seemed to be to read a guide or find someone's script on the subject. –  Xeoncross Sep 21 '10 at 16:18

When I worked for a VPS hosting company we saw some ingenious webserver implementations designed to live within a 64MB memory footprint (this assumes you're talking about RAM, not disk space) - the Debian+nginx HowTo at LowEndBox stands out as a strong example.

share|improve this answer

I usually do the following when installing Debian or Ubuntu:

  • Don't select anything in tasksel (part of the installation process)
  • echo 'APT::Install-Recommends "0";' > /etc/apt.conf.d/99local
  • aptitude
    • press M on the category 'Installed Packages'. this will mark all packages as installed to satisfy dependencies
    • press _ on the category 'Installed Packages'. this will mark all packages for purging. aptitude will complain that essential shouldn't be removed, just answer the prompts with return and they won't be
    • press g to apply your selections, apitude now fixes packages with broken dependencies
    • select packages that you want to keep by pressing + on them (learn about other aptitude commands by pressing ?)
    • after some work, aptitude will purge the packages that you don't need.
share|improve this answer

In Ubuntu land, you can use an existing system to build JeOS images. They are rather normal ubuntu systems, but stripped down of nearly everything. There aren't even manual pages installed. Last time I build an Ubuntu 10.04 LTS x86_64 JeOS system it was 124MiB compressed, with some additional packages on it (ruby, puppet and its deps, something else).

Talking about your goal, if you aren't putting the entire system in a ramdisk for a diskless hardware, you're probably misunderstanding something.

share|improve this answer
    
I'm sure that since I'm still new to this there is a lot I am misunderstanding. However, I know that in every OS there are always packages that aren't needed - or that can be replaced with faster, smaller apps. I want to learn what those are and how I can use them. –  Xeoncross Sep 21 '10 at 16:21

If you want a lean Linux server you can install ArchLinux. It's somewhere between Slackware/Linux from Scratch and Debian. Check it out.

Keep in mind that Ubuntu JeOS images (as Luke404 points out) are stripped down versions prepared to be installed in Virtual Machines. They have just about the minimun hardware support for this environment and the kernel is patched with some optimizations specifically for virtual environments.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.