Install Customizable ERP with Odoo
Install and run locally on Ubuntu
Odoo is an open-source ERP system built in Python. I can create my own features (or in this case I called modules) with just a little code. There are 2 ways of choices to build it.
- Build and deploy a website and its services in their cloud (Paid).
- Build it locally and then deploy in different service (Free).
For now, I will demonstrate how to install the later one.
Preparation
Install pre-built dependencies
Update my package to the latest version first.
sudo apt update && sudo apt upgrade
And then these dependencies.
sudo apt install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less
Install wkhtmltopdf to render HTML into PDF manually.
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.debsudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb
Install PostgreSQL
Install PostgreSQL (database) and create user postgres with the name you want.
sudo apt install postgresqlsudo su postgrescreateuser amirul -spsqlalter role amirul with password 'amirul';\qexit
Installation
Install from the source
Clone (download) from origin and place in /opt/odoo12. This directory is optional, you can change it if you know what you are doing. If not, you better follow this.
git clone https://www.github.com/odoo/odoo --depth 1 --branch 12.0 /opt/odoo12
Install requirements
I want to make sure the current directory is the dir that I just create when cloning by changing it (cd). Then I create a new Python environment odoo12env
to prevent un-accidentally mixing with the other projects (that often use different requirements). Last, activate it.
cd /opt/odoo12virtualenv -p python3 odoo12envsource odoo12env/bin/activate
Now, I install the package dependencies from requierements.txt and the others that don’t cover inside but will still be useful.
pip3 install wheel && pip3 install -r /opt/odoo12/odoo/requirements.txtpip3 install num2words phonenumbers psycopg2-binary watchdog xlwtdeactivate
Create a new dir for the custom module.
mkdir /opt/odoo12/custom-addons
Setup Odoo config
Create a config file by copying from the existing one and modify inside.
cd /opt/odoo12sudo cp ./odoo/debian/odoo.conf ./odoo12.confsudo nano ./odoo12.conf
The editor will show the existing config inside odoo12.conf. I set my own admin password. And the rest I leave without a change or you can also change it if you know what it does. Fill … with the actual directory on your computer, it's different among the others.
[options]
; This is the password that allows database operations:
admin_passwd = admin
db_host = False
db_port = False
db_user = odoo12
db_password = False
addons_path = /opt/odoo12/odoo/addons,/opt/odoo12/custom-addons
The first path in addons_path is the existing original Odoo addons directory and the latter path is where custom addons located.
Configure Odoo so it can be run as a service
Create a config file.
sudo nano /etc/systemd/system/odoo12.service
Copy these files into the file.
[Unit]
Description=Odoo12
Requires=postgresql.service
After=network.target postgresql.service[Service]
Type=simple
SyslogIdentifier=odoo12
PermissionsStartOnly=true
User=odoo12
Group=odoo12
ExecStart=/opt/odoo12/odoo12env/bin/python3 /opt/odoo12/odoo/odoo-bin -c /etc/odoo12.conf
StandardOutput=journal+console[Install]
WantedBy=multi-user.target
Reload and start the service.
sudo systemctl daemon-reload
sudo systemctl start odoo12
Open browser and type http://localhost:8069

The screen will show up so I can set up the database by filling it. Remember email and password for login and checklist Demo data option. The last click Create database. Then it will redirect to Odoo app homepage.

When I install Odoo in /opt directory where it is located inside the root directory, I can’t take action to write/modify files. So I change the permission with this command
chmod -R o+rwx odoo12
And to stop Odoo service, I run
sudo systemctl stop odoo12
Next
In the next story, I will show you how I ease Odoo development.