Language:

Search

How to Install & Configure Odoo 12 on Ubuntu

  • Share this:
How to Install & Configure Odoo 12 on Ubuntu

Getting Started

First, it is recommended to update your system with latest version.

You can do it with the following command:

sudo apt-get update -y
sudo apt-get upgrade -y

Once your system is updated, restart the system to apply all the changes:

Next, you will need to install some packages required by Odoo to your server.

You can install all of them by running the following command:

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 libpq-dev -y

Next Install

sudo apt-get install python-dev libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev libpq-dev libjpeg8-dev liblcms2-dev libblas-dev libatlas-base-dev

After installation of the packages and libraries, need to install some web dependencies also.

sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less less-plugin-clean-css
sudo apt-get install -y node-less

Install wkhtmltopdf to print PDF reports. ‘0.12.5’ is the recommended version for Odoo13. You can install wkhtmltopdf using the following command.

sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo apt install -f

Once all the packages are installed, you can proceed to the next step.
Install and Configure PostgreSQL

Before installing PostgreSQL, you will need to create a new system user for Odoo.

You can do it with the following command:

sudo useradd -m -d /opt/odoo12 -U -r -s /bin/bash odoo12

Next, install PostgreSQL with the following command:

sudo apt-get install postgresql -y

Once the installation is completed,

you can check the status of PostgreSQL with the following command:

sudo systemctl status postgresql

Next, you will need to create a new PostgreSQL for Odoo. You can create it with the following command:

sudo su - postgres -c "createuser -s odoo12"

Install and Configure Odoo

First, you will need to download the latest version of Odoo from the Git repository.

You can do it with the following command:

sudo su - odoo12
cd /opt/odoo12/
git clone https://www.github.com/odoo/odoo --depth 1 --branch 12.0

After downloading Odoo, create a new Python virtual environment for

the Odoo 12 installation with the following command:

cd /opt/odoo12
python3 -m venv odoo12-venv

Next, activate the environment with the following command:

source odoo12-venv/bin/activate

Next, install all the required packages with the following command:

pip3 install -r odoo/requirements.txt
pip3 install wheel
pip3 install Werkzeug PyPDF2 python-dateutil polib Pillow psycopg2 psutil reportlab

Next, disconnect from the environment with the following command:

deactivate

Next, you will need to create a new directory for the custom addons. You can do it with the following command:

mkdir /opt/odoo12/odoo-custom-addons

Next, exit from the Odoo12 user with the following command:

exit

After the successful installation of dependencies, we have to configure the Odoo. Odoo will maintain log files. create a directory to store the log file

sudo mkdir /var/log/odoo

Next will give the complete access of this directory to the user odoo.

sudo chown odoo12:root /var/log/odoo

Next, copy the sample odoo12 configuration file with the following command:

sudo cp /opt/odoo12/odoo/debian/odoo.conf /etc/odoo12.conf

Next, open the /etc/odoo12.conf file with the following command:

sudo nano /etc/odoo12.conf

Make the following changes:

[options]
; This is the password that allows database operations:
admin_passwd = admin@123
db_host = False
db_port = False
db_user = odoo12
db_password = False
addons_path = /opt/odoo12/odoo/addons,/opt/odoo12/odoo-custom-addons
logfile = /var/log/odoo/odoo12.log

Save and close the file, when you are finished.

Next, you will need to create a systemd file for Odoo to manage the Odoo service. You can do this with the following command:

sudo nano /etc/systemd/system/odoo12.service

Add the following lines:

[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/odoo12-venv/bin/python3 /opt/odoo12/odoo/odoo-bin -c /etc/odoo12.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target

Save and close the file. Then, reload the systemd daemon with the following command:

sudo systemctl daemon-reload

Next, start the Odoo service with the following command:

sudo systemctl start odoo12

You can also check the status of Odoo service with the following command:

sudo systemctl status odoo12

Live url : http://localhost:8069       


Tags:
Farhan Tanvir

Farhan Tanvir