Install Odoo 10 In Ubuntu 16.04 LTS

Odoo is an all-in-one management software that offers a range of business applications that form a complete suite of enterprise management applications targeting companies of all sizes. Odoo is an all-in-one business software including CRM, Website/e-Commerce, billing, accounting, manufacturing, warehouse- and project management, and inventory.

For installing Odoo in Ubuntu 16.04 LTS, we need following requirements.

  • Ubuntu 16.04 LTS
  • Python 2.7
  • PostgreSQL
  • Git

You can download the Ubuntu server from there official page.Then install it with the additional tools you needed like openssh-server(used for ssh access)

Setting Up Server

We have to make the server more secure before we install anything like enabling the firewall in the ubuntu server.We can use UFW firewall for this purpose.

                            
                            
ufw status // checking the status of the ufw
sudo ufw allow ssh // allowing the ssh
sudo ufw allow 8069/tcp // adding rule allowing incoming connection to 8069/tcp
sudo ufw enable // last enable the ufw

Installing Python and PostgreSQL

Ubuntu 16.04 comes with python 3.x as default but for odoo 10 we need Python 2.x. Following are the steps needed for configuring python.It is better to use a ssh client like PuTTY for further configuration.

                            
                            
// Installation using source -Python
sudo apt-get install build-essential checkinstall git // utility programs like make and c compiler git
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev // lib files
wget https://www.python.org/ftp/python/$version/Python-$version.tgz // replace version
tar -xvf Python-$version.tgz // extarct
./configure // after cd into exracted folder
make // create a make file
sudo checkinstall // installing the python
sudo apt-get install python-pip // installing pip
                            
                            
// Installing and Configuring PostgreSQL
sudo apt-get install postgresql // install using package manager
sudo su - postgres // switch to postgres user
createuser odoo -U postgres -dRSP // creating a new non super user. For flag info use createuser --help

Cloning Odoo and configuration

To install Odoo we can use the git repository of the Odoo 10 community version. Using a version control application like git. will let us stay up to date with the latest changes.We will be cloning it to the /opt/odoo directory. And will configure the Odoo run parameters also. After cloning Odoo we may need additional python packages to run Odoo properly, which are located in the paths /opt/odoo/doc/requirements.txt and /opt/odoo/requirements.txt

                            
                            
// Cloning Odoo 10
sudo git clone https://www.github.com/odoo/odoo --depth 1 --branch 10.0 --single-branch /opt/odoo // cloning the odoo 10
sudo pip install -r /opt/odoo/doc/requirements.txt // installing dependencies
sudo pip install -r /opt/odoo/requirements.txt //installing dependencies
sudo cp /opt/odoo/debian/odoo.conf /etc/odoo.conf //copy the conf file to /etc

Simple configuration of the Odoo config file is as shown below. For getting the full list of config parameters, we can use the help flag with odoo-bin (odoo10) like

odoo-bin --save --config odoo.cfg --stop-after-init will save all the flags that we can use with Odoo to a file. If no configuration is supplied odoo will use its default parameters to run the application.

                            
                            
// Odoo Configuration Parameters
admin_passwd = admin // admin password for database operation
db_host = False // for connecting to different database server
db_port = False //for specifying the db port default is 5432
db_user = odoo // database user
db_password = FALSE // database user password
addons_path = /opt/odoo/addons // comma separated relative paths
logfile = /var/log/odoo/odoo-server.log // adding the log file path

Setting Up New System User

Creating a new system user for handling the Odoo process because it is safe to run Odoo as non superuser.We will be installing the odoo in the /opt/odoo directory. You can install it in a different directory if you want. and make that directory as the home directory of the new user with group odoo. We will also create a log directory in the /var/log/odoo

                            
                            
// Setting Up System User
sudo adduser --system --home=/opt/odoo --group odoo // creating a new user
sudo su - postgres // switch to postgres user
createuser odoo -U postgres -dRSP // creating a new non super user. For flag info use createuser --help

Changing the ownership of the Odoo directories to the newly created user.

                            
                            
// Setting up permissions
sudo chown -R odoo: /opt/odoo/ // changing to odoo user
sudo chown odoo:root /var/log/odoo // changing to odoo user
sudo chown odoo: /etc/odoo.conf // changing to odoo user
sudo chmod 640 /etc/odoo.conf // adding permissions

Installing Extra Dependencies

For Odoo to run smoothly we need some extra application like nodejs for less css and wkhtmltopdf for pdf rendering.

                            
                                
// Setting up node js
sudo apt-get install nodejs // installing node js
sudo apt-get install npm // installing node package manager
sudo npm install -g less // installing less
sudo npm install -g less-plugin-clean-css // installing less
                            
                                
// Setting up wkhtmltopdf (as in odoo docs only use version 0.12.1)
sudo wget https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb // installing with dpkg
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin // moving the binary files
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin // moving the binary files

Creating A Service For Odoo

To execute odoo as a service so it can be controlled easily, we have to create a service in systemd as follows. Create a new file at /lib/systemd/system/odoo-server.service.Edit the file and add following.

                            
                                
[Unit]
Description=Odoo
[Service]
Type=simple
User=odoo
Group=odoo
ExecStart=/opt/odoo/odoo-bin --config=/etc/odoo.conf
WorkingDirectory=/opt/odoo/
[Install]
WantedBy=multi-user.target

For staring the service and checking the status

                            
                                
sudo systemctl start odoo-server // running the service
sudo systemctl status odoo-server // checking the status

Once all these done we can check the fully running Odoo in the server ip http://[your_domain_or_IP_address]/:8069.Here the 8069 is the default xmlrpc port.