8MB should be enough for several of the minimal distros like
muLinux or
Small Linux. I'd suggest using Small Linux to get a boot partition going, like they talk about in the
4MB Laptop Howto, and then install a barebones
Slackware distro with the stuff you need.
As for X, it's likely to be somewhat sluggish with only that much RAM. Be sure to use a streamlined window manager like Blackbox or FVWM; you may also want to try using the
Tiny X server to minimize X's memory usage. Keep in mind you won't be able to run too many X programs at once with only 8MB RAM. It is quite doable though!