Sunday 20 September 2015

How to Install OpenERP/Odoo 9 on Ubuntu Server 14.04 LTS. | OpenERP

Hi Guys..

First get newest versions possible as per version requirements of dependencies of packages existing on the machine using.
sudo apt-get update && sudo apt-get dist-upgrade

Create User

Create Odoo System User that will own and run the odoo application.
sudo adduser --system --home=/opt/odoo --group odoo
Here we have specified /opt/odoo as home, so when ever you change user to odoo it will by default land to /opt/odoo.
we gonna put all the odoo code under /opt/odoo. you can change the path of your choice, and do the configuration accordingly.after creating user you can login with the created user by below command.
sudo su - odoo -s /bin/bash
you can press ctrl + d or write exit and press enter to logout.

Install and Configure Postgres

sudo apt-get install postgresql
This command will install postgres 9.1 by default in ubuntu 14.04 or any debian distribution. if you want to use any specific version of postgres(i.e 9.3, 9.4) you need to update the source list. for example to install postgres-9.4 you can follow below steps.
Create the file /etc/apt/sources.list.d/pgdg.list, and add a line for the repository using vim or nano editor
deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main
Import the repository signing key, and update the package lists
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
and update the packages using
sudo apt-get update
after that you can search/install the available/supported postgres version
sudo apt-get install postgresql-9.4
After installing postgres 9.4, change to the postgres user so we have the necessary privileges to configure the database
sudo su - postgres
Now create a new database user with access to create and drop database.
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

Install the necessary libraries

sudp apt-get install python-pip python-dev libevent-dev gcc libxml2-dev libxslt-dev node-less

Note
Odoo 9 is depends on node-less
After installing this system libraries we can install python libraries using pip. Create requirement.txt file in server. create the file using below command and paste the content from this file.
sudo nano /tmp/requirement.txt
press ctrl + x and y to save & exit the file
after creating requirement.txt file it’s time to install odoo python library
sudo pip install -r /tmp/requirements.txt
After that all the dependencies for installing Odoo 9.0 are now satisfied.
for Qweb templating we need to install wkhtmltopdf. download deb file of  wkhtmltopdf 32 bit or wkhtmltopdf 64 bit.
Here We have downloaded wkhtmltopdf in /tmp directory. You can go to the download directory using cd and run the command depending on your file name.
for 64 bit:
sudo dpkg -i /tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
for 32 bit:
sudo dpkg -i /tmp/wkhtmltox-0.12.2.1_linux-trusty-i386.deb

Install the Odoo server

Install Git:
sudo apt-get install git
Switch to the Odoo user:
sudo su - odoo -s /bin/bash
Grab a copy of the most current Odoo 9(master) branch (Note the “.” at the end of this command!):
git clone https://www.github.com/odoo/odoo --depth 1 --branch 9.0 --single-branch .
–depth 1 to the command will only retrieves the latest version without all the history. The download is now quite a bit faster.
Once it’s finished exit from the odoo user using crtl+d:

Configuring the Odoo application

The default configuration file for the server is under /opt/odoo/debian/openerp-server.conf. we’ll copy that file to where we need it and change it’s ownership and permissions:
sudo cp /opt/odoo/debian/openerp-server.conf /etc/odoo-server.conf
sudo chown odoo: /etc/odoo-server.conf
sudo chmod 640 /etc/odoo-server.conf
Above commands make the file owned and writable only by the odoo user and group and only readable by odoo and root.
To allow odoo to use default addons you need to change the addons_path line in config file addons_path = /usr/lib/python2.7/dist-packages/openerp/addons in the config file to addons_path = /opt/odoo/addons.
you can also change other line as per your server deployment needs.

Installing the Init script

This script will be used to start-up and shut down the odoo server automatically and also run the application as the defined user. we will user script /opt/odoo/debian/init by doing few small modifications. Here’s a link to the one I’ve already modified for Odoo 9.
Now you need to either copy it or paste the contents of this script to a file in /etc/init.d/ and call it odoo-server. and you 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
we also need to make log file /var/log/odoo/odoo-server.log and give access rights using
create odoo directory under /var/log/
sudo mkdir /var/log/odoo
go to the directory
cd /var/log/odoo
create file
cat > odoo-server.log
give the permission to writable by the odoo user
sudo chmod 755 /var/log/odoo/odoo-server.log
sudo chown odoo:root -R /var/log/odoo/

Testing the odoo server

To start the Odoo server type:
sudo /etc/init.d/odoo-server start
You should now be able to view the log file and see that the server has started.
sudo tail -f /var/log/odoo/odoo-server.log
If the log file looks OK, now point your web browser at the domain or IP address of your Odoo server which by default use port 8069. try below in your browser
http://IP_or_domain.com:8069
for the first time you will see database manager to create your first database.
Now it’s time to make sure the server stops properly too:
sudo /etc/init.d/odoo-server stop
Check the log file again to make sure odoo has stopped properly.
sudo tail -f /var/log/odoo/odoo-server.log

Atomizing Odoo server startup

If everything working well we can do a entry of odoo-sever in update-rc.d which will automatically start & stops the odoo server along with ubuntu,
sudo update-rc.d odoo-server defaults

No comments:

Post a Comment