【2023.01.29】LXC、Linux、Jellyfin挂载SMB,开机自动挂载SMB(N5105为例)

挂载SMB

在LXC内

apt-get install cifs-utils
apt install samba
apt install samba-client
mkdir /mnt/share

尝试登陆

smbclient -L NAS的IP/或者群晖的名字 -U 用户名

挂载命令

mount -o username=账号,password=密码 //192.168.1.222/Video /mnt/share

具体见Linux系统挂载SMB文件系统 (aliyun.com)

然后打开目录就可以看见文件

image-20230118141526014

也可以使用df -h的命令进行检查

然后设置为开机自动挂载

nano /etc/fstab

加入

//192.168.1.222/Video /mnt/share cifs defaults,username=账号,password=密码

然后reboot后用df -h查看

image-20230118142815843

挂载成功

安装Jellyfin

安装docker

apt install curl -y
curl -sSL https://get.docker.com/ | sh

安装portainer

docker run -d -p 9000:9000 \
    --restart=always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    --name prtainer \
    portainer/portainer

进入portainer,安装N大的jellyfin

nyanmisaka/jellyfin:latest

image-20230118144352843

image-20230118144439632

image-20230118144619580

添加驱动/dev/dri

image-20230118144724481

然后部署

image-20230118144752398

等待一段时间

配置jellyfin

image-20230118150341153

image-20230118150409166

image-20230118150720350

选择目录,可以看到我们的SMB

image-20230118150507754

image-20230118150649988

image-20230118150818017

image-20230118151726610

image-20230118151757747

拉到最下面,保存

脚本

在LXC机器内

cat>>/etc/systemd/system/rc-local.service<<EOF

输入,然后回车

[Unit]
Description=/etc/rc.local
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty

RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
EOF

输入开机运行

systemctl enable rc-local.service

输入

cat <<EOF >/etc/rc.local

输入并回车

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
chmod 777 /dev/dri/*
sleep 30
systemctl restart docker
exit 0
EOF

赋权

chmod +x /etc/rc.local

然后reboot后

查看权限

ls -l /dev/dri

image-20230118152535137

全部显示,说明成功了

posted @ 2023-01-29 17:30  Mokou  阅读(4470)  评论(1编辑  收藏  举报