Introduction:
Odoo is an open-source all-in-one enterprise resource planning (ERP) application developed by Odoo S.A. The new release of Odoo 10.0 is introducing many new features with great speed.
Odoo gives you endless possibilities. You can extend your business scope from CRM to E-commerce with Odoo. Also, you can customize Odoo to suit your business flow. I am sure you’ll enjoy working Odoo.
How To:
Before we going through the steps of installation of Odoo, We can download and install a .deb package of Odoo. But it won’t give you the full control over the installation. Also, it will make the customization/ modification difficult. So we are using a manual approach here.
We are using a clone of Odoo 10.0 branch from Odoo’s GitHub repository. This will make things easier when it comes to the installation of updates and bug fixes.
Follow below steps to Install Odoo 10 on Ubuntu16.04
Open your terminal and run these commands step by step, and feel the difference Odoo can do.
sudo apt-get install openssh-server fail2ban
This is to make your server secure and to let you connect to the system remotely. If you have another method for this, Skip this one.
sudo apt-get update
sudo apt-get upgrade
This will make your server up-to-date with all the latest versions and patches.
It is a good idea to restart your server after this.
This system user is to own and run Odoo on your server. Login of this user will be disabled. We are going to place the source code of Odoo inside the home directory of this user.
sudo adduser --system --home=/opt/odoo --group odoo
Here I have put home directory as /opt/odoo. If you want to change the location, it is your choice. But, you’ll have to alter some of the configuration and instruction are given below.
Don’t worry about how we can run Odoo with a system user that has no shell. The next command will help you.
sudo su - odoo -s /bin/bash
This will switch the current login user of a terminal with Odoo user. Then you will be using /bin/bash shell. And your home directory will be /opt/odoo.
Enter exit to leave odoo user
sudo apt-get install postgresql
This command will install database server PostgreSQL on your server.
Now we have to configure Odoo user in Postgres. To do this we need some privileges. For that, we will switch into Postgres user. To do so, run
sudo su - postgres
Now, create a database user for Odoo. So that odoo can delete, create and restore databases.
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
The system will ask you for a password. Don’t forget it. You’ll need it later.
Enter exit to leave postgres user
There are some Python packages odoo depends on. This command will
sudo apt-get install python-dateutil python-docutils python-feedparser python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi poppler-utils python-pip python-pypdf python-passlib python-decorator gcc python-dev mc bzr python-setuptools python-markupsafe python-reportlab-accel python-zsi python-yaml python-argparse python-openssl python-egenix-mxdatetime python-usb python-serial lptools make python-pydot python-psutil python-paramiko poppler-utils python-pdftools antiword python-requests python-xlsxwriter python-suds python-psycogreen python-ofxparse python-gevent
for 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
for Odoo reports, Install wkhtmltopdf
Here we are using 0.12.1 version of wkhtmltopdf.
sudo wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
This will download wkhtmltopdf package for 64 bit system arch.
Or download manually from http://nightly.odoo.com/extra/
To install the package
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
To ensure wkhtmltopdf functions properly:
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin
First, We have to install Git.
sudo apt-get install git
Before we clone Odoo, we should switch to Odoo user
sudo su - odoo -s /bin/bash
Now clone the latest code of Odoo from repo using git clone.
git clone https://www.github.com/odoo/odoo --depth 1 --branch 10.0 --single-branch .
Note the ‘. ‘ at the end of the command.
This will download Odoo to /opt/odoo
If you get a message like this
“fatal: destination path ‘.’ already exists and is not an empty directory.”
remove the ‘. ‘ from command and try again. This time odoo code will be downloaded to /opt/odoo/odoo-10.0/. In this case, you’ll have to alter some of the configuration given below according to this directory path.
· copy the configuration files that comes with odoo to a more convenient location
sudo cp /opt/odoo/debian/odoo.conf /etc/odoo-server.conf
· Modify the file using
sudo nano /etc/odoo-server.conf
Minimal of ‘odoo-server.conf’ file
[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /opt/odoo/addons
logfile = /var/log/odoo/odoo.log
in this configuration file
; admin_passwd = admin : this line currently commented. This is the password that allows database operations. Remove the preceding ‘;’ to uncomment the line and change ‘admin’ to something more secure to make your Odoo more secure.
db_host = False: This is used when you are using a different server for the database. Put your database server address in that case.
db_port = False : Postgresql uses port no: 5432 as default. If you are running with a custom configuration, give the appropriate port number here.
db_user = odoo : Name of the PostgreSQL user we created in step 3
db_password = False: Change the FALSE to the db_user’s password.
addons_path = /opt/odoo/addons : This where Odoo addons lies. If you have any other add-ons in a different location, add that path to this line after a ‘,’
logfile = /var/log/odoo/odoo.log : This is the path to odoo log file.
By default odoo uses 8069 port, If you are planning to run odoo in a different port, add this line
xmlrpc_port = <port no>
· Change ownership and permission of Odoo.conf
sudo chown odoo: /etc/odoo-server.conf
sudo chmod 640 /etc/odoo-server.conf
· We should create the path we mentioned for Odoo log in configuration file and set the Odoo user as its owner
sudo mkdir /var/log/odoo
sudo chown odoo:root /var/log/odoo
We have to create a systemd unit for Odoo So that it behaves like a service.
Create a new file at /etc/systemd/system/odoo.service
[Unit]
Description=Odoo
Documentation=http://www.odoo.com
[Service]
# Ubuntu/Debian convention:
Type=simple
User=odoo
ExecStart=/opt/odoo/odoo-bin -c /etc/odoo-server.conf
[Install]
WantedBy=default.target
We need to change the permission and ownership of this file.
sudo chmod 755 /etc/systemd/system/odoo.service
sudo chown root: /etc/systemd/system/odoo.service
start the Odoo server
sudo systemctl start odoo.service
check the log file
sudo tail -f /var/log/odoo/odoo.log
This will enable the Odoo to start and stop the server
sudo systemctl enable odoo.service
Open a new browser window and enter http://<your_domain_or_IP_address>:8069 in the address bar
If everything is working properly, you will redirect to Odoo’s database creation page.