The least frustrating way of setting up a NAS is to use a dedicated distro.
openmediavault.org/
freenas.org/
Are common ones, though there are more.
I personally use Open Media Vault (debian based). It has a plugin system that makes all the functions I need easy to set up.
The step for building are
Needs:
-Some cheap shitty preferably low power computer. I bought this mother board (amazon.com/gp/product/B00Q5ZEOCO/) and used old ram and a 300W power supply I already had in my parts bin. Make sure the motherboard has at least 4 sata ports.
-1 small drive to hold the OS (this drive is not for storing files). Can be a flash drive, (make sure you use the write reduction plugin)
-2 hard drives to set up in software raid eventually.
-Another drive for backups that remains unconnected. Kansas lightning storms have made me paranoid forever.
Basically you follow the instructions here to install: wiki.openmediavault.org/index.php?title=Installation
I just hook up the NAS to a monitor and keyboard while installing. After that you can unhook them and access the OMV GUI through a brower after finding out the IP that the router assigned it. Make sure you have an internet connection while installing. I was playing around with router bridging at the time, so my internet connection was all sorts of fucked. Turns out that installing OMV in such a situation will somehow cause problems that are way beyond my ability to fix.
After installing you add the sata drives and fumble around in the GUI until you are able to set them up in software RAID1
Then you add the plugins you want. Be aware there are extra plugins available that you have to manually enable: omv-extras.org/joomla/
You can set up samba to be able to view files in windows as a network drive. This is where user permissions become important. If you are like me you will be confused as fuck at first, and screw everything up. Eventually I worked it out though frankly I couldn't really teach anybody anything. If you have a persistent problem, I could look at how my shit is set so you could copy it. What I do is I deny all but a few whitelisted IP's (which my router permanently assigns to a chosen device), and those whitelisted IP's have to enter a name/password for a user I setup on the NAS that can only access the drives. This way no one else can connect to the network and rummage through my 5TB's of lebanese handholding photos. Windows won't index network drives, but that's find since locate32.cogit.net/ is far superior and faster to use once you learn how.
I also use the snapraid plugin: forum.openmediavault.org/index.php/Thread/5553-SnapRAID-Plugin-Guide/
Fail2ban is a must.
Docker is available, but I don't need that or streaming or any other bullshit so you're on your own for that.
Use decent sata cables, and have extras to try. When I set up a raid array, First things were fine but eventually I encountered all sorts of seemingly random problems that were impossible to replicate. Turns out the sata cables were fucked, and sometimes worked and sometimes didn't depending on their position. After days of trying to figure out if the drive or software was bad, I replaced the cables and everything was fine.
Make sure you test things and play around a bit before committing to anything as your primary spot for holding data. What you'll find it is it takes a few "I fucked the setting up too badly, time to start from scratch" moments before you work out the peculiarities of a system and learning how to set up what you want to achieve. Once you finally get it right, you can basically forget about the system except to login and do occasional updates. My setup has worked perfectly for 2 years now.
If the drive the OS is on dies and you don't have a backup, you can just get a new drive (disconnect the raid drives first), reinstall, and put the raid disks back in. Worst comes to worst you can actually take out the raid drives and read them fine on any linux system.
Finally, make sure that things you aren't using are disabled. SSH, and whatever is should be turned off if you don't.