41

I am looking to set up Ubuntu Server as a headless NAS for my home. I would like to have file storage there, as well as a central hub for my MP3s and pictures.

What are the best packages out there to handle this? Can someone post a link to a good tutorial or post some tips?

One constraint I have is that it has to be Windows 7 friendly. By that I mean the shares and streaming should work for a Windows machine.

rifferte
  • 686

7 Answers7

16

I just finished doing this myself and I did it using Samba. I'm able to mount the samba shares from my windows & ubuntu computers

Here are some links that helped me get started:

https://help.ubuntu.com/community/SettingUpSamba

http://ubuntuforums.org/showthread.php?t=280473

Focus
  • 101
  • 2
    This is why a link farm is not considered an answer. The first link gets redirected to a generic Samba page. The original must have been removed. – Isaac Rabinovitch Jul 03 '21 at 02:27
10

Simples:

  1. Install Ubuntu Server. Really helps if you can have the server with a keyboard and monitor for this bit... Although you can script a CD to auto-install if you want. More trouble than it's worth if you ask me.

  2. Create a user, set up ssh (sudo apt-get install openssh-server), etc. Put your server in its final resting place and ssh in from your desktop.

  3. Install & configure samba (see the manual configuration section)

  4. Optionally install NFS for linux clients (faster, less taxing on the server CPU in my experience)

  5. Relax. You're done.

Oli
  • 293,335
5

For the filesystem, I have software RAID 5 across my drives, and encrypt the resulting filesystem. This way, I can use this system as a backup server as well.

Once the system is up, I use plain ol' NFS and Samba for the file level access. (apt-get install nfs-kernel-server samba). I also have a PS3 that I like to stream media to, so I use mediatomb for that (apt-get install mediatomb), and my wife uses iTunes on her Mac and netbook, so I also install mt-daapd (apt-get install mt-daapd) to share my music over the daap protocol, which rhythmbox can also use.

2

You might want to take a look at the Ubuntu based TurnKey File Server appliance. If you don't need a full-fledged appliance, you could use it as a reference for configuration on your own server.

1

Posting this so I can find it in the future. Install Ubuntu Cloud VM (add an extra disk 1TB or larger.)

Note: you should replace username with your user.

Mount and Format the disk:

lsblk
sudo fdisk /dev/sdc
n
p
Enter defaults for rest of options

Make the filesystem

sudo mkfs -t ext4 /dev/sdc1

Make a mount path:

mkdir /home/username/data

Update Fstab

sudo echo "/dev/sdc1 /home/username/data ext4 defaults 0 2" >> /etc/fstab

Install the tools you need:

sudo apt install vim screen htop sysstat curl wget
sudo apt install nfs-server samba

Update Exports for NFS (I'm setting this based on subnet, you can change as needed)

sudo echo "/home/username/data 192.168.1.0/24(rw,no_root_squash)" >> /etc/exports
sudo exportfs -a

Make Cifs share:

sudo vi /etc/samba/smb.conf
shift+g
o

Paste the following

[data]
comment = Data
browseable = yes
path = /home/username/data
guest ok = no
read only = no
create mask = 0700

Generate smbpasswd (this will allow windows hosts to connect over smb, granted we are passing them in with the username account (smile))

sudo smbpasswd -a username

Update permissions if needed:

sudo chown -R username:root /home/username/data

Download some data (this is a good dump of isos)

cd /home/username/data
wget -H -r --level=5 --restrict-file-names=windows --convert-links -e robots=off --no-check-certificate https://ftp.nluug.nl/os/Linux/distr/
Nmath
  • 12,333
0

I made a Ubuntu based NAS with file sharing based on Samba and Nextcloud and works across Windows, Linux or Mac. I haven't yet setup a "real" streaming server (e.g. Plex), but I use Nextcloud which is something like a Google Drive clone, which allows easy viewing of photos, music and videos through web browser.

My Ubuntu NAS:

  • Intel NUC PC
  • Ubuntu Server 20.04 (headless)
  • External RAID1 USB3 drive QNAP TR-002 (this whole drive is shared, LUKS encrypted ext4 partition)
  • Samba (for LAN file-share access)
  • Nextcloud (optional, for cloud access)
  • UFW firewall (optional)
  • iDrive (optional as cloud backup of all drives including RAID USB3)

Samba Setup:

First I mostly followed this guide to set up Samba users.

I edit the samba config (sudo nano /etc/samba/smb.conf) and make 2 changes:

  1. Under [global] section I added inherit permissions = yes to make sure permissions for added files are correct.
  2. Configure my shared folder by adding to the bottom as follows:
[mynas]
  comment = The Big USB drive
  path = /media/usb0/
  read only = no
  browsable = yes
  writable = yes
  create mask = 0640
  directory mask = 0750
  valid users = vijay
  hide files = /$RECYCLE.BIN/System Volume Information/thumbs.db/

Remember to restart Samba after changes:

sudo service smbd restart

And if your server has a firewall, remember to allow it:

sudo ufw allow samba

Access on Linux: smb://192.168.1.2/mynas/

Access on Windows File Explorer: \\192.168.1.2\mynas\

In my case I need to log in as "vijay" to access the shares, but the password can be saved on the client so it is only entered on first access.

Nextcloud Setup:

I used the Snap package which is probably easiest. I usually avoid Snap but in this case it worked well. You can also try Docker or manually set everything up if you are an advanced user.

For Snap version, I just ran the following after installation to allow access to USB drive and ports:

sudo snap set nextcloud ports.http=81 ports.https=444
sudo snap connect nextcloud:removable-media

I then set up a reverse proxy (Haproxy) and SSL for secure external access over the web, but that is beyond the scope of this short guide.

Vijay Prema
  • 496
  • 3
  • 9
0

if you wnat DLNA support, then see: MiniDLNA - Community Help Wiki

blade19899
  • 26,704
mihi
  • 1