XBMC standalone on Debian Wheezy/Jessie

This is partially based on http://www.nicht-blau.de/2011/01/16/howto-xbmc-media-center-unter-linux-arch-und-debian/.

First install Debian, preferably including System Tools and SSH, but without desktop environment. After installation install a minimal X server:

apt-get install xserver-xorg-core xinit
dpkg-reconfigure x11-common # and allow Anybody

Disable grubs timeout by setting GRUB_TIMEOUT=0 in /etc/default/grub. After that run update-grub.

If you have an Nvidia GPU, install the proprietary Nvidia drivers. For that, add contrib non-free to the following lines in /etc/apt/sources.list.

deb http://ftp.de.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.de.debian.org/debian/ wheezy main contrib non-free

and install the driver:

apt-get install nvidia-kernel-dkms nvidia-xconfig
nvidia-xconfig

(Answer Yes in the dialogs.)

Reboot the machine.

Install xbmc and alsa:

apt-get install xbmc xbmc-standalone alsa-utils

Create a user for XBMC and add it to some groups:

useradd -m -c xbmc –s /bin/bash xbmc 
usermod -aG audio,disk,video xbmc

Create /home/xbmc/.xinitrc with the following content

#!/bin/bash 
exec /usr/bin/xbmc –standalone

Make it executable:

chmod +x /home/xbmc/.xinitrc

Edit /etc/rc.local and add:

su -c "/usr/bin/startx" xbmc

For HDMI audio a few more tweaks need to be done. Use aplay -l to find out the card and the device of your sound card (in my case 0 and 3). Then, edit /usr/share/alsa/alsa.conf for

defaults.ctl.card 0
defaults.pcm.card 0
defaults.pcm.device 3

Reboot the machine again. That shoult be it.

1