erstellt am: 04 June 2020 aktualisiert am 04 June 2020

How to install navidrome under freebsd 12

Situation: You are fed up of subsonic because of license issues. You discovered airsonic. You are satisfied, but the memory consumption and unstable behavour of this Java-based solutions especially of the new versions released in 2020 drive you crazy. There is help in sight: navidrome appears in stage as a competitor. Coded in the Go language, there is a promise to be leightweigt. Lets see.


Homepage of navidrome is

Navidrome Homepage

not too much information here, but thats ok.


I use FreeBSD 12.1 on my home server wich is permanently connected to the internet and reacable via dyndns. Therefore i have to use the way: build from source Build Navidrome from source


At first there is a strong recommendation to upgrade to Golang 1.14 and Node 14. There is no Node 14 available on FreeBSD 12 at this time, so i thought to give it a try on Node12.


installed versions

[chrissie@gliese1 ~]$ uname -a
FreeBSD gliese1 12.1-RELEASE-p?????
[chrissie@gliese1 ~]$ node
Welcome to Node.js v12.16.2.
Type ".help" for more information.
> .exit
[chrissie@gliese1 ~]$ go version
go version go1.14.4 freebsd/amd64

Now lets clone the repository

[chrissie@gliese1 ~]$ git clone https://github.com/deluan/navidrome
Cloning into 'navidrome'...
[...]

Prepare the build process with make setup

[chrissie@gliese1 ~]$ cd navidrome/
[chrissie@gliese1 ~/navidrome]$ make setup
/usr/bin/go-bindata
go mod download
[...]
added 2007 packages in 100.226s

Now start the build process

[chrissie@gliese1 ~/navidrome]$ make buildall
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
\nERROR: Please upgrade your GO version\nThis project requires version 
*** Error code 1

Stop.
make: stopped in /usr/home/chrissie/navidrome

It is not working because of the different kind grep works on FreeBSD. It is used to determine installed program versions in the Makefile. Lets change that quick. Edit Makefile, and change / comment out these lines. I wish a better solution for the future.

#GO_VERSION=$(shell grep -e "^go " go.mod | cut -f 2 -d ' ')
GO_VERSION=1.14
NODE_VERSION=$(shell cat .nvmrc)
[...]
check_go_env:
        @(hash go) || (echo "\nERROR: GO environment not setup properly!\n"; exit 1)
        #@go version | grep -q $(GO_VERSION) || (echo "\nERROR: Please upgrade your GO version\nThis project requires version $(GO_VERSION)"; exit 1)
.PHONY: check_go_env

check_node_env:
        @(hash node) || (echo "\nERROR: Node environment not setup properly!\n"; exit 1)
        # @node --version | grep -q $(NODE_VERSION) || (echo "\nERROR: Please check your Node version. Should be $(NODE_VERSION)\n"; exit 1)
.PHONY: check_node_env
[...]

Give it another try:

[chrissie@gliese1 ~/navidrome]$ make buildall
> navidrome-ui@0.1.0 build /usr/home/chrissie/navidrome/ui
> react-scripts build

Creating an optimized production build...
The build folder is ready to be deployed.

Find out more about deployment here:

  bit.ly/CRA-deploy

go-bindata -fs -prefix "resources" -tags embed -ignore="\\\*.go" -pkg resources -o resources/embedded_gen.go resources/...
/bin/sh: go-bindata: not found
*** Error code 127

Meh, the go-bindata could not be found. It is a neccesary tool for the build. This is because it will be downloaded during the installing process, but the path is not set correctly. Check if the tool is here:

[chrissie@gliese1 ~]$ cd ~/go/bin
[chrissie@gliese1 ~/go/bin]$ ./go-bindata
Missing <input dir>
Usage: ./go-bindata [options] <input directories>
[...]

If this is not the case, just fetch it separately via:

cd ~
go get -u github.com/jteeuwen/go-bindata/...

Next build attempt

I now set the path, so that go-bindata can be found. (I am using bash)

[chrissie@gliese1 ~]$ cd ~/navidrome
[chrissie@gliese1 ~/navidrome]$ export PATH=$PATH:/home/chrissie/go/bin
[chrissie@gliese1 ~/navidrome]$ make buildall

> navidrome-ui@0.1.0 build /usr/home/chrissie/navidrome/ui
> react-scripts build

Creating an optimized production build...
Compiled successfully.

[...]

Yeeha!

It worked! Now lets try, if it runs.

[chrissie@gliese1 ~/navidrome]$ cd ..
[chrissie@gliese1 ~]$ mkdir nd
[chrissie@gliese1 ~]$ cp navidrome/navidrome nd
[chrissie@gliese1 ~]$ cd nd
[chrissie@gliese1 ~/nd]$ ./navidrome
 _   _             _     _
| \ | |           (_)   | |
|  \| | __ ___   ___  __| |_ __ ___  _ __ ___   ___
| . ` |/ _` \ \ / / |/ _` | '__/ _ \| '_ ` _ \ / _ \
| |\  | (_| |\ V /| | (_| | | | (_) | | | | | |  __/
\_| \_/\__,_| \_/ |_|\__,_|_|  \___/|_| |_| |_|\___|
                                        Version: dev

INFO[0000] Creating DB Schema
[...]

Wow, works correct. I now created a admin User and scanned my media directory. I used this minimal navidrome.toml config file

LogLevel = "INFO"
BaseURL = "/navidrome"
ScanInterval = "25s"
TranscodingCacheSize = "33MB"
MusicFolder = "/home/music/"

I use this BaseURL, because i made it appear on my home server with nginx using this stanzas in ngix.conf

[...]
http {
upstream navidrome {
        server 127.0.0.1:4533;
}
[...]
        server {
                listen 80 default;
[...]
# Proxy to the Navidrome server
        location /navidrome {
                alias /usr/local/www/nginx/navidrome/;
                try_files $uri @navidrome;
        }
        location @navidrome {
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_pass http://navidrome;
        }
#
[...]

The Folder /usr/local/www/nginx/navidrome/ is empty. It just has to be there.


At next i wil create a navidrome start script and move it to another location, ex. /var/navidrome. But at the Moment i start Navidrome in the Folder ~/nd within screen program


Screenshot, everything working

I am really satisfied, because it uses much less CPU and RAM as its Java competitors. There might be less features at the moment, but i dont care. They will be added in time, the author promises. As free app on iPhone i use iSub which works with subsonic, airsonic and also with navidrome.