Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: Internal distfile mirror via NFS
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
carambola5
Apprentice
Apprentice


Joined: 10 Jul 2002
Posts: 214
Location: Madtown, WI

PostPosted: Sun Aug 24, 2003 5:27 am    Post subject: HOWTO: Internal distfile mirror via NFS Reply with quote

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.
Code:
emerge curl

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 :D

And that's it.
_________________
Get Firefox!

Proper Web Development

I'm done at 999.
Back to top
View user's profile Send private message
El_Presidente_Pufferfish
Veteran
Veteran


Joined: 11 Jul 2002
Posts: 1179
Location: Seattle

PostPosted: Sun Aug 24, 2003 7:35 pm    Post subject: Reply with quote

why use /mnt/distfiles instead of just mounting to /usr/portage/distfiles?
Back to top
View user's profile Send private message
carambola5
Apprentice
Apprentice


Joined: 10 Jul 2002
Posts: 214
Location: Madtown, WI

PostPosted: Mon Aug 25, 2003 5:06 am    Post subject: Reply with quote

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
View user's profile Send private message
lisa
Retired Dev
Retired Dev


Joined: 01 Jun 2003
Posts: 273
Location: York, UK again! Horray!

PostPosted: Mon Aug 25, 2003 3:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum