缘由:
疫情期间在家闲来无事,因为电视机无法直接播放4K影片在家萌生通过docker搭建jellyfin的想法,因为jellyfin能在服务器上面对视频硬解码。
废话不多说,献上安装步骤。
1 开启root密码
sudo passwd root
2 更新apt
sudo apt-get update
3 安装ssh
查看是否开启了ssh服务是否安装,使用命令:
sudo ps -e |grep ssh
4 安装ssh服务
sudo apt-get install openssh-server
5 查看服务
sudo ps -e | grep ssh
6 防火墙允许
sudo ufw allow 22
7 docker 安装
7.1 安装包允许apt通过HTTPS使用仓库
sudo dpkg --configure -a
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
7.2 添加Docker官方GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
7.3 Docker稳定版仓库
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
7.4 更新apt源索引
sudo apt-get update
7.5 安装最新版本Docker CE(社区版)
sudo apt-get install docker-ce
7.6 查看安装Docker的版本
docker --version
版本为 Docker version 19.03.6, build 369ce74a3c
7.7 查看docker是否安装正确
sudo docker run hello-world
/**
如果正常的话将会显示如下的信息
*/
1b930d010525: Pull complete
Digest: sha256:fc6a51919cfeb2e6763f62b6d9e8815acbf7cd2e476ea353743570610737b752
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
docker 基本命令
sudo service docker start
sudo service docker stop
sudo service docker restart
docker image ls
docker image pull library/hello-world
docker image rm 镜像id/镜像ID
docker run [选项参数] 镜像名 [命令]
docker container stop 容器名或容器id
docker container start 容器名或容器id
docker container kill 容器名或容器id
docker container rm 容器名或容器id
8 Jellyfin媒体服务器docker服务
8.1 更改docker镜像拉取源
修改Docker的配置文件来设置加速地址
vim /etc/docker/daemon.json
{
“registry-mirrors”: [“https://br10hqrl.mirror.aliyuncs.com”]
}
如果没有该文件,新建一个
也可以通过以下命来设置
tee /etc/docker/daemon.json <<-‘EOF’
{
“registry-mirrors”: [“https://br10hqrl.mirror.aliyuncs.com”]
}
EOF
systemctl daemon-reload && systemctl restart docker //让配置生效
8.2 拉取最新的jellyfin服务
docker pull jellyfin/jellyfin:nightly
8.3 允许docker 端口
sudo ufw allow 8096
8.4 创建 jellyfin 容器
docker run -d -p 8096:8096 -v /jellyfin/config:/config -v /media/video:/media jellyfin/jellyfin:nightly
8.5 挂载samba
mount -t cifs -o rw,username=Jellyfin,password=123456,vers=2.0 //192.168.88.210/movie /media/video
8.6 重启docker 容器
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ebf81ff5469b jellyfin/jellyfin:nightly “./jellyfin/jellyfin…” 2 minutes ago Up 2 minutes 0.0.0.0:8096->8096/tcp elegant_ramanujan
docker restart elegant_ramanujan //重启容器
8.7 进入容器
docker exec -it ebf81ff5469b /bin/bash
完毕