0%

All in one小主机--Debian下安装kodi

前言:

kodi官方的版本只支持Ubuntu,之前用Debian仓库的版本又不能硬件解码。时隔1年kodi发布了19版本,我也找到了在Debian下真正好用的kodi了。

果断抛弃了Ubuntu Server 转投PVE的怀抱。虚拟机才是All in one最终的归宿。

安装kodi

这里 是一位外国友人维护的Kodi from Debian - Nightly Repository。基本上安装上面的步骤走就可以了。

在PVE系统里面,直接是root登录,所以就不需要用sudo。

  • Install Vasyl Gello’s signing key:
1
2
3
apt-get update
apt-get install ca-certificates curl gnupg sudo
curl 'https://basilgello.github.io/kodi-nightly-debian-repo/repository-key.asc' | apt-key add -

buster-backports源之前已经添加过了,不需要重复添加。

  • Add ‘buster-backports’ repositories to APT configuration:

  • Add the repository to APT configuration:

1
echo "deb https://basilgello.github.io/kodi-nightly-debian-repo buster-backports main" | tee /etc/apt/sources.list.d/kodi-nightly-debian-repo.list
  • Pin Kodi to the unofficial repository to ensure automatic updates:
1
2
3
4
5
6
7
echo 'Package: *' | sudo tee /etc/apt/preferences.d/01kodi-nightly-debian-repo
echo 'Pin: release l=kodi-nightly-debian-repo' | sudo tee -a /etc/apt/preferences.d/01kodi-nightly-debian-repo
echo 'Pin-Priority: 1' | sudo tee -a /etc/apt/preferences.d/01kodi-nightly-debian-repo
echo '' | sudo tee -a /etc/apt/preferences.d/01kodi-nightly-debian-repo
echo 'Package: kodi*' | sudo tee -a /etc/apt/preferences.d/01kodi-nightly-debian-repo
echo 'Pin: release l=kodi-nightly-debian-repo' | sudo tee -a /etc/apt/preferences.d/01kodi-nightly-debian-repo
echo 'Pin-Priority: 500' | sudo tee -a /etc/apt/preferences.d/01kodi-nightly-debian-repo
  • Update the package lists and install Kodi:
1
2
apt-get update
apt-get install --install-recommends -t buster-backports kodi kodi-pvr-iptvsimple

安装kodi为服务

和Ubuntu Server一样,安装驱动、x框架等kodi的依赖。

1
2
3
4
5
6
apt-get update
apt-get install ssh software-properties-common xorg xserver-xorg-legacy \
alsa-utils mesa-utils git-core librtmp1 libmad0 lm-sensors libmpeg2-4 \
avahi-daemon libva2 vainfo i965-va-driver dbus-x11 samba \
pastebinit xserver-xorg-video-intel
apt-get upgrade

编辑/etc/X11/Xwrapper.config 允许anybody启动Xserver,值得注意的是,在Debian里面还需要needs_root_rights=yes

1
2
allowed_users=anybody
needs_root_rights=yes

后面就和Ubuntu Server的步骤是一样的。

添加kodi为服务,实现开机启动。编辑/etc/systemd/system/kodi.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[Unit]
Description = kodi-standalone using xinit
After = remote-fs.target systemd-user-sessions.service mysql.service

[Service]
User = kodi
Group = kodi
Type = simple
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch /usr/bin/kodi-standalone -- :0 -nolisten tcp
Restart = always
RestartSec = 30

[Install]
WantedBy = multi-user.target

开机自动启动kodi

1
2
systemctl daemon-reload
systemctl enable kodi

新建kodi用户,并添加权限

1
2
adduser kodi
usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input kodi

kodi的配置文件

kodi的配置文件是存放在个人home目录下的一个叫.kodi的目录里面,只要把整个目录备份了恢复出来kodi就是之前的模样,还是挺方便的。

1
2
3
4
5
su kodi
cd /homt/kodi/.kodi
##恢复整个.kodi目录##
exit
cd

编译遥控器驱动

区别就是需要安装pve的内核头文件pve-headersgawk

1
2
3
4
5
6
apt install build-essential pve-headers gawk
wget http://rtr.ca/sapphire_remote/sapphire-7.4.tar.gz
tar xvf sapphire-7.4.tar.gz
cd sapphire-7.4
make
make install

编辑文件/etc/systemd/system/sapphire.service

1
2
3
4
5
6
7
8
9
10
11
[Unit]
Description=Sapphire remote start script
Before=kodi.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/sapphire_startup.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

恢复此前备份的/etc/sapphire.keymap文件

开机启动sapphire keymap

1
2
3
systemctl daemon-reload
systemctl enable sapphire
systemctl start sapphire

Enjoy !!

参考: