Debian Linux

See the documentation at Odoo Documentation - Source install.

  1. Parameter

    • Installation of Odoo in the directory /usr/local/logistics/Odoo/Instances/Logistics_16_Develop

    • Used venv: odoo_16

    • Database Name: Logistics_16_DB


  1. Prerequisites

    1. Install Python venv for Odoo 16

      • Install a new virtual environment odoo_16 in /usr/local/logistics/Python/venv:

        As a prerequisite ensurepip must be installed:

        sudo apt install python3.11-venv
        

        Create the venv odoo_16

        cd /usr/local/logistics/Python/venv
        python3 -m venv odoo_16
        
    2. Install PostgreSQL

      • Use a package manager to download and install PostgreSQL:

        sudo apt install postgresql postgresql-client
        
      • By default, the only user is postgres. As Odoo forbids connecting as postgres, create a new PostgreSQL user:

        sudo -u postgres createuser -d -R -S $USER
        createdb $USER
        
      • Create odoo user to use in scripts and other tasks

        Create odoo user at Debian:

        sudo adduser --system --home=/home/odoo --group odoo
        
      • Configure the odoo user on postgres

        First change to the postgres user to have the necessary privileges to configure the database.

        sudo su - postgres
        
      • Create a new database user

        The newly created user odoo has SUPERUSER rights.

        psql
        CREATE USER odoo WITH SUPERUSER PASSWORD 'PASSWORD';
        \q
        

        Password of the user odoo see :keepass:`KeePass<>.

      • Exit from the PostgresSQL user account`postgres``

        exit
        
    3. Install additional components

      • Install required Python libraries:

        sudo apt install python3-pip libldap2-dev libpq-dev libsasl2-dev
        
      • Download and install nodejs and npm with a package manager:

        sudo apt install nodejs
        sudo apt install npm
        
      • Download and install wkhtmltopdf with a package manager:

        sudo apt install wkhtmltopdf
        

  1. Create the Instance Layout for Odoo

    Change to the Instances of Odoo, here:

    cd /usr/local/logistics/Odoo/Instances/Logistics_16_Develop
    

    Create some subdirectories:

    mkdir local bin data logs
    

    The functions of the subdirectories are as follows:

    • local/: This is used to save the instance-specific add-ons.

    • bin/: This includes various helper executable shell scripts.

    • data/: This is used as a file store.

    • logs/ (optional): This is used to store the server log files.


  1. Install Odoo

    Clone Odoo 16 from Git:

    git clone -b 16.0 --single-branch --depth 1 https://github.com/odoo/odoo.git
    

    Odoo will be installed in the subdirectory odoo.


  1. Install Pyton libraries

    Install the required python libraries in the venv environment.

    Copy the venv from odoo to the venv environment:

    cd odoo
    cp requirements.txt /usr/local/logistics/Python/venv/odoo_16
    

    Activate the odoo_16 venv and install the libraries:

    cd /usr/local/logistics/Python/venv
    source odoo_16/bin/activate
    cd odoo_16
    pip3 install -r requirements.txt
    deactivate
    

    Back to the Odoo installation:

    cd /usr/local/logistics/Odoo/Instances/Logistics_16_Develop
    

  1. Script to start Odoo

    Create the shell script bin/odoo:

    nano bin/odoo
    

    Content of the shell script:

    #!/bin/sh
    root=/usr/local/logistics/Odoo/Instances/Logistics_16_Develop
    python=/usr/local/logistics/Python/venv/odoo_16/bin/python3
    odoo=$root/odoo/odoo-bin
    "$python" "$odoo" "-c" "$root/logistics_16_test.cfg" "$@"
    

    Make the script executable:

    chmod +x bin/odoo
    

    Generate the configuration file for the instance and initialize the database:

    bin/odoo --without-demo=True --stop-after-init --addons-path=odoo/addons --data-dir /usr/local/logistics/Odoo/Instances/Logistics_16_Develop/data -d Logistics_16_DB --save --config=logistics_16_test.cfg
    

    The configuration file has the name logistics_16_test_cfg. The database Logistics_16_DB will be attached to this installation. By parameter –without-demo no demo data will be loaded (see Command-line interface)

    See Configuring Odoo for more details to the configuration file.

    Set the configuration file readable for all:

    sudo sudo chown -R Friedrich * && sudo chgrp -R Friedrich * && sudo chmod -R a+rwx *
    

  1. If not already done, set the following settings in the configuration file:

    nano logistics_16_test.cfg
    

    Install no demo data in the database. Change the following setting in the config file to:

    without_demo = True
    

  1. Install additional modules

    Install the module Odoo 16 Accounting from Git to the subdirectory odoo/addons. This is realized via the temporary directory local/temp for the download of the Git repository and than move the files to odoo/addons.

    git clone -b 16.0 --single-branch --depth 1 https://github.com/odoomates/odooapps.git local/temp
    mv local/temp/* odoo/addons
    rm -rf local/temp
    

    Install the module OpenUpgrade from Git to the subdirectory odoo/addons. This is realized via the temporary directory local/temp for the download of the Git repository and then move the files to odoo/addons.

    git clone -b 16.0 --single-branch --depth 1 https://github.com/OCA/OpenUpgrade.git local/temp
    mv local/temp/* odoo/addons
    rm -rf local/temp
    

    Activate additional apps in Odoo:

    bin/odoo -c logistics_16_test.cfg -i account,product,stock,purchase,hr,crm --stop-after-init
    bin/odoo -c logistics_16_test.cfg -i aproject,mail,board,note --stop-after-init
    bin/odoo -c logistics_16_test.cfg -i sale_management --stop-after-init
    bin/odoo -c logistics_16_test.cfg -i appointment --stop-after-init
    bin/odoo -c logistics_16_test.cfg -i l10n_ch --stop-after-init
    bin/odoo -c logistics_16_test.cfg -i sale --stop-after-init
    bin/odoo -c logistics_16_test.cfg -i account_accountant --stop-after-init
    bin/odoo -c logistics_16_test.cfg -i om_account_accountant --stop-after-init
    bin/odoo -c logistics_16_test.cfg -i sale_subscription --stop-after-init
    

  1. Set the time zone

    Switching to UTC +2 Central European Summer Time (CEST) or switching to UTC +1 Central European Time (CET). Edit the odoo-bin file:

    nano /usr/local/logistics/Odoo/Instances/Logistics_16_Develop/odoo/odoo-bin
    

    Set the new time zone:

    # set server timezone in UTC before time module imported
    __import__('os').environ['TZ'] = 'UTC+2'
    

  1. Start Odoo

Start Odoo by launching the shell script.

bin/odoo