1.创建Ubuntu虚拟机并安装系统
vm create -t ubuntu -s 1000G odoo
vm install -f odoo /nas/data/iso/Ubuntu22.04.iso
vm restart odoo
2.Ubuntu安装Postgresql
sudo apt update
sudo apt install postgresql -y
CREATE USER myuser WITH PASSWORD 'mypassword';
CREATE DATABASE mydb OWNER myuser;
如果您想为新用户赋予管理数据库的权限,可以使用CREATE ROLE
命令创建一个具有管理员权限的用户:
CREATE ROLE myuser WITH LOGIN CREATEDB CREATEROLE PASSWORD 'mypassword';
3.Ubuntu安装Odoo
wget -q -O - https://nightly.odoo.com/odoo.key | sudo gpg --dearmor -o /usr/share/keyrings/odoo-archive-keyring.gpg
echo 'deb [signed-by=/usr/share/keyrings/odoo-archive-keyring.gpg] https://nightly.odoo.com/17.0/nightly/deb/ ./' | sudo tee /etc/apt/sources.list.d/odoo.list
sudo apt-get update && sudo apt-get install odoo
更多参考Odoo官方手册
4.Nginx穿透代理配置文件
server {
listen 80;
listen [::]:80;
server_name odoo.mpoes.com;
rewrite ^(.*) https://$host$1 permanent;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name odoo.mpoes.com;
client_max_body_size 10M;
ssl_certificate /usr/local/etc/letsencrypt/live/odoo.mpoes.com/fullchain.pem;
ssl_certificate_key /usr/local/etc/letsencrypt/live/odoo.mpoes.com/privkey.pem;
ssl_session_timeout 30m;
ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
location / {
# Add Headers for odoo proxy mode
proxy_pass http://47.242.20.105:8069;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 200;
proxy_read_timeout 600;
send_timeout 600;
}
## location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf|txt)$ {
## root /path/to/odoo/static/files; # 静态文件目录
## expires 30d;
## }
location /longpolling {
proxy_pass http://localhost:8069;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 200;
proxy_read_timeout 600;
send_timeout 600;
}
## gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
## gzip on;
}
5.下载企业版源码 替换 社区版源码:
替换路径为:/usr/lib/python3/dist-packages/odoo
6.配置数据库到期时间:
打开“激活开发者模式(使用资源测试)”,设置 -> 技术 -> 参数 -> 系统参数 -> 新建值。具体如下:
database.expiration_date
2088-08-08 08:08:08
保存然后刷新,已经激活到2088年