# How to setup NFS for sharing /usr/portage

## padukes

Hi,

With much help from trjones4 I've been trying to set up NFS so that I can share my /usr/portage directory with the machines in my network.

I did an 

```
emerge nfs-utils
```

on both the server machine and the client machine.  My /etc/exports file looks like this:

```
dhcp-1994-244 etc # more exports 

# /etc/exports: NFS file systems being exported.  See exports(5).

/usr/portage    192.168.0.0/255.255.255.0(rw,no_root_squash,sync)

```

I'm using the no_root_squash option so that the client has all root privileges (read/write/etc) on the server's directory to update distfiles, etc.- Can you think of any reason not to do this?  

I started nfs on the server and added it to the default runlevel:

```
$/etc/init.d/nfs start

$rc-update add nfs default 
```

I did the same thing on the client  but it seems like overkill to have another server running on the client (even though it's not exporting anything) - is there anyway to only run the client stuff on the client machine? 

Finally, this is the relevant line from my fstab on the client. 

```
192.168.0.1:/usr/portage /mnt/portage   nfs             rw      0 0

```

I totally guessed - does it look right? The only option I gave was rw. Does that makes sense?

Thanks,

P

----------

## PowerFactor

You don't need to add nfs to the default runlevel on the client, just the server.  Running portmap on both machines might make things go a little more smoothly though.  Your fstab line looks fine to me.

----------

## padukes

Thanks! What does portmap do? - the man page makes is seem like it's only necessary on servers -  are there any other NFS-like processes I should be running on the client? Specifically, there are start up scripts like NFSMOUNT and NETMOUNT - should I use one those? 

What about nfs processes I don't need on the server?

Thanks

P

----------

## Genone

/etc/init.d/nfsmount should take care of the client. If the server has a public IP I would add some iptables rules to block incoming NFS requests from outside. Oh, and be careful when running emerge on multiple machines at the same time, it might overwrite some distfiles (worst case but possible).

----------

## padukes

Awesome!  This worked for me!

Thanks!

----------

## allancairns

 *Genone wrote:*   

> /etc/init.d/nfsmount should take care of the client. If the server has a public IP I would add some iptables rules to block incoming NFS requests from outside. Oh, and be careful when running emerge on multiple machines at the same time, it might overwrite some distfiles (worst case but possible).

 

Genone,

Regarding your reference to public IP, is this an issue if the exports file only specifies specific machines/IP addresses?

Thanks,

Allan

----------

