.. debian_linux 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`` | 2. Prerequisites a) 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: .. code:: bash sudo apt install python3.11-venv Create the venv `odoo_16` .. code:: bash cd /usr/local/logistics/Python/venv python3 -m venv odoo_16 b) Install PostgreSQL - Use a package manager to download and install PostgreSQL: .. code:: sudo apt install postgresql postgresql-client - By default, the only user is ``postgres``. As Odoo forbids connecting as ``postgres``, create a new PostgreSQL user: .. code:: bash 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: .. code:: bash 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. .. code:: bash sudo su - postgres - Create a new database user The newly created user `odoo` has SUPERUSER rights. .. code:: bash psql CREATE USER odoo WITH SUPERUSER PASSWORD 'PASSWORD'; \q Password of the user `odoo see :keepass:`KeePass<>`. - Exit from the PostgresSQL user account`postgres`` .. code:: bash exit c) Install additional components - Install required Python libraries: .. code:: bash sudo apt install python3-pip libldap2-dev libpq-dev libsasl2-dev - Download and install **nodejs** and **npm** with a package manager: .. code:: sudo apt install nodejs sudo apt install npm - Download and install wkhtmltopdf with a package manager: .. code:: bash sudo apt install wkhtmltopdf | 3. Create the Instance Layout for Odoo Change to the Instances of Odoo, here: .. code:: bash cd /usr/local/logistics/Odoo/Instances/Logistics_16_Develop Create some subdirectories: .. code:: bash 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. | 4. Install Odoo Clone Odoo 16 from Git: .. code:: bash git clone -b 16.0 --single-branch --depth 1 https://github.com/odoo/odoo.git Odoo will be installed in the subdirectory ``odoo``. | 5. Install Pyton libraries Install the required python libraries in the ``venv`` environment. Copy the ``venv`` from ``odoo`` to the venv environment: .. code:: cd odoo cp requirements.txt /usr/local/logistics/Python/venv/odoo_16 Activate the ``odoo_16 venv`` and install the libraries: .. code:: 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: .. code:: cd /usr/local/logistics/Odoo/Instances/Logistics_16_Develop | 6. Script to start Odoo Create the shell script bin/odoo: .. code:: bash nano bin/odoo Content of the shell script: .. code:: bash #!/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: .. code:: chmod +x bin/odoo Generate the configuration file for the instance and initialize the database: .. code:: 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: .. code:: sudo sudo chown -R Friedrich * && sudo chgrp -R Friedrich * && sudo chmod -R a+rwx * | 7. If not already done, set the following settings in the configuration file: .. code:: bash nano logistics_16_test.cfg Install no demo data in the database. Change the following setting in the config file to: .. code:: bash without_demo = True | 8. 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*. .. code:: bash 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*. .. code:: bash 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: .. code:: bash 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 | 9. 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: .. code:: bash nano /usr/local/logistics/Odoo/Instances/Logistics_16_Develop/odoo/odoo-bin Set the new time zone: .. code:: bash # set server timezone in UTC before time module imported __import__('os').environ['TZ'] = 'UTC+2' | 10. Start Odoo Start Odoo by launching the shell script. .. code:: bash bin/odoo