Wednesday 2 November 2016

Odoo 10 on OS X Mac EI Capitan

How to install Odoo 10 on OS X Mac EI Capitan

I work with an organization that uses odoo at the enterprise level for our enterprise relation planning - ERP. We were having problems with some odoo 9 known bugs affecting our payroll and expenses modules that were promised to be fixed in version 10.
I couldn't wait for version to try it out. 
Installing odoo on linux can be pretty straight forward unlike Mac. 
I decided to try it out on my Mac OS X before deploying on production.


Odoo on Mac Setup instruction

Prerequisite
To setup odoo on Mac OS XEl Capitan Version 10.11.5
  1. brew
I use homebrew the package manager for Mac. 
You can use macport. Although i have both on my system but i prefer to ‘brew’ the coffee.
Go to http://brew.sh and follow the instructions on how to install.

  1. Python 
Check version: python —version

  1. pip (pip —version)
sudo easy_install pip

  1. nodejs (node -v)

  1. npm (nam -v)
sudo nam install -g less less-plugin-clean-css

  1. Make sure you have the Xcode 

Install python dependencies
sudo easy_install -U setuptools

Install postgresql. 
I have postgresql installed on my system
In case you don’t have postgresql installed do the following
$ brew search postgres
$ brew install postgres<version>

Download odoo 10.
You can either clone odoo 10 from github using
git clone https://github.com/odoo/odoo.git
(my internet was always breaking so i downloaded directly)

create  a mac user. You can do that from the preference or
issue the following and restart

$ dscl . -create /Users/odoo
$ dscl . -create /Users/odoo UserShell /bin/bash
$ dscl . -create /Users/odoo RealName “Odoo”
$ dscl . -passwd /Users/odoo <yourpassword>
$ dscl . -append /Groups/admin GroupMembership odoo

$ sudo mkdir -p /opt/odoo
$ unzip odoo-10.0.zip /opt/odoo
$ sudo chown -R  odoo: /opt/odoo

It is now possible to install odoo specific dependencies
$ cd /opt/odoo/odoo-10.0/
$ sudo pip install —user -r requirements.txt

Create Odoo log file
$ sudo mkdir /var/log/odoo
$ sudo chown -R odoo:admin /var/log/odoo

Create odoo conf
$ sudo cp /opt/odoo/odoo-10.0/debian/odoo.conf /etc/odoo.conf
$ sudo chown odoo: /etc/odoo.conf
$ sudo vim /etc/odoo.conf

Copy the following into the config file

[options]
; This is the password that allows database operations:
; admin_passwd = PASSWORD
db_host = False
db_port = False
db_user = odoo
db_password = False
add ons_path = /opt/odoo/odoo-10.0/addons
;Log Settings
logfile = /var/log/odoo/odoo.log
log_level = error

Create database and database user in postgres
> sudo su - postgres
> psql
create user odoo encrypted password ‘odoo’ ;
> create database odoo owner odoo

Start Odoo
$ cd /opt/odoo/odoo-10.0
$ ./odoo-bin

Open a browser and go to http://localhost:8069

The database setup window should appear
You can enter your <database name> and password as admin
Click on "Create Database”.
Wait until you are redirected to odoo




Done.


Errors
  1. Likely library errors
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/var/root/Library/Python/2.7/lib/python/site-packages/psycopg2/_psycopg.so, 2): 
Library not loaded: libpq.5.dylib
  Referenced from: /var/root/Library/Python/2.7/lib/python/site-packages/psycopg2/_psycopg.so

Solution
(rename the problematic libraries in the /usr/lib
$ sudo mv /usr/lib/libpq.5.dylib /usr/lib/libpq.5.dylib.xx
(N:B EI Capitan now protects certain system directories in rootless mode called SIP. So in some cases you might have problem like operation not successful after the command above even if you are root.
You will have to disable rootless mode as a work around. To do this

  1. Reboot into recovery mode (reboot and hold down the CMD-R)
  2. Open a terminal from the tab menu
  3. Issue this command csrutil disable
  4. Reboot and run the above command

For all libraries that failed do the steps above and below.

Create a symbolic link with the version of the installed postgres. I have version 9.5
$ sudo ln -s /Library/PostgresSQL/9.5/lib/libpq.5.dylib /usr/lib


2.  PostgreSQL listening on a socket in /tmp.

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

Solution: 
Symlink into another to allow connection
$ sudo mkdir /var/pgsql_socket/
$ sudo chown odoo: /var/pgsql_socket
$ ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket










No comments:

Post a Comment

A hybrid Android and IOS Mobile Chat app

Project :   Development of a simple extensible chat  Technologies and Frameworks Oracle Mobile Application Framework (MAF) Oracle Java ...