为了方便后面的看客老爷们的极致体验, 本人在代码中都会把路径写进来,希望各位看客老爷们参考的时候多留意-路径跟代码我会分行显示
ubuntu@VM-4-15-ubuntu:~$
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
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
ubuntu@VM-4-15-ubuntu:~$
sudo apt-get update
ubuntu@VM-4-15-ubuntu:~$
sudo apt-get upgrade
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
ubuntu@VM-4-15-ubuntu:~$
sudo useradd -m -d /opt/odoo14 -U -r -s /bin/bash odoo14
ubuntu@VM-4-15-ubuntu:~$
sudo apt install postgresql
ubuntu@VM-4-15-ubuntu:~$
sudo su - postgres -c "createuser -s odoo14"
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
ubuntu@VM-4-15-ubuntu:~$ pwd
/home/ubuntu
ubuntu@VM-4-15-ubuntu:~$
sudo apt-get install ./wkhtmltox_0.12.6-1.focal_amd64.deb
ubuntu@VM-4-15-ubuntu:~$
sudo su - odoo14
odoo14@VM-4-15-ubuntu:~$
git clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0 /opt/odoo14/odoo
odoo14@VM-4-15-ubuntu:~$
cd /opt/odoo14
odoo14@VM-4-15-ubuntu:~$
python3 -m venv odoo-venv
odoo14@VM-4-15-ubuntu:~$
source odoo-venv/bin/activate
(odoo-venv) odoo14@VM-4-15-ubuntu:~$
(odoo-venv) odoo14@VM-4-15-ubuntu:~$
pip3 install wheel
(odoo-venv) odoo14@VM-4-15-ubuntu:~$
pip3 install -r odoo/requirements.txt
(odoo-venv) odoo14@VM-4-15-ubuntu:~$
deactivate
odoo14@VM-4-15-ubuntu:~$
odoo14@VM-4-15-ubuntu:~$
exit
ubuntu@VM-4-15-ubuntu:~$
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
ubuntu@VM-4-15-ubuntu:~$
sudo nano /etc/systemd/system/odoo14.service
[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
ubuntu@VM-4-15-ubuntu:~$
sudo systemctl daemon-reload
ubuntu@VM-4-15-ubuntu:~$
sudo systemctl enable --now odoo14
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; 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
ubuntu@VM-4-15-ubuntu:~$
sudo journalctl -u odoo14
-- 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
注意注意!!!
这个时候看似没有错误,如果你直接去网页访问你自己的服务器ip:8069 就会提示内部服务器错误
这个时候你再回去看看状态以及日志信息,就会发现
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" - - -
会提示odoo14用户的密码错误,这个时候想到的就是去pg数据库更换用户14的密码
ubuntu@VM-4-15-ubuntu:~$
sudo -u postgres psql
postgres=# ALTER USER odoo14 WITH PASSWORD 'newpassword';
ALTER ROLE
postgres=# \q
ubuntu@VM-4-15-ubuntu:~$
sudo service postgresql restart