Create a NAS using Ubuntu

In this article we will create a Network Attached Storage (NAS) device that will function as an NFS and Windows File Share.

While this article is not designed to teach you how to install Ubuntu Linux, it will let you know how to configure it to work as a NAS device. This article assumes that you have installed the base Ubuntu Server on a computer that is on the network.

 

With Ubuntu Server running the first thing we will do is to install NFS Server Support

At the terminal type


$sudo apt-get install nfs-kernel-server nfs-common portmap
$sudo dpkg-reconfigure portmap
When configuring portmap do =not= bind loopback. If you do you can either edit /etc/default/portmap by hand or run:
$sudo /etc/init.d/portmap restart

 

Now install Samba


$sudo apt-get install samba

 


Now that we have the basic pieces of your NAS installed, let install Webmin so we can use a standard web browser to easily manage our Server as well as the NFS and Samba (Windows Share) settings. While Webmin helps take some of the complexity out of the installation, we have to make some configuration changes to be able to install Webmin easily.

First you need to edit the Ubuntu sources listing so apt-get knows where to go to install Webmin. This is done by editing the /etc/apt/sources.list with your favorite Ubuntu text editor. I personally use vi.

Once sources.list is open you need to add the following line


Deb http://download.webmin.com/download/repository sarge contrib

 

Save and exit the text editor once you are done modifying

Now get the Webmin GPG key so you can install it through apt-get install.


$wget http://www.webmin.com/jcameron-key.asc

 

If you get an error that the wget command is not found install wget.


$sudo apt-get install wget

 


Once the key is downloaded install it.


$sudo apt-key add jcameron-key.asc

 

Update your sources.list file by running

$sudo apt-get update


Now install Webmin


$sudo apt-get install webmin

 

Once Webmin is installed, open your web browser and point it to https://ubuntuIP:10000

If you are not sure of your IP address run
If you get an error that the wget command is not found install wget.


$ifconfig

 

And you will be returned with the IP information for your Ethernet adapters.

After opening Webmin go to the Others Menu and then File Manager to create a directory that you are going to share. In my case, I'm going to use /mnt/datastore. You need to use the directory where you have the most amount of drive space available.

Now let configure the Windows File Share. Please note: there is a lot of information on configuring Samba, NFS, and Webmin on the net so I'm not going to do a deep dive into the configuration. I'm just going to create some simple shares to get you running.

In Webmin go to Server -> Windows File Sharing

Samba Settings

 

Select the Windows Networking Icon.
Update the Workgroup name and add a Server Name.

Samba Workgroup Name

Select Save

Select Create a new file Share
I'm calling mine data and the directory to share is /mnt/datastore. Give the share a comment if you wish.

NFS Exports

Select Create - You will be taken back to the main Samba screen.

Select the Share Name from the main Samba screen, now select Security and Access Control. I'm going to make the share accessible to Guest. I could make it Writeable and apply user permissions if I wish to. I check the Guest Access box to say Yes so I can allows Guests access to see the files.

 

Samba Share Security

Select Save at the bottom of the screen.

Now the Windows Share \\ubuntu\data exists, lets setup NFS.

Navigate to the Networking->NFS Exports section of Webmin

Select Add a new Export NFS Screen

Under Export Details
Select NFS Version 3 (or lower)
Enter the Directory to export to be the same as the Samba Windows Share directory

Scroll down to Export Security and make sure to change Trust Remote Users to Everyone. This will allow root users to connect. I do this so I can connect from my ESXi Server.

NFS Exports

Select Create and once you are back at the main NFS screen select Apply Changes.

Congratulations, you now have a NAS server that can share files with Windows and NFS.

To test windows sharing, depending on your OS, select Start Run or Start then in the Search or Run bar type

 

 

\\IPaddress\

Make sure to replace IPaddress with the IP address of your Ubuntu Server

You will then see the data folder shared from the Ubuntu Server.

 

Windows Share

 

I've created the same solution for my home network only I use a RAID volume to help with write performance. If there is interest, I'll add a future article on creating a RAID volume.

 

Add comment


Security code
Refresh

Tech Stocks

1 BRCD 10.84
-0.03 (-0.28%)    
2 CTXS 68.82
-2.51 (-3.53%)    
3 HPQ 34.55
-0.92 (-2.59%)    
4 MSFT 45.90
-0.46 (-0.99%)    
5 VMW 93.34
-0.50 (-0.53%)    
6 XRX 13.08
-0.15 (-1.13%)    

Donatations

If you like the site and feel the need to donate to help support the site, you can do it here.



Login Form