This is the document I put together on how to install and set everything on my Nas Killer 3.0. You can see my actual build specs here.
Its pretty common in the serverbuilds community to use Unraid, which is a great solution. I wanted to be able to build some other more linux-y stuff, not have to pay, and get my terminal chops back up to snuff (plus I’ve been an ubuntu guy for a long time). SnapRAID is great at expansion like Unraid, but is not real time. That seems pretty acceptable for a media server to me.
Install Ubuntu Server on your new box
For these first steps, you typically are connected directy to the box with a keyboard and monitor. You don’t need a mouse as you don’t have any guis.
Get Bootable USB
- Get and install Rufus
- Download Ubuntu Server (I did 18.04)
- Use Rufus to load Ubuntu to USB
Install
- Use Del to load bios and change boot order to USB drive first (removed this later)
- Follow prompts…nothing crazy…no extra packages, SSH. Installed to whole SSD drive.
- Reboot - Make sure to change back boot order so you boot from SSD not usb if still installed
- Login with username and password
Initial Updates and checks
Check to make sure you have universe and multiverse repos by running “nano /etc/apt/sources.list” and checking if those repositories are listed - This wasn’t the case for me once.
sudo apt update
sudo apt upgrade
Setup SSH Server
To do this, I followed the following link: https://www.smarthomebeginner.com/install-ssh-server-on-ubuntu-1204/. Plus the following:
- Change the port to a random number
- Change the users and other settings as given in the link
- Restart SSH
- Login with Putty from a windows machine
Format Drives to EXT4
This assumes that you have brand new drives that you want formatted for Ubuntu. This WILL ERASE all content on your drives.
My Drives were all formatted for ZFS…and needed to be changed. SnapRAID Supports both XFS and EXT4. I did EXT4 just because that is the default for Ubuntu.
To see your partitions and formats: sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
I followed this link to help with this process: How To Partition and Format Storage Devices in Linux | DigitalOcean
For each data drive that needs reformatting do the following where " is something like sdb
. I also just number my drives to disk1
or disk2
after the -L
:
sudo parted /dev/<DRIVE> mklabel gpt
sudo parted -a opt /dev/<DRIVE> mkpart primary ext4 0% 100%
sudo mkfs.ext4 -L disk<NUMBER> -m 1 -T largefile4 /dev/<DRIVE>1
Note that I reduced the reserved space to 1% for my 8tb drives, you may want to leave this as 5% for smaller drives. The -T
tells it what kind of file size I’ll have. For movies, they will generally be large.
The parity drive(s) should be similar, other than you shouldn’t leave any space (-m 0
) (see SnapRAID):
sudo parted /dev/<DRIVE> mklabel gpt
sudo parted -a opt /dev/<DRIVE> mkpart primary ext4 0% 100%
sudo mkfs.ext4 -L parity1 -m 0 -T largefile4 /dev/<DRIVE>1
Mount Drives and Setup mergerFS
First, we want to install mergerFS: sudo apt install mergerFS fuse
. mergerFS is useful at taking multiple drives and making it a single storage pool. That way you can just add media to a single folder and it will decide which drive to put it on.
A useful link for this section is: The Perfect Media Server 2017
We want to check your formatted disks: sudo lsblk --fs
will show the drives.
If you named your drives like I have, you need to make directories in the /mnt/
folder for each drive, as well as for the pool (we’re gonna call that storage
).
mkdir /mnt/disk{1,2,3,4,5}
mkdir /mnt/parity{1,2} # adjust this command based on your parity setup
mkdir /mnt/storage
Now, we need to edit your fstab
file (this is the file that is used to auto-mount drives. To do that we’ll use a simple file editor called nano
. You can move your cursor around. Save with ctrl+s
and exit with ctrl+x
. To edit the file, run sudo nano /etc/fstab
to make it look like:
OTHER STUFF THAT IS ALREADY THERE...
# My Additions of harddrives
LABEL=disk1 /mnt/disk1 ext4 defaults 0 0
LABEL=disk2 /mnt/disk2 ext4 defaults 0 0
LABEL=disk3 /mnt/disk3 ext4 defaults 0 0
LABEL=disk4 /mnt/disk4 ext4 defaults 0 0
LABEL=parity1 /mnt/parity1 ext4 defaults 0 0
# Combine data harddrives into single storage mount using mergerFS
/mnt/disk* /mnt/storage fuse.mergerFS direct_io,defaults,allow_other,minfreespace=50G,fsname=mergerFS 0 0
Now you want to test and remount everything. Run the following commands one by one to test it out:
sudo mount -a
df -h -x tmpfs -x devtmpfs
echo "success" | sudo tee /mnt/storage/test_file
cat /mnt/storage/test_file
sudo rm /mnt/storage/test_file
Additionally, it can be nice to have the users have access to the storage medium. To do this run sudo chown <username> /mnt/storage/
This also helps with the samba steps.
Install Docker
You’ll use docker later to install packages and tools, additionally, we’ll use it here to build some tools, so we do in now.
Docker tells you how to do this:
Redirecting… - DO NOT USE SCRIPT METHOD
sudo apt-get remove docker docker-engine docker.io
- See Link
Test by running sudo docker run hello-world
, sudo docker rmi hello-world
A lot of docker tutorials want your user added to the docker power stuff so you don’t have to type sudo each time…I think that’s dumb and type sudo each time. So I ignored this step: sudo usermod -aG docker $USER
.
In my notes I have this command: sudo systemctl enable docker
- I don’t remember doing this, but you may need to.