Quick NFS setup

Sometimes you need to setup “on demand” connection to access resources on other machine.

I found it useful sharing yum cache (1GB+ of already downloaded updates) with the laptop that needs to be updated as well.
Normally laptop update would re-download most of the files. Mounting /var/cache/yum in read-write mode from my desktop computer on laptop’s /var/cache/yum saves me a few hours.

  1. Make sure that your /etc/hosts.allow includes your LAN in allow section. Important: following setup is security risk. Don’t use it in an untrusted environment.
    /etc/hosts.allow

    rpcbind : 10.1.0.0/255.255.255.0 : allow
    rpcbind : ALL : deny

  2. Export filesystem on server. Assume that your LAN is in 10.1.0.0/255.255.255.0 range. Actual values can be found in ifconfig command output (addr/mask).
    on server root console

    service portmap start
    service nfs start
    exportfs 10.1.0.0/255.255.255.0:/var/cache/yum -o rw,no_root_squash

  3. Mount the share on the client. Assume that server’s IP is 10.1.0.1.
    on client root console

    service portmap start
    mount 10.1.0.1:/var/cache/yum /var/cache/yum -o nfsvers=2,rw

  4. To make such setup permanent, add portmap and nfs to services that startup at boot, edit /etc/exports on server and /etc/fstab on client. Remember that you are giving write access (also as root what is extremely dangerous) to anybody that can connect to your LAN (10.1.0.0/255.255.255.0).

See also: NFS troubleshooting

Post Scriptum: this is an import of information that I wrote a while ago. Things might have changed since then.

This entry was posted in Linux and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>