替代群晖音乐的工具:Navidrome

Linux下的安装

首先安装依赖,navidrome依赖ffmpeg:

1
2
3
sudo apt update
sudo apt upgrade
sudo apt install vim ffmpeg

然后创建navidrome工作的目录结构:

1
2
sudo install -d -o <user> -g <group> /opt/navidrome
sudo install -d -o <user> -g <group> /var/lib/navidrome

下载Navidrome

GitHub下载最新发布版本(用最新版的下载地址替换下面命令中的地址),解压到程序目录/opt/navidrome,赋予目录可执行权限。

1
2
3
wget https://github.com/navidrome/navidrome/releases/download/v0.XX.0/navidrome_0.XX.0_Linux_x86_64.tar.gz -O Navidrome.tar.gz
sudo tar -xvzf Navidrome.tar.gz -C /opt/navidrome/
sudo chown -R <user>:<group> /opt/navidrome

创建配置文件

In the working directory, /var/lib/navidrome create a new file named navidrome.toml with the following settings.

MusicFolder = “
For additional configuration options see the configuration options page.

1
2
3
4
5
6
7
8
9
10
LogLevel = 'DEBUG'
ScanSchedule = '@every 24h'
TranscodingCacheSize = '150MiB'
MusicFolder = '/mnt/music'
Port = '6019'
DefaultLanguage = 'zh-Hans'
EnableSharing = true
EnableTranscodingConfig = true
LastFM.Language = 'zh-Hans'
UIWelcomeMessage = 'Redtuxs Family Music Server'

创建系统服务配置文件

Create a new file under /etc/systemd/system/ named navidrome.service with the following data. Make sure you replace and with the user and group you want to run Navidrome under.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
[Unit]
Description=Navidrome Music Server and Streamer compatible with Subsonic/Airsonic
After=remote-fs.target network.target
AssertPathExists=/var/lib/navidrome

[Install]
WantedBy=multi-user.target

[Service]
User=<user>
Group=<group>
Type=simple
ExecStart=/opt/navidrome/navidrome --configfile "/var/lib/navidrome/navidrome.toml"
WorkingDirectory=/var/lib/navidrome
TimeoutStopSec=20
KillMode=process
Restart=on-failure

# See https://www.freedesktop.org/software/systemd/man/systemd.exec.html
DevicePolicy=closed
NoNewPrivileges=yes
PrivateTmp=yes
PrivateUsers=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
ReadWritePaths=/var/lib/navidrome

# You can uncomment the following line if you're not using the jukebox This
# will prevent navidrome from accessing any real (physical) devices
#PrivateDevices=yes

# You can change the following line to `strict` instead of `full` if you don't
# want navidrome to be able to write anything on your filesystem outside of
# /var/lib/navidrome.
ProtectSystem=full

# You can uncomment the following line if you don't have any media in /home/*.
# This will prevent navidrome from ever reading/writing anything there.
#ProtectHome=true

# You can customize some Navidrome config options by setting environment variables here. Ex:
#Environment=ND_BASEURL="/navidrome"

启动Navidrome服务

Reload the service daemon, start the newly create service, and verify it has started correctly.

1
2
3
4
sudo systemctl daemon-reload
sudo systemctl start navidrome.service
sudo systemctl status navidrome.service
sudo systemctl restart navidrome.service

如果服务成功启动,你就可以访问http://localhost:4533来访问web端.

让Navidrome随系统启动

1
sudo systemctl enable navidrome.service

用Nginx配置反向代理

反向代理配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
server {
listen 619 default_server;
listen [::]:619 default_server;

# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;

#root /var/www/start;

# Add index.php to the list if you are using PHP
#index index.html index.htm index.nginx-debian.html;

server_name www.redtux.cn;

client_max_body_size 50000M;

location / {
proxy_pass http://192.168.0.6:6019;

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_buffering off;
}
}

也可以Docker的方式安装,详见官方文档Navidrome官方网站开源音乐服务器,自建云端音乐播放器

客户端

Android手机可以从F-Droid直接安装Subtracks或者Ultrasonic,然后设置服务器地址就可以了。

PC可以使用Sonixd客户端,下载地址,下载对应系统的版本。

号外

其实还有一个自建音乐流媒体服务器koel——基于php fpm docker界面漂亮,唯一缺点就是手机客户端只能从Google play下载,国内只能用浏览器访问。

替代群晖音乐的工具:Navidrome

http://tux.red/2023/08/05/Nas/navidrome/

作者

redtux

发布于

2023-08-05

更新于

2023-08-05

许可协议

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

评论

You forgot to set the shortname for Disqus. Please set it in _config.yml.