Sunday 15 March 2015

Installing Odoo v8 (OpenERP) on a Raspberry Pi

I wanted to see if the little raspberryPi would work as a POS system and I came across Odoo.  There weren't any instructions available for installing Odoo on Raspbian however there are instructions for Ubuntu - see http://www.theopensourcerer.com/2014/09/how-to-install-openerp-odoo-8-on-ubuntu-server-14-04-lts/.

I also came across a script that looked like it was meant to prepare Raspbian for an Odoo install - see https://github.com/equitania/odoo-addons/blob/master/scripts/prepare-odoo-server-raspberry.sh.

Using both resources listed above, I was able to get Odoo up and running on a Raspberry Pi Model B+ and Raspberry Pi 2.  Odoo installed on the Raspberry Pi 2 is noticeably snappier than the Model B+ (obviously), but I still think you could use the Model B+ (overclocked, turbo mode) if you have a small store and just want the ability to print receipts and record sales.  

STEPS TO INSTALLING ODOO ON A RASPBERRY PI

Step 1.  Prepare your Raspbian by ensuring the latest updates are installed and installing a bunch of packages (not sure if all packages are required or not):
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install ghostscript graphviz antiword git libpq-dev poppler-utils \
 python-pip build-essential libfreetype6-dev python-dateutil python-pypdf python-requests \
 python-feedparser python-gdata python-ldap python-libxslt1 \
 python-lxml python-mako python-openid python-psycopg2 \
 python-pybabel python-pychart python-pydot python-pyparsing \
 python-reportlab python-simplejson python-tz python-vatnumber \
 python-vobject python-webdav python-werkzeug python-xlwt \
 python-yaml python-zsi python-docutils python-psutil \
 python-unittest2 python-mock python-jinja2 python-dev \
 python-pdftools python-decorator python-openssl python-babel \
 python-imaging python-reportlab-accel \
 python-paramiko python-software-properties postgresql

Install Python packages:
sudo pip install passlib beautifulsoup4 evdev reportlab qrcode polib unidecode validate_email pyDNS pyserial pyusb

I had problems installing the Node app Less as the Node.js packages available from the Raspbian are older.  The solution here is to install it manually, thanks to Nathaniel Johnson (http://node-arm.herokuapp.com/).
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb
sudo npm install -g less less-plugin-clean-css

WKHTML2PDF from the Raspbian repository is too old for Odoo - you'll need to compile Qt5 and wkhtml2pdf.  For now, I did without it knowing I will not be able to do some reports or reprint receipts.

Optional - tune postgreSQL:
sudo apt-get install pgtune
sudo pgtune -i /etc/postgresql/9.1/main/postgresql.conf -o /etc/postgresql/9.1/main/postgresql.conf.tuned
sudo mv /etc/postgresql/9.1/main/postgresql.conf  /etc/postgresql/9.1/main/postgresql.conf.old
sudo mv /etc/postgresql/9.1/main/postgresql.conf.tuned  /etc/postgresql/9.1/main/postgresql.conf
sudo /etc/init.d/postgresql restart

Step 2.  Create a new user "odoo" to run Odoo on your rpi (Raspberry Pi)
sudo adduser --system --home=/opt/odoo --group odoo

Step 3.  Configure the PostgreSQL database - create a new database user so that Odoo can connect to the database.
sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo

Exit once completed:  exit

Step 4:  Follow the rest of the guide from Step #5 and onwards at http://www.theopensourcerer.com/2014/09/how-to-install-openerp-odoo-8-on-ubuntu-server-14-04-lts/

Enjoy!

All credit goes to Odoo, equitania software, Nathaniel Johnson & www.theopensourcerer.com.