How Install Odoo11 on ubuntu 16.4

Farhan Rashad

Odoo version 11 is officially released now. You can find its Source Code for Community Edition from this GITHUB LINK.

Here, in this tutorial I`ll explain how to install Odoo version 11 (Community Edition) on Ubuntu 16.04, same steps can also work for previous Ubuntu version(s) till version 14.

If Python is already installed, make sure it is 3.5 or above that, previous versions are not compatible with Odoo 11

Open the terminal and execute below commands step-by-step to achieve excellence:

Step 1: 

Update apt source-lists:

sudo apt-get update

Step 2: 

Create the Odoo user that will own and run the application

sudo adduser --system --home=/opt/odoo --group odoo

Step 3: 

Install and configure the database server, PostgreSQL

sudo apt-get install -y postgresql

Once the PostgreSQL is installed, next we setup a new PostgreSQL user for our application. This user will be used for making all the database interaction form the Odoo.

sudo service postgresql start

sudo su - postgres

createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
Enter password for new role: *****
Enter it again:*****

Finally exit from the postgres user account:

exit

Step 4:(Optional)

Your Odoo server may encounter some issue(s), so I`m also mentioning few issues & their way around to fix them:

FIX 1: You need to upgrade ”wkhtmltopdf” to 0.12.1  You can also check this LINK

sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb

sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb

sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin

FIX 2: Check if your PostgreSQL have proper encoding(UTF-8) or not, used in Odoo Application, if not you can do like this:

sudo su - postgres

psql

update pg_database set encoding = pg_char_to_encoding('UTF8');

\q
exit

FIX 3: Set The Locale To UTF-8 For Python 3, if you are getting UnicodeEncodeError /UnicodeDecodeError, you can fix it,as: You can also check this LINK

Directly execute these commands:

locale-gen en_US.UTF-8

export LANG=en_US.UTF-8 LANGUAGE=en_US.en LC_ALL=en_US.UTF-8

FIX 4: In postgreSQL, allow TCP connection, if you are getting error like:

psycopg2.OperationalError: FATAL: Peer authentication failed for user

To fix it,in /etc/postgresql/9.5/main/pg_hba.conf change peer to md5:

# "local" is for Unix domain socket connections only
local     all     all     peer md5

then

sudo service postgresql restart

Step 5: 

Install the necessary Python libraries & other needed libraries needed for the application:

Odoo 11 will use python 3.5(which is pre-installed on our Ubuntu), previously it uses python 2.7, so in order to install all dependent libraries easily we`ll install pip3 in our server, as:

sudo apt-get install -y python3-pip

Once pip3 is installed on your server, we can proceed with installing other dependent libraries using pip3 as:

pip3 install Babel decorator docutils ebaysdk feedparser gevent greenlet html2text Jinja2 lxml Mako MarkupSafe mock num2words ofxparse passlib Pillow psutil psycogreen psycopg2 pydot pyparsing PyPDF2 pyserial python-dateutil python-openid pytz pyusb PyYAML qrcode reportlab requests six suds-jurko vatnumber vobject Werkzeug XlsxWriter xlwt xlrd 

Next is to install Odoo Web Dependencies:

sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less less-plugin-clean-css
sudo apt-get install -y node-less

Once all the packages are installed we are ready to proceed with installing Odoo server.

Step 6:

Installing ODOO version 11 Community Edition hosted on GITHUB.

Make sure you have GIT installed on your system and if not then install with the simple command:

sudo apt-get install -y git

Switch to the Odoo user:

sudo su - odoo -s /bin/bash

Clone the latest branch of Odoo, in our case it is 11.0 from Github:

git clone https://www.github.com/odoo/odoo --depth 1 --branch 11.0 --single-branch .

(This might take a little while depending on the speed of your Internet connection.)

Finally exit from the odoo user account:

exit

Step 7:

Next step is to create a configuration file for Odoo. But before doing so w`ll first create the directory for storing logs of Odoo server and assigning proper ownership to the directory:

sudo mkdir /var/log/odoo

sudo chown odoo:root /var/log/odoo

Next is to create the configuration file for odoo server. Odoo application will use these configuration to run so fill in the configuration as per your requirements.

sudo nano /etc/odoo-server.conf

A sample configuration file will look like this:

[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = False
db_port = False
db_user = odoo
db_password = False
logfile = /var/log/odoo/odoo-server.log
addons_path = /opt/odoo/addons,/opt/odoo/odoo/addons

(* You need to use the same password you used back in step 3.)

Once the configuration file is created we will set the ownership rights

sudo chown odoo: /etc/odoo-server.conf
sudo chmod 640 /etc/odoo-server.conf

Step 8:

Installing the boot script

For the final step we need to install a script which will be used to start-up & shut-down the Odoo server automatically, with the correct user. Here is a Link, you can use this script for the same purpose, as:

sudo nano /etc/init.d/odoo-server

Paste the same contents of this script to this file. Once it is in the right place you will need to make it executable and owned by root:

sudo chmod 755 /etc/init.d/odoo-server

sudo chown root: /etc/init.d/odoo-server

Step 9:

Testing the server

To start the Odoo server type:

sudo /etc/init.d/odoo-server start

You should now be able to view the log-file as:

tailf /var/log/odoo/odoo-server.log

If there are any problems in this step you need to go back and check, feel free to comment on this blog i`ll try my best to help you 🙂

If the log file looks OK, you can check Odoo server running on your browser with url:

http://localhost:8069

BOOT SCRIPT USAGE:

/etc/init.d/odoo-server {start|stop|restart/reload|status|force-restart|force-stop}

TIPS:

  • Using ‘status’, we can find information of all runnning odoo daemon servers.
  • Using ‘force-stop/force-restart’, we can kill all running odoo daemon forcefully, and can start fresh odoo-server daemon.
  • start/stop will not allow more than one process per daemon.

Step 10:(Optional)

Automating Odoo startup, you may want to automatically Odoo startup on server boots, if yes you can do it as:

sudo update-rc.d odoo-server defaults

You can now try rebooting you server if you like. Odoo should be running by the time you log back in.

That`s it…
Thanks for reading this blog !!! I hope it will help someone.

There are no comments for now.