Odoo V8 Installation

Post on 17-Jul-2015

1,568 views 4 download

Tags:

transcript

www.emiprotechnologies.com info@emiprotechnologies.com

Odoo V8 : Easy installation within few minutes

www.emiprotechnologies.com info@emiprotechnologies.com

What is in for you in this presentation ?

After following this presentation you will be able to learn,

● Set up Odoo properly.

● Start Odoo in secure ssl mode.

● Redirect IP to domain in order to access Odoo from domain name.

● How to store attachments over physical place in server.

● Know the useful tips to maintain Odoo very well.

www.emiprotechnologies.com info@emiprotechnologies.com

Pre-install Instructions

We will see Odoo V8 installation just after purchasing blank server on cloud.

Platform Ubuntu : 12.04

We have marked some slides as “optional” so those settings might not be necessary if there is need of only basic installation.

www.emiprotechnologies.com info@emiprotechnologies.com

Pre-install Instructions

It is advisable that you run following two commands, after loading new server.

● sudo apt-get update● sudo apt-get upgrade

www.emiprotechnologies.com info@emiprotechnologies.com

Install PostgreSQL database● sudo apt-get install postgresql

Create database user● sudo su postgres

● createuser -s odoo (This user shall be super user)

Set password for database user● psql template1

● alter user odoo with password 'odoo';

Setting complex password for database user is advisable.

www.emiprotechnologies.com info@emiprotechnologies.com

Setup pg_hba.conf

● vi /etc/postgresql/9.1/main/pg_hba.conf

Add following line in vi editor:

● local all odoo md5

Do not forget to restart PostgresSQL database server, after this change

/etc/init.d/postgresql restart

www.emiprotechnologies.com info@emiprotechnologies.com

Required Packages needs to be install prior to set up Odoo.

sudo apt-get install python-dateutil 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 wget python-unittest2 python-mock python-jinja2 python-dev libpq-dev poppler-utils python-pdftools antiword python-setuptools python-pybabel python-decorator python-requests python-pyPdf python-passlib

www.emiprotechnologies.com info@emiprotechnologies.com

odoo

opt

conf logbackup filestoreodoo custom_addons

Standard Directory Structure

www.emiprotechnologies.com info@emiprotechnologies.com

Add system user ● sudo adduser --system --home=/opt/odoo --group odoo● sudo su - odoo -s /bin/bash● When this command is executed, you will be in odoo’s home

directory: /opt/odoo

Install git & clone V8 branch● sudo apt-get install git

● Goto odoo folder in /opt directory

● sudo git clone https://github.com/odoo/odoo.git -b 8.0

www.emiprotechnologies.com info@emiprotechnologies.com

Install git & clone V8 branch

● By cloning odoo from github there will be one folder created with all necessary files in /opt/odoo/odoo folder.

www.emiprotechnologies.com info@emiprotechnologies.com

Create backup directory.

● Create a backup folder under /opt/odoo/backup

It is advisable that to keep database backup of your live server in this folder.

● Backup file format shall be dbname_dd_mm_yyyy.sql

www.emiprotechnologies.com info@emiprotechnologies.com

Create configuration file for Odoo.

● mkdir /opt/odoo/conf

● sudo cp /opt/odoo/odoo/debian/openerp-server.conf /opt/odoo/conf/odoo_server.conf

● sudo chown odoo.odoo /opt/odoo/conf/odoo_server.conf

● sudo chmod 777 /opt/odoo/conf/odoo_server.conf

● Open odoo_server.conf file and set the necessary options.

www.emiprotechnologies.com info@emiprotechnologies.com

General options of odoo_server.conf

● admin_password :- Super password for creating, restoring and backing up databases

● db_host :- Database host ( use localhost if there is local database to be used )

● db_port :- Default port of PostgreSQL database

● db_user :- Database user

● db_password :- Database user password

● addons_path :- Custom addons & Odoo addons path

● logfile :- Log file path

● logrotate :- This will create rotate log file on each day by datewise.

● xmlrpc_port :- Port on which Odoo runs. ( Default is 8069)

● data_dir :- To store attachments on physical drive & also store Odoo Apps

www.emiprotechnologies.com info@emiprotechnologies.com

Advance options of odoo_server.conf ( Optional !! use only if specific need )

● workers :- <no of worker> ( Using this option, we can achieve multi instance of Odoo server in order to serve more client requests. )

● email_from :- Specify the SMTP email address for sending email

● smtp_server :- Specify the SMTP server for sending email

● smtp_port :- Specify the SMTP port

● smtp_ssl :- If passed, SMTP connections will be encrypted with SSL (STARTTLS)

● smtp_user :- Specify the SMTP username for sending email

● smtp_password :- Specify the SMTP password for sending email

● csv_internal_sep :- Specify the default separator for csv file

www.emiprotechnologies.com info@emiprotechnologies.com

Example of my odoo_server.conf file.

[options]; This is the password that allows database operations:admin_passwd = your_custom_super_passworddb_host = localhostdb_port = 5432db_user = odoodb_password = odooaddons_path = /opt/odoo/odoo/addons,/opt/odoo/odoo/openerp/addons,/opt/odoo/custom_addonslogfile = /opt/odoo/log/odoo.loglogrotate = Truedata_dir = /opt/odoo/filestore

www.emiprotechnologies.com info@emiprotechnologies.com

Create log folder for Odoo.

● mkdir /opt/odoo/log

● sudo touch /opt/odoo/log/odoo.log

If logrotate option is used in odoo_server.conf file then, system will rotate log file each day with datewise names inside /opt/odoo/log/ folder.

www.emiprotechnologies.com info@emiprotechnologies.com

Create custom_addons folder for storing customised / community modules.

● Add custom addon folder's path into addon_path option of odoo_server.conf file.

It is not good to transfer custom/community modules to Odoo's default addon folders. Instead, we shall transfer them to custom_addons folder.

● We have already setup path in odoo_server.conf file's addons_path option.

www.emiprotechnologies.com info@emiprotechnologies.com

Create filestore folder for Odoo ( Optional !! use only if specific need )

● sudo mkdir /opt/odoo/filestore

It's advisable that you store all files/attachments to physical folder instead of saving them on database. When so many files are saved in database then it's size will be too much large. That can cause too much problems.

● We have already setup “data_dir” option to odoo_server.conf file in previous slide.

● By setting that option, by default your all attachments will store on physical folder under /opt/odoo/filestore folder. Separate folder per each database will be created and under that folder & your attachment will be stored over there. All your attachment will be created in encrypted mode.

www.emiprotechnologies.com info@emiprotechnologies.com

Create filestore folder for Odoo ( Optional !! use only if specific need )

● Another feature of “data_dir” option is, when you install any App from Settings >> Modules >> Apps menu, automatically module will downloaded to /opt/odoo/filestore/addons folder.

www.emiprotechnologies.com info@emiprotechnologies.com

Make directory as under :● sudo mkdir /var/lib/odoo● chown -R odoo.root /var/lib/odoo

www.emiprotechnologies.com info@emiprotechnologies.com

Setup wkhtmltopdf :

● It is required for to convert all Odoo reports from html to pdf.● sudo wget

http://sourceforge.net/projects/wkhtmltopdf/files/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb

● sudo dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb● sudo cp /usr/local/bin/wkhtmltopdf /usr/bin● sudo cp /usr/local/bin/wkhtmltoimage /usr/bin

www.emiprotechnologies.com info@emiprotechnologies.com

Setup Odoo init file

● sudo cp /opt/odoo/odoo/debian/init /etc/init.d/odoo ( In case if you don't want to copy file and generate your own then I have written the ideal file content on next slide)

● sudo chmod 777 /etc/init.d/odoo

● Let us first understand the necessary options of that file

www.emiprotechnologies.com info@emiprotechnologies.com

Setup Odoo init file : ( Main options to configure properly inside that file )

● DAEMON ( Odoo executable file path )

● NAME (Service Name)

● DESC (Service Description)

● CONFIG (Odoo configuration file we made earlier )

● LOGFILE ( No need to define here because we already included in conf file earlier in odoo_server.conf )

● PIDFILE ( This file will contain process ID for Odoo. )

● USER ( System user which we added earlier )

● export LOGNAME=$USER

www.emiprotechnologies.com info@emiprotechnologies.com

Setup Odoo init file :

● In case if you don't want to copy that file and generate own file then I have added ideal content on next slide. Those will be in 5 parts. Just copy and paste them to /etc/init.d/odoo file.

● Let's see.

www.emiprotechnologies.com info@emiprotechnologies.com

Setup Odoo init file : ( Part 1 )

#!/bin/bash

### BEGIN INIT INFO

# Provides: odoo.py

# Required-Start: $remote_fs $syslog

# Required-Stop: $remote_fs $syslog

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: Start odoo daemon at boot time

# Description: Enable service provided by daemon.

# X-Interactive: true

### END INIT INFO

## more info: http://wiki.debian.org/LSBInitScripts

www.emiprotechnologies.com info@emiprotechnologies.com

Setup Odoo init file : ( Part 2 )

. /lib/lsb/init-functions

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

DAEMON=/opt/odoo/odoo/odoo.py

NAME=odoo

DESC=odoo

CONFIG=/opt/odoo/conf/odoo_server.conf

PIDFILE=/var/run/${NAME}.pid

USER=odoo

export LOGNAME=$USER

test -x $DAEMON || exit 0

set -e

www.emiprotechnologies.com info@emiprotechnologies.com

Setup Odoo init file : ( Part 3 )

function _start() {

start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER:root --background --make-pidfile --exec $DAEMON -- --config $CONFIG

}

function _stop() {

start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --retry 3

rm -f $PIDFILE

}

function _status() {

start-stop-daemon --status --quiet --pidfile $PIDFILE

return $?

}

www.emiprotechnologies.com info@emiprotechnologies.com

Setup Odoo init file : ( Part 4 )

case "$1" in

start)

echo -n "Starting $DESC: "

_start

echo "ok"

;;

stop)

echo -n "Stopping $DESC: "

_stop

echo "ok"

;;

restart|force-reload)

echo -n "Restarting $DESC: "

_stop

sleep 1

_start

echo "ok"

;;

www.emiprotechnologies.com info@emiprotechnologies.com

Setup Odoo init file : ( Part 5 )

status)

echo -n "Status of $DESC: "

_status && echo "running" || echo "stopped"

;;

*)

N=/etc/init.d/$NAME

echo "Usage: $N {start|stop|restart|force-reload|status}" >&2

exit 1

;;

esac

exit 0

www.emiprotechnologies.com info@emiprotechnologies.com

Let's start Odoo

● /etc/init.d/odoo start ( in order to start Odoo system )

● /etc/init.d/odoo stop ( in order to stop Odoo system )

● /etc/init.d/odoo restart ( in order to restart Odoo system )

● /etc/init.d/odoo status ( in order to see status of Odoo service )

www.emiprotechnologies.com info@emiprotechnologies.com

Odoo Setup is done !!

www.emiprotechnologies.com info@emiprotechnologies.com

Autostart setting of Odoo at server startup time :

● By executing following command your Odoo instance will be started automatically when your ubuntu server will be restart.

● sudo update-rc.d odoo defaults

www.emiprotechnologies.com info@emiprotechnologies.com

Installation Complete

Up to now we have successfully set up Odoo system by all proper configurations with perfect steps and with standard directory structure.

We will see some useful tips on next slide.

www.emiprotechnologies.com info@emiprotechnologies.com

Tips

● Don't forget to update github branch on time to time in order to get latest update from Odoo. ( /opt/odoo/odoo)

● Don't forget to take backup of your live database at regular interval.

● Use db_backup_ept module for automatic backup of your database. ( Download from our website. )

● Tranfer community module into custom_addons instead of direct move to Odoo's standard addon folder.

www.emiprotechnologies.com info@emiprotechnologies.com

Tips

● Never set an easy password for Database user.

● Set complex password for super admin which is specified in odoo_server.conf as admin_passwd option and make it enable.

● Run your Odoo server on secure ssl mode. ( Don't know how to do it ? Don't worry. In next slides we have added exclusively for you.)

● Always follow standard directory structure for Odoo setup. (We have shown standard directory structure in previous slide.)

www.emiprotechnologies.com info@emiprotechnologies.com

Tips

● Start your server in multi worker mode in order to make Odoo's processing fast. ( workers option in odoo_server.conf )

● Setup file/attachment storage over physical disk instead of in database tables.

● Test html-->pdf reports in order to verify proper wkhtmltopdf installation.

● Transfer your database backup to another place at some amount of time. In case of accidential crash of your server you can restore your database.

www.emiprotechnologies.com info@emiprotechnologies.com

Tips

● Backup and transfer your community modules to another place at some amount of time.

● Clear /tmp folder of your server at regular time.

● At least server capacity shall be 4 GB RAM ( minimum), 100 GB HDD & 8 core CPUs.

● Skip installation of unnecessary modules.

● Use plug & play approach in which module shall be installed only when that feature is needed.

www.emiprotechnologies.com info@emiprotechnologies.com

Tips

● Set proper access rights & rules in case of multi user access in your Odoo system.

● Set custom filters in order to prevent large amount of unnecessary data in list view. ( For instance, I prefer to set custom filter of only “my tasks”. So that out of numerous tasks for whole staff of company, I can see only mine which matters most of the time. )

www.emiprotechnologies.com info@emiprotechnologies.com

Tips

● Community modules are not advisable to install directly on live server. It may crash your live server sometimes !!!

Instead, first craft them with some Odoo experts and let them install for you after proper testing.

www.emiprotechnologies.com info@emiprotechnologies.com

Set up Odoo in ssl mode (Optional)

● sudo apt-get install apache2

● sudo a2enmod ssl proxy_http headers rewrite

● sudo mkdir /etc/ssl/openerp

● Go inside that folder and apply following commands.

● openssl genrsa -des3 -out oeserver.pkey 1024

● openssl rsa -in oeserver.pkey -out oeserver.key

● openssl req -new -key oeserver.key -out oeserver.csr

● openssl x509 -req -days 365 -in oeserver.csr -signkey oeserver.key -out oeserver.crt

www.emiprotechnologies.com info@emiprotechnologies.com

Set up Odoo in ssl mode (Optional)

● touch /etc/apache2/sites-available/openerp

● Open that file for editing.

● vi /etc/apache2/sites-available/openerp

● Add content which is specified on next slide

www.emiprotechnologies.com info@emiprotechnologies.com

Set up Odoo in ssl mode (Optional)

<VirtualHost *:443>

SSLEngine on SSLCertificateFile /etc/ssl/openerp/oeserver.crt SSLCertificateKeyFile /etc/ssl/openerp/oeserver.key

ProxyRequests Off

<Proxy *> Order deny,allow Allow from all </Proxy> ProxyVia On ProxyPass / http://[your IP]:8069/ <location /> ProxyPassReverse / </location>

RequestHeader set “X-Forwarded-Proto” “https”

SetEnv proxy-nokeepalive 1 </VirtualHost>

www.emiprotechnologies.com info@emiprotechnologies.com

Set up Odoo in ssl mode (Optional)

● sudo a2ensite openerp

● service apache2 reload ( Reload apache server )

● Access your ERP by following url in browser.

https://45.55.190.63

www.emiprotechnologies.com info@emiprotechnologies.com

Access ERP from domain instead of IP (Optional)

● If I want to access my Odoo with domain name like https://demo.emiprotechnologies.com instead of https://45.55.190.63

● In case of If you want to access ERP by your domain name then you need to set your virtualhost file like in next slide.

www.emiprotechnologies.com info@emiprotechnologies.com

Access ERP from domain instead of IP (Optional)

<VirtualHost *:443> ServerAdmin webmaster@localhost ServerName demo.emiprotechnologies.com SSLEngine on SSLCertificateFile /etc/ssl/openerp/oeserver.crt SSLCertificateKeyFile /etc/ssl/openerp/oeserver.key ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyVia On ProxyPass / http://45.55.190.63:8069/ ProxyPassReverse / http://127.0.0.1:8069/ ProxyPreserveHost On ProxyErrorOverride Off RequestHeader set “X-Forwarded-Proto” “https” ErrorLog /var/log/apache2/webclient-error.log CustomLog /var/log/apache2/webclient-access.log combined SetEnv proxy-nokeepalive 1 </VirtualHost>

www.emiprotechnologies.com info@emiprotechnologies.com

Thank you !

We have covered almost all necessary settings for Odoo installation with live example.

Even if you face any problem then don't worry ! You are just an inch away from us by an email info@emiprotechnologies.com