家用服务器,我家路由器下挂载的服务,家庭影院+音乐服务器
内容纲要

使用PVE 安装在家中电脑,做个服务器搞点好玩的

pve 挂载多硬盘

硬盘挂载/格式化,参考教程

# 查看硬盘,hdd 和 ssd 有些插口不一样的。
ls /dev/sd*    # 查看emmmm 我这台服务器的机械硬盘
ls /dev/nvme*   # 查看我这台服务器的固态硬盘。  同是也去PVE 服务器端查看硬盘名字

# 查看过的硬盘进行删除分区 
#root@pve:~# ls /dev/nvme*
#/dev/nvme0  /dev/nvme0n1  /dev/nvme1  /dev/nvme1n1  /dev/nvme1n1p1  /dev/nvme1n1p2  /dev/nvme1n1p3

fdisk /dev/nvme0np?  #最后一个符号是删除分区的。 最后p? 代表p1 p2 p3 等等,这些都是分区

# Command (m for help):  # 这里输入命令, d 是删除分区,  n 是新建分区, w 是退出并保存,p 列出分区表, q 不保存退出,t 改变分区类型,。。。。。还有很多。。
这里使用 d 删除不要的分区 
然后  w 保存并退出
fdisk /dev/nvme0n1

输入n 创建新的分区 (基本上参数选择默认,我这里全给,然后整块硬盘只做一个分区)

# 格式化刚刚n 创建的分区
mkfs -t ext4 /dev/nvme0n1p1 

# 创建硬盘挂载点 
mkdir /mnt/nvme0n1p1

# 将硬盘信息写入 系统挂载点 /etc/fstab;
echo /dev/nvme0n1p1 /mnt/nvme0n1p1 ext4 defaults 1 2 >> /etc/fstab

# 之后在 https://10.10.10.10:8006/ 的pve 中的`存储`添加目录进去
记得勾选全部哦。

 #小心配置失败 无法启动,也不过也有解决办法

安装 Jellyfin 、samba 服务器。并制作一个电影、视频存放点

  • TIP: ubuntu 安装的时候不要勾选 Set up this disk as an LVM group

    因为勾选了之后你的磁盘空间会少一半。我比较喜欢直接分出来。

ubuntu 更换软件源

cat /etc/issue   # 查看当前系统是哪个版本

# https://releases.ubuntu.com/  在该网址找到你ubuntu 对应的内核代号 这里是20.04.6(Focal Fossa)

# https://developer.aliyun.com/mirror/ubuntu   在阿里云官网找到对应的镜像源地址

# vim /etc/apt/sources.list      # 更换软件源
deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

ubuntu 安装jellyfin 服务

  • B站笔记文档
视频内容如与本文件冲突,以本文件为准
mkdir -p /hdd/{电影,剧集}

---------------------【debian/ubuntu直接运行jellyfin】---------------------
#安装jellyfin
apt update
apt install curl gnupg
curl -fsSL https://repo.jellyfin.org/ubuntu/jellyfin_team.gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/jellyfin.gpg
echo "deb [arch=$( dpkg --print-architecture )] https://repo.jellyfin.org/$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release ) $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) main" | sudo tee /etc/apt/sources.list.d/jellyfin.list
apt update
apt install jellyfin
#获取OpenDouban的dll插件和字体
#插件来自:https://github.com/caryyu/jellyfin-plugin-opendouban
#在config目录新建Jellyfin.Plugin.OpenDouban文件夹
mkdir /var/lib/jellyfin/plugins/Jellyfin.Plugin.OpenDouban
#上传Jellyfin.Plugin.OpenDouban.dll
cd /var/lib/jellyfin/plugins/Jellyfin.Plugin.OpenDouban
#上传字体
cd /var/lib/jellyfin/
#回到家目录
cd
#设置权限
chmod 777 -R /var/lib/jellyfin/
#重启jellyfin服务
systemctl restart jellyfin
#设定备用字体

---------------------【debian/ubuntu用docker运行jellyfin】---------------------
#安装docker
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
#创建jellyfin需要的目录
mkdir -p /jellyfin/{config,cache}
#拉取并启动jellyfin
docker run -d \
 --restart=always \
 --net=host \
 -v /jellyfin/config:/config \
 -v /jellyfin/cache:/cache \
 -v /hdd/电影:/media1 \
 -v /hdd/剧集:/media2 \
 --restart=unless-stopped \
 nyanmisaka/jellyfin:latest

#上一条命令如果提示no matching manifest for xxxxxx in the manifest list entries
#则把nyanmisaka换成linuxserver或jellyfin
#获取OpenDouban的dll插件和字体
#插件来自:https://github.com/caryyu/jellyfin-plugin-opendouban
#在config目录新建Jellyfin.Plugin.OpenDouban文件夹
mkdir /jellyfin/config/plugins/Jellyfin.Plugin.OpenDouban
#上传Jellyfin.Plugin.OpenDouban.dll
cd /jellyfin/config/plugins/Jellyfin.Plugin.OpenDouban
#在config目录上传字体
cd /jellyfin/config
#回到家目录
cd
#重启jellyfin容器
docker container ls
docker restart ID
#设置备用字幕

注:如果是linuxserver的jellyfin,则新建Jellyfin.Plugin.OpenDouban文件夹的命令为:
mkdir /jellyfin/config/data/plugins/Jellyfin.Plugin.OpenDouban
cd /jellyfin/config/data/plugins/Jellyfin.Plugin.OpenDouban
#然后上传dll插件
#还需要设置权限
chmod 777 -R /jellyfin/

---------------------【群晖用docker运行jellyfin】---------------------
nyanmisaka/jellyfin
#获取OpenDouban的dll插件和字体
#插件来自:https://github.com/caryyu/jellyfin-plugin-opendouban
#在config目录新建Jellyfin.Plugin.OpenDouban文件夹
#在Jellyfin.Plugin.OpenDouban文件夹上传Jellyfin.Plugin.OpenDouban.dll
#在config目录上传字体
#重启jellyfin容器
#设置备用字幕

---------------------【x86 debian/ubuntu用docker运行opendouban服务端】---------------------
#来自:https://github.com/caryyu/douban-openapi-server
#安装docker
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
#拉取并启动服务端
docker container run -d --restart=always -p 5000:5000 caryyu/douban-openapi-server:latest

---------------------【x86 群晖用docker运行opendouban服务端】---------------------
caryyu/douban-openapi-server
#ssh登录后
sudo su -
#输入密码
docker container run -d -p 5005:5000 caryyu/douban-openapi-server:latest --restart=always

---------------------【debian/ubuntu直接运行opendouban服务端】---------------------
--------------------------------【本部分请看新视频】-------------------------------
--------【注意:如使用本方法安装服务端,jelleyfin和服务端须处于同一设备上】--------
#更新软件源
apt update
#安装python
apt install python3 python-is-python3 python3-pip vim unzip git -y
#拉取源码
git clone https://github.com/caryyu/douban-openapi-server
#编辑依赖列表文件
vi douban-openapi-server/requirement.txt
aniso8601==9.0.1
attrs==21.2.0
beautifulsoup4==4.9.3
certifi==2021.5.30
charset-normalizer==2.0.4
click==8.0.1
dnspython==1.16.0
eventlet==0.31.1
flasgger==0.9.5
flask==1.1.2
flask-caching==1.10.1
flask-cors==3.0.10
flask-restful==0.3.9
gevent==21.8.0
greenlet==1.1.1
gunicorn==20.1.0
idna==3.2
itsdangerous==2.0.1
jinja2==3.0.1
jsonschema==3.2.0
markupsafe==2.0.1
mistune==0.8.4
pyrsistent==0.18.0
pytz==2021.1
pyyaml==5.4.1
requests==2.26.0
selenium==3.141.0
six==1.16.0
soupsieve==2.2.1
urllib3==1.26.6
werkzeug==2.0.1
zope.event==4.5.0
zope.interface==5.4.0
autopep8==1.5.7
pycodestyle==2.7.0
toml==0.10.2

#安装依赖
pip3 install -r douban-openapi-server/requirement.txt

#使用【cat /etc/rc.local】命令查看是否存在/etc/rc.local,如果不存在则先运行这个部分的6行代码,如果存在则跳过这个部分的6行代码
ln -fs /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service
echo '[Install]' >> /etc/systemd/system/rc-local.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/rc-local.service
echo 'Alias=rc-local.service' >> /etc/systemd/system/rc-local.service
touch /etc/rc.local
chmod +x /etc/rc.local

#使用【vi /etc/rc.local】命令,在rc.local里添加以下内容。如果在此之前已经存在rc.local,则忽略第一行【#!/bin/sh】,把剩下4行插入到第二行

#!/bin/sh
export FLASK_APP=app.py
export FLASK_ENV=development
export FLASK_DEBUG=0
cd /root/douban-openapi-server && flask run &

#重启设备
reboot

#检查服务端是否正常启动
netstat -anp | grep 5000

参考地址 知乎

最终文档

sudo apt update

sudo apt install wget apt-transport-https gnupg2 software-properties-common

echo "deb [arch=$( dpkg --print-architecture )] https://repo.jellyfin.org/ubuntu $( lsb_release -c -s ) main" | sudo tee /etc/apt/sources.list.d/jellyfin.list

sudo curl -L https://repo.jellyfin.org/ubuntu/jellyfin_team.gpg.key | sudo apt-key add -

sudo apt update

sudo apt install jellyfin  # 如果报错,就输入 sudo apt-get update (我反正是这么解决的。。。)

sudo systemctl start jellyfin
sudo systemctl enable jellyfin

访问: 10.10.10.11:8096

安装豆瓣OpenDouban 插削 插件

最终我使用GitHub给的docker 安装方法。
https://github.com/caryyu/jellyfin-plugin-opendouban

docker 安装

https://github.com/caryyu/douban-openapi-server

# docker 执行安装命令  就这一行就够了 
docker run --rm -d -p 5000:5000 caryyu/douban-openapi-server:latest  
# 最好去掉 --rm  保证它退出不会删掉容器   --restart=always 保证重启它还会自动启动
docker run -d --restart=always -p 5000:5000 caryyu/douban-openapi-server:latest
  • 下方配置我并没有使用,因为flask run 启动不了。估计是环境的问题
mkdir /var/lib/jellyfin/plugins/Jellyfin.Plugin.OpenDouban

cd /var/lib/jellyfin/plugins/Jellyfin.Plugin.OpenDouban
上传Jellyfin.Plugin.OpenDouban.dll  # github 的官网下载就行
# 目前 dll 下载地址https://github.com/caryyu/jellyfin-plugin-repo/raw/master/Jellyfin.Plugin.OpenDouban.2.0.4.zip

# 上传Jellyfin.Plugin.OpenDouban.dll 到
# /var/lib/jellyfin/plugins/Jellyfin.Plugin.OpenDouban文件夹下

cd /var/lib/jellyfin/

# 上传TTF 字体文件到 /var/lib/jellyfin 目录中
TTF 文件 在系统C:/Windows/Fonts 中有

chmod 777 -R /var/lib/jellyfin/plugins  # 给足权限

systemctl restart jellyfin
systemctl status jellyfin  # 此时可以看到中文字的状态`更新插件`

ubuntu 安装samba 服务并给win10 做文件共享

参考配置文档

# 安装服务
sudo apt-get install samba samba-common

# 设置共享文件夹
mkdir /video

chmod 777 -R /video

root@v:~# vim /etc/samba/smb.conf

# 编写配置文件 实现匿名访问
[share]
path = /cby/smb
public = yes
read only = no
guest ok = Yes
create mask = 0644
force create mode = 0644
directory mask = 0755
force directory mode = 0755
available = yes

# 完整配置如下
root@v:~# vim /etc/samba/smb.conf
root@v:~# cat /etc/samba/smb.conf
#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which 
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
#  - When such options are commented with ";", the proposed setting
#    differs from the default Samba behaviour
#  - When commented with "#", the proposed setting is the default
#    behaviour of Samba but the option is considered important
#    enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic 
# errors. 

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP

#### Networking ####

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
;   interfaces = 127.0.0.0/8 eth0

# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself.  However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
;   bind interfaces only = yes

#### Debugging/Accounting ####

# This tells Samba to use a separate log file for each machine
# that connects
   log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
   max log size = 1000

# We want Samba to only log to /var/log/samba/log.{smbd,nmbd}.
# Append syslog@1 if you want important messages to be sent to syslog too.
   logging = file

# Do something sensible when Samba crashes: mail the admin a backtrace
   panic action = /usr/share/samba/panic-action %d

####### Authentication #######

# Server role. Defines in which mode Samba will operate. Possible
# values are "standalone server", "member server", "classic primary
# domain controller", "classic backup domain controller", "active
# directory domain controller". 
#
# Most people will want "standalone server" or "member server".
# Running as "active directory domain controller" will require first
# running "samba-tool domain provision" to wipe databases and create a
# new domain.
   server role = standalone server

   obey pam restrictions = yes

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
   unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
   pam password change = yes

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
   map to guest = bad user

########## Domains ###########

#
# The following settings only takes effect if 'server role = classic
# primary domain controller', 'server role = classic backup domain controller'
# or 'domain logons' is set 
#

# It specifies the location of the user's
# profile directory from the client point of view) The following
# required a [profiles] share to be setup on the samba server (see
# below)
;   logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
#   logon path = \\%N\%U\profile

# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
;   logon drive = H:
#   logon home = \\%N\%U

# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
;   logon script = logon.cmd

# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe.  The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

# This allows machine accounts to be created on the domain controller via the 
# SAMR RPC pipe.  
# The following assumes a "machines" group exists on the system
; add machine script  = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u

# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.  
; add group script = /usr/sbin/addgroup --force-badname %g

############ Misc ############

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
;   include = /home/samba/etc/smb.conf.%m

# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
;   idmap config * :              backend = tdb
;   idmap config * :              range   = 3000-7999
;   idmap config YOURDOMAINHERE : backend = tdb
;   idmap config YOURDOMAINHERE : range   = 100000-999999
;   template shell = /bin/bash

# Setup usershare options to enable non-root users to share folders
# with the net usershare command.

# Maximum number of usershare. 0 means that usershare is disabled.
#   usershare max shares = 100

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
   usershare allow guests = yes

#======================= Share Definitions =======================

[homes]
   comment = Home Directories
   browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = yes

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
   create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
   directory mask = 0700

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# The following parameter makes sure that only "username" can connect
# to \\server\username
# This might need tweaking when using external authentication schemes
   valid users = %S

# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
;   comment = Network Logon Service
;   path = /home/samba/netlogon
;   guest ok = yes
;   read only = yes

# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
;   comment = Users profiles
;   path = /home/samba/profiles
;   guest ok = no
;   browseable = no
;   create mask = 0600
;   directory mask = 0700

[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
;   write list = root, @lpadmin

[share]
path = /cby/smb
public = yes
read only = no
guest ok = Yes
create mask = 0644
force create mode = 0644
directory mask = 0755
force directory mode = 0755
available = yes
root@v:~# 

root@v:~# systemctl restart smbd
root@v:~# 

 Win10专业版安装密钥:VK7JG-NPHTM-C97JM-9MPGT-3V66T

安装音乐服务器

#先装docker
https://cloud.tencent.com/developer/article/2224862?areaSource=102001.13&traceId=DHcZ9qrZ30NdNmaEay1Zg

# 

docker run -d \
   --name navidrome \
   --restart=unless-stopped \
   --user $(id -u):$(id -g) \
   -v /mnt/sdb1/navidrome-music:/music \
   -v /home/navidrome/navidrom-data:/data \
   -p 4533:4533 \
   -e ND_LOGLEVEL=info \
   deluan/navidrome:latest

新东西

// 安装rz
apt-get install lrzsz

// 上传文件
rz
# 然后选择文件就行。贼方便
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇