By: Jason Bird
http://jasonbirdstech.blogspot.com/
Before we begin:
I am assuming a few things about your system/network in this how-to that I personal feel offers a cleaner more stable network setup that will eliminate possible performance and connectivity issues down the road.
This guide is write for a Ubuntu server/desktop setup. The same concepts apply to other distributions but your package manager may be different.
I'm assuming your file server has a static IP address, since your file server is a server I find it best to remove a margin of error by always setting IP address for servers to static even in a home network.
I'm assuming your Media Centers also have a static IP addresses, since I view Media Center in the same category as servers/ network appliances I feel it offers a more organized network by having them static. This way the Media Center always knows where the File Server is and the File Server always knows where the Media Center is coming from, Especial in a network that has multiple Media Centers.
Since multiple Media Center are becoming more popular this How-To will setup the server to grant two Dedicated Media Centers access to it shares. If you have more just continue the network architecture to satisfy your needs.
The File Server has a Folder in its root that houses the data. We will be using the root path /Media01
We will setup the shares with full access to the following user for simplicity sake this will ensure read/write access from Media Center to File Server. The user in this How-To is mcuser
My editor of choice in this How-To is pico since its simple to use and very light weight, however feel free to use any editor you like.
The Setup:
The table below lays out the systems we are using in this example, with their host name, a brief description and the static IP address being assigned to that machine.
Host Name | Description | IP Address |
FS01 | File Server: This is going to serve files to the Media Centers | 192.168.10.1 |
MC01 | Media Center: This is the first Media Center in our setup. For all intensive purposes we can assume these have the same setup. | 192.168.20.100 |
MC02 | Media Center: This is the first Media Center in our setup. For all intensive purposes we can assume these have the same setup. | 192.168.20.101 |
Create the File system architecture
The first thing we want to do is create the File Server's architecture. This is going to be the organizational back bone to our file server. All data files that are to be accessed from outside the server should be located here.
mkdir -p /Media01/home/public/ cd /Media01/home/public mkdir video mkdir mp3 mkdir pictures |
NFS Server Setup
Install Needed Packages
Copy and past the command below to install the NFS file server
sudo apt-get install nfs-kernel-server
Exporting Shares:
On the file server you must export each directory or directories you want to share, and what hosts can access them. Use the following command to open the exports file for editing
sudo pico /etc/exports
Append this the following lines to /etc/exports:
-
#MC01 Shares /fs01/home/public/video 192.168.20.100(rw,sync,no_subtree_check) /fs01/home/public/mp3 192.168.20.100(rw,sync,no_subtree_check) /fs01/home/public/pictures 192.168.20.100(rw,sync,no_subtree_check) #MC02 Shares /fs01/home/public/video 192.168.20.101(rw,sync,no_subtree_check) /fs01/home/public/mp3 192.168.20.101(rw,sync,no_subtree_check) /fs01/home/public/pictures 192.168.20.101(rw,sync,no_subtree_check) |
Adding individual exports for one or two Media Centers works fine, but if you have more this can become cumbersome. To setup your exports file to allow an entire IP range you will use the following
-
#Global Media Center Share /fs01/home/public/video 192.168.20.100/255.255.255.0(rw,sync,no_subtree_check) |
What the above will do is grant all computers with the 192.168.20.100-192.168.20.255 I doubt you will have 155 Media Centers running and if you did I doubt you will have need for this hot-to
Now run the following to ensure the exports have applied.
sudo exportfs -ra
This is about all it takes to setup a functional well organized back-end for your Media Center network now lets move on to the client side.
Client Setup
On both Media Centers install the base files needed to access the file server and mount the files shares exported in the previous section.
Run the following to install the nfs client packages
sudo apt-get install nfs-common
After the nfs-common package installs with all its dependencies it is time to setup the Media Centers architecture. Since the home directory of mcuser on both media center already have a Video, Pictures, and Music directories we will use those to mount the NFS shares.
Use the following to open your fstab file
sudo pico /etc/fstab
append the following to the bottom of your fstab file.
#NFS 192.168.10.1:/fs01/home/public/video /home/mcuser/Videos nfs timeo=14,intr 192.168.10.1:/fs01/home/public/mp3 /home/mcuser/Music nfs timeo=14,intr 192.168.10.1:/fs01/home/public/pictures /home/mcuser/Pictures nfs timeo=14,intr |
Now that we setup the shares in fstab its time to see if we did everything right.
At the command prompt enter the following to reprocess the fstab file.
sudo mount -a
if all went well you should be dropped back into the command prompt and on the desktop of mcuser you should see the tree shares you created. The nice thing about this setup is, since we are using the same user that has read/write access to the system we wont have to worry about permissions and can treat the shares as local directories.
The next step is to repeat the client setup on every Media Center in your network. If you are using Moovida then it will automatically start scanning the Videos, Pictures, Music folders of mcuser once it is reloaded. If your using XBMC you will need to setup the shares manually.
Suggestions:
Trouble Shooting tips: