Light Install

Gentoo is, as we all know, a great distribution. Though, it is quite large (it easily uses 10 GB when you have Gnome, some games, a lot of USE flags and old files), and being able to have an installation which uses less storage (only a few gigabytes?) and builds faster would be nice, especially for netbooks and similar low-specification boxes. This guide will try to explain how to set up a Gentoo box in a such a light way, with or without the help of a server which does have some cool specifications (your choice). Obviously, you want to be able to use it as if it is a regular desktop machine and it should not be critical if the server might fall out. For this guide, I'll assume that you're installing Gentoo and got to the point of partitioning and formatting your drive.

ReiserFS
Ext* filesystems are huge. Every file uses at least four kilobytes on your HDD. ReiserFS makes these amounts a lot smaller. Since linux has thousands of small (under 4KB) files, it is a perfect idea to use ReiserFS for about all partitions. /home could be an exception if you are going to have a lot of media in it.

Or just change the Ext* blocksize to something else using the "-b" switch of mke2fs. Something like "mke2fs -b 1024 /dev/hda1" will give you a 1k blocksize filesystem on /dev/hda1, so those thousands of small (under 4k) files will become lots of little files of 1k. That way you don't have to worry about ReiserFS's questionable stability history.

(see also: JFS)

SquashFS
Use squashfs to compress /usr/portage (on average from 1GB down to around 200MB). SquashFS doesn't write very fast, but this is not needed for the portage tree, as this isn't updated very frequently.

NFS/SFTP Mounts
We can use a server to store non-critical files, mainly portage (unless you've already mounted portage using SquashFS) & friends. To do this, we'll start with some space on the server. If you want it as a separate partition, make that using fdisk. There is no explicit need for this, though. As the server runs gentoo as well, you can use the same /usr/portage/ tree. NFS mounting

You can choose to share the tree via NFS now, which has a small speed advantage. Share it using NFS, as described here.

SFTP mounting
You can also use SFTP to read and write from and to the tree. It is slightly slower than NFS, but it has the advantage of easily being able to mount over the internet.

Q: Why not FTP?

A: FTP is not available using FUSE in the portage tree at the moment of writing, for detailed information, see Mounting SFTP and FTP shares. SFTP is nice because it encrypts data and thus is more secure than NFS (which doesn't really have any kind of security).

Finishing partitioning
Once you have used any of the hints described above and partitioned your system correctly, continue installing Gentoo like described in the Gentoo Handbook. After you have installed a stage, return to this page for further instructions on how to setup the rest of your system in a light way and keep your system small.

make.* stuff
After this basic installation, we're going to make your the rest of your system (mainly GUI-related stuff) depend on fewer packages and haver smaller binaries. I'm going to assume you have /etc/make.profile set to /usr/portage/profiles/default-linux/x86/2007.0/desktop/make.defaults. Of course, the corresponding amd64 profile won't differ a lot, but please pay more attention. Now, /etc/make.conf can be configured to make your system lighter. We'll edit it again later in this guide for some compiling features, but for now only these modifications are needed:

To have all applications be compiled with -Os, I recommend you to emerge -e world now.

Switch off loggers
/var can get pretty big if you log everything blindly. Switch off logging for a lot of applications. One of the things you can switch of is syslog-ng:

If you have a different logger, substitute its init.d script with the one above, obviously.

Or use remote logging
You can also send logs over the network. For syslog the server would look something like this:

A client that logs everything over the net might look like this:

Or use logrotate
Logrotate can automatically rotate and gzip logfiles on a periodic basis. Since log files are very repetitive and text based, they compress nicely. Many would consider logrotate a far superior approach than switching off the logger.

Extra: ionice
On computers with slow harddrives, being able to "nice" the I/O as well would be nice. Guess what: You can! The tool ionice is available in >=schedutils-1.5.0. Update to this version before continuing. To make any app ionice'd as well, just run it like this:

Portage 2.2 can use ionice by adding the following line to your make.conf: PORTAGE_IONICE_COMMAND="ionice -c 3 -p \${PID}"

If you use an older version of Portage, you may try these fixes:

Option one: create /bin/nice
I did this by making a new file in /bin, called nice.

Then, a single bless makes your build actions nearly unnoticable:

Because files in /bin have preference over /usr/bin (assuming /bin comes first in PATH), our little script will be called instead of the binary installed nice executable.

Option two: bash alias
An rather less problematic alternative would be to add a variant of the following line to ~/.bashrc:

Compiling in RAM
When emerging packages, the compilation stage requires a lot of hard drive space. You can force the compilation to take place in RAM, which will use minimal HDD space. Refer to the Speeding up emerge with tmpfs article for a step-by-step guide.

Desktop Environment
Now, it's time for some GUI. First Install X.org. Then, you may want to have a light desktop environment (at least I do). Gnome is heavy and KDE is huge too.

Option one: Xfce
Although not the lightest on the market, Xfce is far from a heavyweight, still it offers a very complete environment.

Option two: Enlightenment 16
Older version of Enlightenment Window manager, but still being maintained and improved. Lighter than xfce, but it might look far better even on older configurations. Good window moving, multiple/virtual desktop animations. Some say that its pager is the best one available. It doesn't support compiz, but has some own composite effects. To use it, just emerge x11-wm/enlightenment. ~arch versions are feasible and generally safe to use. For configuration, emerge e16keyedit and e16menuedit2 and see ~/.e16/, config files are text, safely editable by hand.

Option three: Enlightenment DR17
You can also choose Enlightenment DR17. It's pretty light, but some people don't like its looks. See Enlightenment DR17.

Option four: LXDE
Recently, a new DE has entered the market. Check out LXDE for more information. LXDE is really lightweight, but still has a bit of the looks of KDE.

Option five: OpenBox
OpenBox is a very lightweight and simple Window manager. If you want, it can integrate with famous desktop environment like Gnome or KDE, but it's not neccessary. It's fast, GTK based, supports multiplie workspaces. Ideal for power users.

Option six: just a WM
You can also simply not install a desktop environment at all and go for something like Fluxbox, JWM, IceWM or one of tiling window managers (dwm, ratpoison, awesome, ion and others).

Office suite
Which office suite you should use depends on what you're going to use the installation for. If it's pure office work, then OpenOffice might do the trick. If you're going to edit a single file every now and then, then OpenOffice will take too much time to load. Abiword is nice and clean, but misses some features. KOffice involves having to install QT libraries, which means another big load, unless you already use some Qt applications. In summary:
 * OpenOffice if you're going to do pure office work on it
 * KOffice if you already frequently use Qt applications
 * Abiword if the above do not apply and you do not need special features (which OpenOffice might have)

Notepad equivalent

 * Leafpad
 * Geany is equivalent to Notepad2 in that it has syntax highlighting among other features.
 * SciTe automatic syntax styling, can perform commands to compile or run source files with the output from these commands directed into the output pane.

Deleting unnecessary files
There are a couple of directories which are not always worth fully keeping. They can absorb a vast amount of disk space, so you should make sure you clear them every now and then if you don't need them anymore.

/tmp clearing
To start with, /tmp is a directory which has a lot of unused files which should be cleared, but have not been. Please refer to Clean /tmp for more information on this.

eclean
Another useful tool is eclean. eclean can clear tarballs you no longer need and obsolete binary packages. To start using eclean, simply emerge gentoolkit if you do not have it yet:

If you want to clear all distfiles which are older than the currently installed corresponding packages, run:

If you're a buildpkg or buildsyspkg guy, you should also run:

Remove old kernel sources
If you've updated a couple of times, you might notice that you have too many kernels installed. To remove these, run:

You should run this after every kernel update

Unmerge unused packages
When you unmerge (with ) or update any package, sometimes it leaves unused packages behind it, which were installed as its dependencies. To unmerge them, use the following:

If some of these packages are necessary for you, add them to world favorites file prior to cleaning:

/var directories
Like written above, you could already have /var/tmp mounted on a server. If not, it could be a good idea to clear the contents of /var/tmp/portage every now and then, as it can get pretty huge when you break a lot of builds.

Some general advice

 * If possible always check for software alternative that uses smallest/fewer dependencies, so check the output of emerge/paludis carefully before actually installing. eg. Pidgin (formerly GAIM) (bloated with gnome deps) vs aMSN (lighter), gnome-terminal vs aterm, rox vs filer, evolution vs sylpheed and many more.
 * Always stick to one group of dependencies (either GTK+ or Qt)
 * Compile with USE flag only for specific packages in, NOT as a global use flag in /etc/make.conf