Pages

Sunday, January 6, 2013

Selfmade HTPC with Slackware and XBMC

I have found some time to reinstall my HTPC with the current Slackware64 14.0 release and the current XBMC 11.0 release. As usual I installed everything from scratch and this article is a simple tutorial to install XBMC on Slackware. I like to use Slackware as base OS for XBMC because it is very slick and simple by default. In this tutorial I assume that you have a basic Slackware installation running with at least a small window environment (eg. Fluxbox). Before you can install XBMC you need a few more packages. All dependent packages are installed more or less the same way. The next lines will show you which package to install and how to install it.

Install XBMC from source

Start by creating a place where you can store the dependent packages:

# mkdir /usr/src/xbmc

Then install package by package. As mentioned before the install instructions are straight forward. The following packages are required before you can install XBMC it self. The instructions are for 32bit and 64bit:

libass:

# cd /usr/src/xbmc
# wget -c "http://libass.googlecode.com/files/libass-0.10.1.tar.xz"
# tar xf libass-0.10.1.tar.xz
# cd libass-0.10.1


For Slackware64 run:

# ./configure --prefix=/usr --libdir=/usr/lib64
...


For Slackware run:

# ./configure --prefix=/usr
...


For Slackware64 and Slackware run:

# make && make install
...


libmpeg2:

# cd /usr/src/xbmc
# wget -c "http://libmpeg2.sourceforge.net/files/libmpeg2-0.5.1.tar.gz"
# tar xf libmpeg2-0.5.1.tar.gz
# cd libmpeg2-0.5.1


For Slackware64 run:

# ./configure --prefix=/usr --libdir=/usr/lib64
...


For Slackware run:

# ./configure --prefix=/usr
...


For Slackware64 and Slackware run:

# make && make install
...


libmodplug:

# cd /usr/src/xbmc
# wget -c "http://downloads.sourceforge.net/project/modplug-xmms/libmodplug/0.8.8.4/libmodplug-0.8.8.4.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmodplug-xmms%2F&ts=1357477955&use_mirror=garr"
# tar xf libmodplug-0.8.8.4.tar.gz
# cd libmodplug-0.8.8.4


For Slackware64 run:

# ./configure --prefix=/usr --libdir=/usr/lib64
...


For Slackware run:

# ./configure --prefix=/usr
...


For Slackware64 and Slackware run:

# make && make install
...


lloyd-yajl:

# cd /usr/src/xbmc
# wget -c "https://github.com/lloyd/yajl/archive/master.zip"
# unzip master.zip
...
# cd yail-master
# mkdir build && cd build
# cmake .. -DCMAKE_INSTALL_PREFIX=/usr
...
# make && make install
...


Only for Slackware64 run:

# ln -s /usr/lib/libyajl.so.2.0.1 /usr/lib64/libyajl.so.2
# ln -s /usr/lib/libyajl.so.2.0.1 /usr/lib64/libyajl.so


libmicrohttpd:

# cd /usr/src/xbmc
# wget -c "http://mirror.checkdomain.de/gnu/libmicrohttpd/libmicrohttpd-0.9.24.tar.gz"
# tar xf libmicrohttpd-0.9.24.tar.gz
# cd libmicrohttpd-0.9.24


For Slackware64 run:

# ./configure --prefix=/usr --libdir=/usr/lib64
...


For Slackware run:

# ./configure --prefix=/usr
...


For Slackware64 and Slackware run:

# make && make install
...


If you made it this far then you can continue and install XBMC finally:

# cd /usr/src/xbmc
# wget -c "http://mirrors.xbmc.org/releases/source/xbmc-11.0.tar.gz"
# tar xf xbmc-11.0.tar.gz
# cd xbmc-11.0
# ./configure --prefix=/opt/xbmc/11.0


Depending on your optional installed package(s) you need to add different configure option. Eg. for Goom you need to enable it:

# ./configure --prefix=/opt/xbmc/11.0 --enable-goom
...


Take a closer look at the configuration output at the end and add your optional configuration options if necessary:

------------------------
  XBMC Configuration:
------------------------
  Debugging:    Yes
  Profiling:    No
  Optimization: Yes
  Crosscomp.:   No
  target ARCH:  no
  target CPU:   no
  OpenGL:       Yes
  ALSA:         Yes
  DBUS:         Yes
  VDPAU:        No
  VAAPI:        No
  CrystalHD:    No
  VDADecoder:   No
  VTBDecoder:   No
  OpenMax:      No
  Joystick:     Yes
  XRandR:       Yes
  GOOM:         No
  RSXS:         Yes
  ProjectM:     Yes
  Skin Touched: No
  X11:          Yes
  Bluray:       No
  TexturePacker:Yes
  MID Support:  No
  ccache:       Yes
  PulseAudio:   No
  HAL Support:  No
  DVDCSS:       Yes
  Avahi:        No
  Non-free:     Yes
  ASAP Codec:   No
  Webserver:    Yes
  libRTMP support:      No
  libsmbclient support: Yes
  libnfs client support:No
  libafpclient support: No
  AirPlay support:      Yes
  AirTunes support:     No
  Optical drive:        Yes
  libudev support:      Yes
  libusb support:       No
  libcec support:       No
  External FFmpeg:      No
  prefix:       /opt/xbmc/11.0


If you want more optional functions then install the optional package. When you're satisfied with the options then compile and install XBMC. Depending on your hardware this could take some time:

# make && make install
...


Check that the XBMC binaries are available:

# ls /opt/xbmc/11.0/bin/
xbmc*  xbmc-standalone*


After XBMC is installed you can test it with a first start as any user. Log in as any user and start X. Start Fluxbox as window manager. Fluxbox ist extremely lightweight and fast but any other window manager should do it too. When your window manager is running open a terminal (eg. rxvt, xterm,...) and start XBMC by typing:

$ /opt/xbmc/11.0/bin/xbmc-standalone

At this point you're finished. XBMC is up and running. If you want to autostart XBMC after system boot then continue reading. The next instructions will show you how to turn your Slackware into a more or less nice HTPC.

Autostarting XBMC after booting

Before you do anything switch to Runlevel 3 (multiuser without X):

# init 3

Then add a dedicated xbmc user:

# useradd -d /home/xbmc -g users -G audio,video,cdrom,plugdev,netdev -m -s /bin/bash -u 10000 xbmc

The above command will add the user xbmc to your system. The following options where set:

Home directory: /home/xbmc
Group: users (GID 100 Slackware default)
Additional Groups: audio,video,cdrom,plugdev,netdev
Create basic home directory structure based on /etc/skel
Shell: /bin/bash
UID: 10000
Username: xbmc

Don't forget to set a password for the newly created XBMC user:

# passwd xbmc
Changing password for xbmc
Enter the new password (minimum of 5 characters)
Please use a combination of upper and lower case letters and numbers.
New password: It'satrap!
Re-enter new password: It'satrap!
passwd: password changed.


Login as user xbmc and create the file .xinitrc:

ws01 login: xbmc
Password:
...


Then create the file .xinitrc (with a leading dot) to determine your window manager you want to use:

$ echo "exec ck-launch-session /opt/xbmc/11.0/bin/xbmc-standalone" > /home/xbmc/.xinitrc

As user xbmc run the command startx to see if X is working and to check if XBMC is starting up:

$ startx
...


When XBMC is starting up then exit it again. For starting XBMC after booting you need to define a new Runlevel. Runlevel 5 is unused in Slackware so it is perfect for using XBMC. Add the following line at the end of /etc/inittab:

# vi /etc/inittab
...
x2:5:respawn:/bin/su - xbmc -l -c "/bin/bash -login -c startx"


Save and exit vi. Every time you switch to Runlevel 5 your system will try to login as user xbmc and start XBMC. Change into Runlevel 5 to see if your settings are working:

# init 5

When XBMC is running then you can change the default Runlevel to 5, eg:

# vi /etc/inittab
...
# Default runlevel. (Do not set to 0 or 6)
id:5:initdefault:
...


Everytime you boot XBMC will start automatically.
Enjoy your self made HTPC.

Links:

http://wiki.xbmc.org/index.php?title=Installing_XBMC_for_Linux