When developing Odoo 12 or another version on a local machine, I never used package installation. But, I using virtualenv to run it. Many advantages can we obtained if we develop Odoo with virtualenv. One of them is we can run various versions of Odoo on one machine simultaneously with distinguishing ports.
In this case, I use Ubuntu 18.04 and can work on Debian 9. You can try this tutorial to another operating system, but you need to search for any dependencies of Odoo on your operating system.
Odoo 12 Preparation.
- Download Odoo 12 source code from Odoo repository on Github https://github.com/odoo/odoo or you can do
- Extract downloaded file. We only use
requirements.txtfile. Make sure that directory structure like the image below.
- Install python3 pip and virtualenv with
sudo apt install python3-pip python3-venv.
- Create virtualenv with
python3 -m venv <venv-directory>. You can create virtualenv on same directory or different directory. In this tutorial, I use same directory as the Odoo directory.
- Install other dependencies for Odoo
sudo apt install python3-dev libxml2-dev libxslt1-dev libldap2-dev libssl-dev libsasl2-dev libpq-dev.
- Activate virtualenv with
- Upgrade pip with
pip install --upgrade pip. We need to upgrade pip module because the old pip can’t work properly with dependencies.
- Install all Odoo dependencies in the
pip install -r requirements.txt.
- Install Postgresql with
sudo apt install postgresql.
- Switch to
sudo su - postgresand type
- Create a new user on Postgresql for Odoo. In this tutorial I use
odoo12as username and
odooas a password. Type this SQL command
CREATE USER odoo12 WITH CREATEDB;and
ALTER USER odoo12 WITH ENCRYPTED PASSWORD ‘odoo’;.
- Quit from
postgresaccount then configure postgresql pg_hba file. Open pg_hba with
sudo nano /etc/postgresql/<postgresql-version>/main/pg_hba.confadd a command for Odoo custom config like image below.
- Restart your postgresql service with
sudo service postgresql restart.
Set Odoo Config.
Create a configuration file for Odoo named
odoo.conf (or whatever you want). Fill in the file with the command below.
You can read https://www.odoo.com/documentation/12.0/setup/deploy.html for other options of configuration. Also, you can set other port for
And you just need activating virtualenv then run
./odoo-bin -c odoo.conf. Open your browser and type
That’s it. Thanks for reading. If you have a question, please write in the comments section.