| View previous topic :: View next topic |
| Author |
Message |
carambola5 Apprentice


Joined: 10 Jul 2002 Posts: 214 Location: Madtown, WI
|
Posted: Sun Aug 24, 2003 5:27 am Post subject: HOWTO: Internal distfile mirror via NFS |
|
|
This document explains how to setup an NFS share so that a server can share share distfiles with a clients without giving them write access. Note: some clever configuring would be necessary for newly downloaded packages to be sent to the server. This is not covered here.
The overall scheme is simple:
- Export the server's distfile directory (defined in make.conf as ${DISTDIR}) via NFS
- Mount the NFS directory on the client
- Setup portage to use a local directory as a possible mirror.
NOTE: I will assume that /usr/portage/distfiles is your distfiles directory. Whenever you see "/usr/portage/distfiles", you need to hardcode your path. When you see "${DISTDIR}" it would be wise to leave it as "${DISTDIR}".
Step 1: Export distfiles
This is simple. Enable NFS (I won't go into this... better explained elsewhere) and export the directory with:
| /etc/exports wrote: | | /usr/portage/distfiles 10.1.1.0/255.255.255.0(ro,no_root_squash) | where 10.1.1.0/255.255.255.0 is your subnet
You may need to restart nfs:
| Code: | | /etc/init.d/nfs restart |
Step 2: Mount the directory
Simply do:
| Code: | | mkdir /mnt/distfiles; mount -t nfs server:/usr/portage/distfiles /mnt/distfiles | where server is the name of your server.
Step 3: Tell Portage to use a directory
This is the tricky part. The first thing to know is that wget does not support the file:// protocol. This means you need a new FETCHCOMMAND and RESUMECOMMAND. curl is a nice client. Let's use that.
Then you need to update your make.conf with the following:
| make.conf wrote: | ....
FETCHCOMMAND="/usr/bin/curl \${URI} -o \${DISTDIR}/\${FILE})"
RESUMECOMMAND="/usr/bin/curl -C - \${URI} -o \${DISTDIR}/\${FILE})"
GENTOO_MIRRORS="file:///mnt/distfiles $\{GENTOO_MIRRORS}" |
I haven't actually tried the resume command yet. I'll just assume it works
And that's it. _________________ Get Firefox!
Proper Web Development
I'm done at 999. |
|
| Back to top |
|
 |
El_Presidente_Pufferfish Veteran


Joined: 11 Jul 2002 Posts: 1171 Location: Seattle
|
Posted: Sun Aug 24, 2003 7:35 pm Post subject: |
|
|
| why use /mnt/distfiles instead of just mounting to /usr/portage/distfiles? |
|
| Back to top |
|
 |
carambola5 Apprentice


Joined: 10 Jul 2002 Posts: 214 Location: Madtown, WI
|
Posted: Mon Aug 25, 2003 5:06 am Post subject: |
|
|
| El_Presidente_Pufferfish wrote: | | why use /mnt/distfiles instead of just mounting to /usr/portage/distfiles? |
If you want your clients to have read-only access to the server's distfiles (which is a good idea given concurrency issues), then you need a separate place for the clients' local distfiles and the server's distfiles.
I dunno... this all seems sort of hack-ish to me. But it works, and maybe it's exactly what someone out there needs. Besides, I was having a helluva time setting up apache correctly. _________________ Get Firefox!
Proper Web Development
I'm done at 999. |
|
| Back to top |
|
 |
lisa Retired Dev


Joined: 01 Jun 2003 Posts: 273 Location: York, UK again! Horray!
|
Posted: Mon Aug 25, 2003 3:00 pm Post subject: |
|
|
You can also modify $DISTDIR in make.conf:
| Code: |
DISTDIR=/mnt/distfiles
|
_________________ Distcc guide
Visit my website
I maintain Distcc, Ccache, Memcached, and some others (i think) |
|
| Back to top |
|
 |
|