odoo14-Ubuntu20 installation odoo14

In order to facilitate the ultimate experience of the later spectators, I will write the path in the code. I hope you will pay more attention when referring to the spectators - the path and the code will be displayed separately

1, Source change: ensure that the installation speed of python library is improved later

1. Back up the original source

ubuntu@VM-4-15-ubuntu:~$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2. Enter the document and select the appropriate domestic source

ubuntu@VM-4-15-ubuntu:~$ sudo vim /etc/apt/sources.list
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security multiverse

3. Refresh software source information

ubuntu@VM-4-15-ubuntu:~$ 
sudo apt-get update

4. Update the software - try the feeling of speed improvement and reward yourself

ubuntu@VM-4-15-ubuntu:~$ 
sudo apt-get upgrade

2, Prerequisites

1. Use the following command to install Git, Pip, Node.js and tools required for construction

  • Note: these tools may need to update the version of the tool when installing the python Library in requirement.txt later. You have to explore this by yourself, install it first, and then install the corresponding tool version according to the error prompt
ubuntu@VM-4-15-ubuntu:~$ 
sudo apt install git python3-pip build-essential wget python3-dev python3-venv \
>     python3-wheel libfreetype6-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev \
>     python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev \
>     libxslt1-dev libldap2-dev libtiff5-dev libjpeg8-dev libopenjp2-7-dev \
>     liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev

3, Start to build Odoo14 related

1. Create system user

  • It is not allowed to run Odoo under the root user because it is a security risk. Therefore, you need to create a new system user and group it with / opt/odoo14, the home directory where the Odoo service will run
  • Users can be named with any name, as long as PostgreSQL users with the same name are created later
ubuntu@VM-4-15-ubuntu:~$ 
sudo useradd -m -d /opt/odoo14 -U -r -s /bin/bash odoo14

2. Install and configure PostgreSQL

2.1. Installation

ubuntu@VM-4-15-ubuntu:~$ 
sudo apt install postgresql

2.2. Create a PostgreSQL user with the same name as the previously created system user

ubuntu@VM-4-15-ubuntu:~$ 
sudo su - postgres -c "createuser -s odoo14"

3. Install wkhtmltopdf (optional - the function of installation is to print reports, etc., and it will not affect the use of odoo)

3.1 download

ubuntu@VM-4-15-ubuntu:~$ 
sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
  • Because it is downloaded from github, it may be very slow. I suggest going directly Official website Download the corresponding version and put it in the folder of the specified path
ubuntu@VM-4-15-ubuntu:~$ pwd
/home/ubuntu

3.2. Installation

ubuntu@VM-4-15-ubuntu:~$ 
sudo apt-get install ./wkhtmltox_0.12.6-1.focal_amd64.deb
  • The later. deb is based on the version you downloaded. Don't copy it

4. Install and configure Odoo14

4.1. Switch to odoo14 user

ubuntu@VM-4-15-ubuntu:~$ 
sudo su - odoo14

4.2. Download odoo14 source code

odoo14@VM-4-15-ubuntu:~$
git clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0 /opt/odoo14/odoo

4.3. Creating a virtual environment

4.3.1. Switching path
odoo14@VM-4-15-ubuntu:~$ 
cd /opt/odoo14
4.3.2. Creating a virtual environment
odoo14@VM-4-15-ubuntu:~$ 
python3 -m venv odoo-venv
4.3.3. Activate virtual environment
odoo14@VM-4-15-ubuntu:~$ 
source odoo-venv/bin/activate
(odoo-venv) odoo14@VM-4-15-ubuntu:~$

4.4. Install the necessary Python modules

(odoo-venv) odoo14@VM-4-15-ubuntu:~$ 
pip3 install wheel
(odoo-venv) odoo14@VM-4-15-ubuntu:~$ 
pip3 install -r odoo/requirements.txt
  • ps: Chicken jelly has been reinstalled countless times. For the first time, all modules have been successfully installed when writing a blog

4.5. Shutdown environment

(odoo-venv) odoo14@VM-4-15-ubuntu:~$ 
deactivate
odoo14@VM-4-15-ubuntu:~$

4.6. Return to root

odoo14@VM-4-15-ubuntu:~$ 
exit
ubuntu@VM-4-15-ubuntu:~$

4.7. Create system configuration file

ubuntu@VM-4-15-ubuntu:~$ 
sudo nano /etc/odoo14.conf
[options]
; This is the password that allows database operations:
admin_passwd = xxxxxxx
db_host = localhost
db_port = 5432 
db_user = odoo14 
db_password = xxxxx
addons_path = /opt/odoo14/odoo/addons

4, Start service

1. Create systemd Unit file

1.1. Create profile

ubuntu@VM-4-15-ubuntu:~$ 
sudo nano /etc/systemd/system/odoo14.service

1.2. Configuration file

[Unit]
Description=Odoo14
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo14
PermissionsStartOnly=true
User=odoo14
Group=odoo14
ExecStart=/opt/odoo14/odoo-venv/bin/python3 /opt/odoo14/odoo/odoo-bin -c /etc/odoo14.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

1.3. Notify systemd that a new Unit file exists

ubuntu@VM-4-15-ubuntu:~$ 
sudo systemctl daemon-reload

2. Start the Odoo service and start it at startup by running the following command

2.1. Start odoo service

ubuntu@VM-4-15-ubuntu:~$ 
sudo systemctl enable --now odoo14

2.2. Verify odoo service status

ubuntu@VM-4-15-ubuntu:~$ 
sudo systemctl status odoo14
  • Log at this time
● odoo14.service - Odoo14
     Loaded: loaded (/etc/systemd/system/odoo14.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-09-29 11:45:56 CST; 1min 8s ago
   Main PID: 122914 (python3)
      Tasks: 4 (limit: 4608)
     Memory: 63.5M
     CGroup: /system.slice/odoo14.service
             └─122914 /opt/odoo14/odoo-venv/bin/python3 /opt/odoo14/odoo/odoo-bin -c /etc/odoo14.conf

Sep 29 11:45:56 VM-4-15-ubuntu systemd[1]: Started Odoo14.
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,422 122914 INFO ? odoo: Odoo version 14.0
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,423 122914 INFO ? odoo: Using configuration file at /etc/odoo14.conf
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,423 122914 INFO ? odoo: addons paths: ['/opt/odoo14/odoo/odoo/addons', '/opt/odoo14/.local/share/Odoo/addons/14.0', '/opt/odoo14/odoo/addons']
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,423 122914 INFO ? odoo: database: odoo14@localhost:5432
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,595 122914 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,807 122914 INFO ? odoo.service.server: HTTP service (werkzeug) running on localhost.localdomain:8069

2.3. View the messages recorded by Odoo service

ubuntu@VM-4-15-ubuntu:~$ 
sudo journalctl -u odoo14
  • Log at this time
-- Logs begin at Wed 2021-09-29 10:23:55 CST, end at Wed 2021-09-29 11:49:04 CST. --
Sep 29 11:45:56 VM-4-15-ubuntu systemd[1]: Started Odoo14.
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,422 122914 INFO ? odoo: Odoo version 14.0
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,423 122914 INFO ? odoo: Using configuration file at /etc/odoo14.conf
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,423 122914 INFO ? odoo: addons paths: ['/opt/odoo14/odoo/odoo/addons', '/opt/odoo14/.local/share/Odoo/addons/14.0', '/opt/odoo14/odoo/addons']
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,423 122914 INFO ? odoo: database: odoo14@localhost:5432
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,595 122914 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
Sep 29 11:45:57 VM-4-15-ubuntu odoo14[122914]: 2021-09-29 03:45:57,807 122914 INFO ? odoo.service.server: HTTP service (werkzeug) running on localhost.localdomain:8069

5, The previous steps are correct, but the service cannot be started

Attention, attention!!!
There seems to be no error at this time. If you directly go to the web page to visit your own server ip:8069, you will be prompted with an internal server error
At this time, if you go back and look at the status and log information, you will find that

ubuntu@VM-4-15-ubuntu:~$ sudo systemctl status odoo14
● odoo14.service - Odoo14
     Loaded: loaded (/etc/systemd/system/odoo14.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-09-29 11:45:56 CST; 5min ago
   Main PID: 122914 (python3)
      Tasks: 4 (limit: 4608)
     Memory: 69.9M
     CGroup: /system.slice/odoo14.service
             └─122914 /opt/odoo14/odoo-venv/bin/python3 /opt/odoo14/odoo/odoo-bin -c /etc/odoo14.conf

Sep 29 11:51:18 VM-4-15-ubuntu odoo14[122914]:   File "/opt/odoo14/odoo/odoo/sql_db.py", line 248, in __init__
Sep 29 11:51:18 VM-4-15-ubuntu odoo14[122914]:     self._cnx = pool.borrow(dsn)
Sep 29 11:51:18 VM-4-15-ubuntu odoo14[122914]:   File "/opt/odoo14/odoo/odoo/sql_db.py", line 558, in _locked
Sep 29 11:51:18 VM-4-15-ubuntu odoo14[122914]:     return fun(self, *args, **kwargs)
Sep 29 11:51:18 VM-4-15-ubuntu odoo14[122914]:   File "/opt/odoo14/odoo/odoo/sql_db.py", line 624, in borrow
Sep 29 11:51:18 VM-4-15-ubuntu odoo14[122914]:     result = psycopg2.connect(
Sep 29 11:51:18 VM-4-15-ubuntu odoo14[122914]:   File "/opt/odoo14/odoo-venv/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect
Sep 29 11:51:18 VM-4-15-ubuntu odoo14[122914]:     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
Sep 29 11:51:18 VM-4-15-ubuntu odoo14[122914]: psycopg2.OperationalError: FATAL:  password authentication failed for user "odoo14"
Sep 29 11:51:18 VM-4-15-ubuntu odoo14[122914]: FATAL:  password authentication failed for user "odoo14" - - -

You will be prompted that the password of odoo14 user is wrong. At this time, you think of going to the pg database to change the password of user 14

1. Operate PostgreSQL

1.1. Log in to PostgreSQL

ubuntu@VM-4-15-ubuntu:~$ 
sudo -u postgres psql

1.2. Modify the login password of PostgreSQL

postgres=# ALTER USER odoo14 WITH PASSWORD 'newpassword';
ALTER ROLE

1.3. Exit PostgreSQL

postgres=# \q

1.4. Restart PostgreSQL

ubuntu@VM-4-15-ubuntu:~$ 
sudo service postgresql restart

Tags: git PostgreSQL Ubuntu odoo

Posted on Tue, 28 Sep 2021 23:50:48 -0400 by 44justin