主要通过Docker 所以现在你手上有啥发行版就用就行了
安装 Docker
Ubuntu 系统为了安装软件速度更快,可以先更换软件源为国内软件源。
编辑文件:
sudo vim /etc/apt/sources.list
使用下面的阿里云软件源配置进行替换
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
安装 Dokcer,直接使用脚本安装即可
curl -sSL https://get.daocloud.io/docker | sh
安装 docker-compose
sudo apt install docker-compose
启动Docker
# 查看docker服务是否启动
sudo systemctl status docker
# 如果没有启动
sudo systemctl start docker
安装音乐服务器
编写 docker-compose.yml 文件,配置中使用 volumes 指定了配置文件夹 data,歌曲存放文件夹 folder
version: "3"
services:
navidrome:
image: deluan/navidrome:latest
user: 1000:1000 # should be owner of volumes
ports:
- "4533:4533"
restart: unless-stopped
environment:
# Optional: put your config options customization here. Examples:
ND_SCANSCHEDULE: 1h
ND_LOGLEVEL: info
ND_SESSIONTIMEOUT: 24h
ND_BASEURL: ""
volumes:
- "~/app/music/data:/data"
- "~/app/music/folder:/music:ro"
下载 docker 镜像,等待 navidrome 镜像下载
linux@homo:~/music $ sudo docker-compose up -d
Creating network "music_default" with the default driver
Pulling navidrome (deluan/navidrome:latest)...
latest: Pulling from deluan/navidrome
音乐上传
使用 scp 命令进行上传,需要在歌曲所在文件夹下运行
./*
表示上传当前目录所有文件。homo192.168.11.45
为服务器用户名和 IP.:/home/darcy/music/folder
为上传到的路径。
➜ folder scp ./* homo@192.168.11.45:/home/homo/music/folder
homo@192.168.11.45's password:
启动音乐服务器
先使用 sudo docker ps -a
查看 Navidrome 是否已经启动了,如果没有启动可以使用 docker start id
进行启动。服务的默认端口是 4533
浏览器访问
ip:port 即可