Odoo General

How To Install Odoo 11 In Ubuntu?

May 10, 2018 · 5 minutes read

How To Install Odoo 11 In Ubuntu?

Odoo 11 is all released with much promises and functionalities, this article helps you with 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 3.5 or above. Earlier versions are not compatible with Odoo11.

Open the terminal and execute commands step-by-step to achieve the desired result.

Step 1:

Update apt source-lists:
sudo apt-get update

Step 2:

Create Odoo user to 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, in next set up a new PostgreSQL user for the application. This user will be used for making all the database interaction within Odoo.
sudo service PostgreSQL start

sudo su – postgres
createuser –createdb –username postgres –no-createrole –no-superuser –pwprompt odoo
Enter a 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). In order to fix them;
FIX 1: You need to upgrade ”wkhtmltopdf” to 0.12.1

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 has a 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 Unicode Encode Error /Unicode Decode Error, you can fix it as Directly executing 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 an 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 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 we’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.
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
/etc/init.d/odoo-server {start|stop|restart/reload|status|force-restart|force-stop}

TIPS:

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

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *