sudo apt-get update
sudo apt-get upgrade
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
sudo useradd -m -d /opt/odoo14 -U -r -s /bin/bash odoo14
sudo apt install postgresql
sudo su - postgres -c "createuser -s odoo14"
如若下载源码,使用3.1,无需下载,略过3.1
sudo apt-get install wkhtmltopdf
sudo su - odoo14
git clone git://www.github.com/odoo/odoo --depth 1 --branch 14.0 /opt/odoo14/odoo
推荐
git clone -b 14.0 https://github.com/odoo/odoo.git /opt/odoo14/
cd /opt/odoo14
python3 -m venv venv-odoo
source venv-odoo/bin/activate
pip3 install wheel
pip3 install -r requirements.txt
deactivate
# odoo14@VM-4-15-ubuntu:~$
exit
# ubuntu@VM-4-15-ubuntu:~$
sudo vim odoo14.conf
[options]
; This is the password that allows database operations:
db_host = localhost
db_port = 5432
db_user = odoo14
db_password = odoo14
http_port = 8069
longpolling_port = 8072
addons_path = /opt/odoo14/addons
;bin_path = D:\soft\wkhtml\detail\wkhtmltopdf\bin
data_dir = /opt/odoo14/addons/Odoo-data
logfile = /opt/odoo14/odoo14.log
server_wide_modules = base,web
timezone = Asia/Shanghai
;proxy_mode = True # 配合 Nginx 使用
workers = 9 ;(cpu*2)+1
max_cron_threads = 2
translate_modules = ['all']
sudo vim /etc/systemd/system/odoo14.service
[Unit]
Description=Odoo14
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo14
PermissionsStartOnly=true
ExecStart=/opt/odoo14/venv-odoo/bin/python3 /opt/odoo14/odoo-bin -c /opt/odoo14/odoo14.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl restart odoo14.service
sudo systemctl enable --now odoo14
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
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 就会提示内部服务器错误
这个时候你再回去看看状态以及日志信息,就会发现
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的密码
sudo -u postgres psql
ALTER USER odoo14 WITH PASSWORD 'odoo14';
ALTER ROLE:表示成功了
postgres=# \q
sudo service postgresql restart
GRANT ALL PRIVILEGES ON DATABASE postgres to postgres; 给postgres用户添加创建数据库的属性
\password:设置当前登录用户的密码
\h:查看SQL命令的解释,比如\h select。
\?:查看psql命令列表。
\l:列出所有数据库。
\c [database_name]:连接其他数据库。
\d:列出当前数据库的所有表格。
\d [table_name]:列出某一张表格的结构。
\du:列出所有用户。
\e:打开文本编辑器。
\conninfo:列出当前数据库和连接的信息。
\password [user]: 修改用户密码
\q:退出
Ubuntu 处理odoo日志
ubuntu 利用sftp上传文件