This "how to" guide is specifically for Ubuntu 11.10, however it may work for other versions too.
Let me add that my current XBMC box is Ubuntu 10.04, I followed the guide as below to install Maraschino on it, only to see failures. After much messing around , trail and error I found that on 10.04 Apparmor was hosing Maraschino. Specifically it was preventing Apache from creating the sock file for WSGI applications.
Since my XBMC box is not on a public network, and my cats haven't quite figured out how to hack it, I just removed Apparmor and life is good.
Code:
xbmc-user@ubuntu:~$ sudo apt-get remove apparmor
Maraschino “how to” for Ubuntu 11.10
Prerequisites
- Apache
- Python
- mod_WSGI
- Python Setup Tools
- Git
- Flask
- jsonrpclib
- A working install of pre-Eden XBMC either on the Ubuntu install or on another computer
Get up to date before starting
Open a terminal session or use the update-manager and get your system up to date before proceeding.
Code:
xbmc-user@ubuntu:~$ sudo apt-get update
After the update is complete reboot the system.
Install the prerequisites
Code:
xbmc-user@ubuntu:~$ sudo apt-get install apache2 libapache2-mod-wsgi python python-setuptools git
xbmc-user@ubuntu:~$ sudo easy_install Flask
xbmc-user@ubuntu:~$ sudo easy_install jsonrpclib
Get Maraschino
http://www.maraschinoproject.com/
Open a terminal and clone Maraschino to your www directories.
Code:
xbmc-user@ubuntu:~$ sudo git clone https://github.com/mrkipling/maraschino /var/www/maraschino
Lets get ownership right.
Code:
xbmc-user@ubuntu:~$ sudo chown -R www-data /var/www/
Get it configured
Use your favorite text editor to make the settings.py file per the directions at
http://www.maraschinoproject.com/
Now we need to create the WSGI file, I am using gedit in the example.
Code:
xbmc-user@ubuntu:~$ sudo gedit /var/www/maraschino/maraschino.wsgi
Here is my maraschino.wsgi file
Code:
import sys
sys.path.insert(0, "/var/www/maraschino")
from htpcfrontend import app as application
Note currently the main Python file is still called by the old project name htpcfrontend.py this is likely to change at some point to maraschino.py
Now lets setup Apache
We will be replacing the default Apache site with the maraschino site.
Code:
xbmc-user@ubuntu:~$ sudo gedit /etc/apache2/sites-available/default
Here is my default file, note that I replaced the existing config with mine.
Note I have a local account and group called “xbmc-user” that I created during the Ubuntu install. So below use your regular username/groupname in the default file
Code:
<VirtualHost *>
WSGIDaemonProcess maraschino user=xbmc-user group=xbmc-user threads=5
WSGIScriptAlias / /var/www/maraschino/maraschino.wsgi
<Directory /var/www/maraschino>
WSGIProcessGroup maraschino
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Start Apache
Code:
xbmc-user@ubuntu:~$ sudo apache2ctl start
Everything is setup time to test it out.
Open a web browser and point it to
http://your_ubuntu_IP_address/
Trouble Shooting
The Apache logs are your friend, use them. I like to “tail” then so I can see real time what is happening.
Open a terminal and tail the Apache error log
Code:
xbmc-user@ubuntu:~$ sudo tail -f /var/log/apache/error.log
Open another terminal and restart Apache and look for errors.
Code:
xbmc-user@ubuntu:~$ sudo apache2ctl restart
Access the site with your browser and look for errors.
More times than not you missed spelled something in either the /var/www/maraschino/maraschino.wsgi file or the /etc/apache2/sites-available/default file.
As of the writting of this “how to” the main Python script is still named htpcfrontend.py this is likely to change to maraschino.py at some point.