I needed some web storage for university and other projects, so I searched for the cheapest option available. My university offer free unlimited Google Drive storage, but I wanted to host something locally. Since OpenFiber FTTH network has finally reached my house, I thought that a small htpc would have been the best option. Now I can host my Nextcloud instance locally, and I can enjoy jellyfin media server library on the couch.
It is not the cheapest option available, but it should be powerfull enough to last a few years ( I hope…). I chose a small SBC called NanoPi M4 because it is cheap and powerful. It spots a Rockchip RK3399 SoC, the same one found in some chromebooks. It is an hexacore processor with big.LITTLE architecture design. It has also a pcie header, so I bought a nvme expansion board and a 500GB Crucial nvme ssd. Later on, if I want to expand the storage I could purchase a SATA hat. I also chose this SBC because of its low power consumption. I cannot measure it directly but I think it does not exceed 10W even under load. It is also fanless, but not completely silent because I can hear a faint coil wine if I stand beside it. Anyway, I will put it in a cupboard near my ISP modem, so noise won’t be a problem.
Let’s talk about software. My needs are basically a personal cloud service, from which I can share files to my classmates, and a media server to use in the home.
FriendlyArm offers a Friendlycore img that is a customized version of Ubuntu server. Armbian is a community driven project aimed at offering up-to-date linux images to SBC. I use it on my orangePi and I am using it with NanoPi. Currently, images are built with 5.4 Kernel, versus 4.4 on Friendlyarm images. Mainline kernel support is a big deal with these cheap SBC. I downloaded the .img file and flashed it onto an sd-card.
Nextcloud is a fork of Owncloud, a platform for file sharing and collaboration. It has a free plan and is also open-source. I am not a software engineer so I used this simple script to install all the dependancies needed. It is compatible with Debian and you can also build an Armbian image with nextcloudpi already installed. It takes a while, but at the end you go to
nanopi-ipaddress:4443 and you can save the default password and follow the installation wizard. I then proceeded to install the system onto the emmc. I prefer it to the sdcard because sdcards, especially the cheap ones, tend to fail after a while. In an always on server that would be really really bad. Armbian has a command line utility called nand-sata-install that migrates your system to the internal emmc.
I chose jellyfin because it is the only true opensource media server project. It is a fork of Emby, which went closed source a while ago. Installation is super easy, since they have a public repo for debian packages. At this point you can also install qbitorrent-nox, a bittorrent client with no GUI that you can control via a webpage.
I also created an open access samba share on my local network. Smb protocol is definitely faster than WebDAV used by Nextcloud. I use it when i need to copy large files from or to the server. However, you shouldn’t copy files inside the internal nextcloud folder. You definitely can, but you have to scan it afterwards with nextcloud command line utility. It is better to integrate external folders in nextcloud as external storage. Nextcloud will then check for new files automatically.
I thought it would be nice to use a subdomain to access my home server. I’ve bought andfar.me and I made a new DNS CNAME record to redirect to my free *.duckdns.org domain, which is updated from my isp modem. I configured a reverse proxy for jellyfin and I’m using virtual hosts so I can create as much subdomains as I like. Everything runs on https using letsencrypt certficates.
In case everything goes wrong and you have to start over again here’s the correct order to install everything.
* Download Armbian
* Flash the system on an sdcard and boot the nanopi
* Upgrade the packages via apt
* Install nextcloudpi with the simple script
* Move the system on the interal EMMC with
* Reboot and remove the sdcard. Automount the NVME ssd
* finish the nextcloud setup by connecting to
* install jellyfin, samba, etc
* Set up Apache for the reverse proxy
*Unfortunately the emmc needs to be empty or at least contain a non-bootable image. The boot order for RK3399 is emmc, then sdcard. If you screw up, as I did countless times, you need to be able to access the system on the emmc via ssh. Then you
dd if=/dev/zero of=/dev/mmcblk2 to erase the emmc and make it non-bootable. This usually works. You can also buy an EMMC to sdcard adapter and plug the emmc into your computer to erase it. The last option is erasing the first 4Mb of the emmc that contain the boot partion. I had to do this because the board booted up but couldn’t connect to the network and was unreachable via ssh. I connected the serial debug pins to an FTDI USB board, and sent the commands with PuTTY installed on a windows pc.