The environment is Ubuntu 14.04 LTS

NFS Server-side setup

Let’s say your NFS shared directory is /shared/local, and it maps to local(NFS server) directory /usr/local

First, we need to clone nvm, git clone https://github.com:creationix/nvm.git /usr/local/src/nvm

Then let’s make two directories for storing nvm stff.

mkdir /usr/local/nvm

mkdir /usr/local/node

And we then create /etc/profile.d/nvm.sh on local(NFS server), this allows us to install node binaries.

#!/bin/bash
export NVM_DIR=/usr/local/nvm
. /usr/local/src/nvm/nvm.sh
export NPM_CONFIG_PREFIX=/usr/local/node
export PATH="/usr/local/node/bin:$PATH"

After logging out, and log back in (or simply type . /etc/profile.d/nvm.sh)

we then run nvm install 0.12 (in this case, we install node v0.12, we can also install other versions)

Now run chown 755 -R /usr/local/nvm, this gives nfs client approriate access rights. (Otherwise you will see Now using node undefined after running nvm use 0.12)

we then create another file (maps to shared directory.Remember,client do not have nvm installed on their /usr/local)

Let’s make one file /usr/local/nvm.sh on nfs server

#!/bin/bash
export NVM_DIR=/shared/local/nvm
. /shared/local/src/nvm/nvm.sh
export NPM_CONFIG_PREFIX=/shared/local/node
xport PATH="/shared/local/node/bin:$PATH"

#2 NFS Client-side setup

Now, let’s log into client server (as root)

Let’s create one file /etc/profile.d/shared.sh

#!/bin/bash
export PATH="/shared/local/bin:$PATH"
. /shared/local/init.sh

This will execute nvm initation scripts we created at the end of last section and add node binaries locations to PATH

Now you can log out and log back in, type nvm , TADA!!