Tux's lil' helper
Joined: 15 Mar 2009
|Posted: Sun Mar 28, 2010 7:56 pm Post subject: Distcc on non-gentoo hosts
|Most gentoo users like wasting resources optimally, this is why I want to use all of the computers I have at home to compile together. The problem is that two of them are mainly used by my parents and they want something easy to maintain, so there is one Ubuntu and one Mandriva.
Run distccd on a non-gentoo machine, without installing many things on that machine
-The gentoo system exports its root on nfs (read-only)
-All of the other computers mount it, do some unionfs magic and chroot so they can run distcc with the same compiler gentoo is using
-All what is installed on the gentoo machine is available with the same version (gcc version, cross-compilers, distccd)
-There is no waste of space
-The cflags/arch on the gentoo machine have to run on all the other hosts
-Nfs certainly adds overhead (I have not measured it)
-The way I have done it, all my disk is accessible read-only on the network !
-You need root access on all machines
We assume we have two machines, gentoo-host and ubuntu-host.
On the gentoo machine I share the root by adding
|/ ubuntu-host(ro,async,no_root_squash,no_subtree_check) |
and launch the nfs server (/etc.init.d/nfs start)
On the Ubuntu host, we will use aufs
Before using it for the first time, we will need 3 directories : one as the mountpoint for nfs, one for the union mount writable tree, and one for the union mount point, let's call them /nfs-ro, /rw and /aufs, you can put them where you like of course.
|#mount the remote filesystem
mount -t nfs gentoo-host:/ /nfs-ro/ -o ro,nolock
#mount the aufs union-mount
mount -t aufs -o dirs=/rw:/nfs-ro=ro aufs /aufs/
#the next one is not really useful, just if you want to use more functions of the gentoo chroot
mount -o bind /dev /aufs/dev
#this will make top and many other things work properly in and outh the chroot
mount -t proc none /aufs/proc
#this reduces interferences between the original system and the one running on Ubuntu
mount -t tmpfs none /aufs/var/run
Once this is done, just chroot on the aufs directory (sudo chroot /aufs) and you are root, init scripts won't probably work, so I advise running it from command line, and as a normal user possibly :
|su user -c "distccd --allow gentoo-host -N15" |
I hope this will be useful for someone else.
If someone has ideas to improve it, for instance not exporting /home, or correct my english, I am interested too