我们使用vultr服务器作为演示,新用户注册还赠送50美金。

https://www.vultr.com/?ref=7773592-4F

sudo apt-get update && sudo apt-get upgrade

sudo apt install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less

sudo useradd -m -d /opt/odoo13 -U -r -s /bin/bash odoo13

安装postgresql数据库

sudo apt install postgresql

安装成功信息

Success. You can now start the database server using:

    /usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start

Ver Cluster Port Status Owner    Data directory              Log file

10  main    5432 down   postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log

update-alternatives: using /usr/share/postgresql/10/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode

创建odoo13用户

sudo su – postgres -c “createuser -s odoo13”

安装PDF打印

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb

安装刚才下载的软件包

sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb

错误提示

N: Download is performed unsandboxed as root as file ‘/root/wkhtmltox_0.12.5-1.bionic_amd64.deb’ couldn’t be accessed by user ‘_apt’. – pkgAcquire::Run (13: Permission denied)

权限不对,修改wkhtmltox_0.12.5-1.bionic_amd64.deb软件权限为777

chmod 777 wkhtmltox_0.12.5-1.bionic_amd64.deb

开始安装odoo

sudo su – odoo13

使用git下载odoo 13

git clone https://www.github.com/odoo/odoo –depth 1 –branch 13.0 /opt/odoo13/odoo

访问odoo 13 目录

cd /opt/odoo13

为odoo创建一个虚拟环境

python3 -m venv odoo-venv

激活我们创建的虚拟环境

source odoo-venv/bin/activate

在虚拟环境安装odoo所需的模块

pip3 install wheel

pip3 install -r odoo/requirements.txt

环境搞定了之后,就基本没什么大问题了。

停止虚拟环境

deactivate

创建自定义模块目录

mkdir /opt/odoo13/odoo-custom-addons

退出虚拟环境,修改odoo的配置文件

exit

修改配置

sudo nano /etc/odoo13.conf

添加或修改addons_path

[options]

; This is the password that allows database operations:

admin_passwd = my_admin_passwd

db_host = False

db_port = False

db_user = odoo13

db_password = False

addons_path = /opt/odoo13/odoo/addons,/opt/odoo13/odoo-custom-addons

创建系统服务

sudo nano /etc/systemd/system/odoo13.service

[Unit]

Description=Odoo13

Requires=postgresql.service

After=network.target postgresql.service

[Service]

Type=simple

SyslogIdentifier=odoo13

PermissionsStartOnly=true

User=odoo13

Group=odoo13

ExecStart=/opt/odoo13/odoo-venv/bin/python3 /opt/odoo13/odoo/odoo-bin -c /etc/odoo13.conf

StandardOutput=journal+console

[Install]

WantedBy=multi-user.target

daemon加载

sudo systemctl daemon-reload

启动odoo 13

sudo systemctl enable –now odoo13

查看odoo13状态

sudo systemctl status odoo13

看到8069说明启动成功了,可以通过IP加8069端口访问。

配置Nginx

sudo nano /etc/nginx/sites-enabled/example.com

配置文件

# Odoo servers

upstream odoo {

 server 127.0.0.1:8069;

}

upstream odoochat {

 server 127.0.0.1:8072;

}

# HTTP -> HTTPS

server {

    listen 80;

    server_name www.example.com example.com;

    include snippets/letsencrypt.conf;

    return 301 https://example.com$request_uri;

}

# WWW -> NON WWW

server {

    listen 443 ssl http2;

    server_name www.example.com;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;

    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;

    include snippets/ssl.conf;

    include snippets/letsencrypt.conf;

    return 301 https://example.com$request_uri;

}

server {

    listen 443 ssl http2;

    server_name example.com;

    proxy_read_timeout 720s;

    proxy_connect_timeout 720s;

    proxy_send_timeout 720s;

    # Proxy headers

    proxy_set_header X-Forwarded-Host $host;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_set_header X-Real-IP $remote_addr;

    # SSL parameters

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;

    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;

    include snippets/ssl.conf;

    include snippets/letsencrypt.conf;

    # log files

    access_log /var/log/nginx/odoo.access.log;

    error_log /var/log/nginx/odoo.error.log;

    # Handle longpoll requests

    location /longpolling {

        proxy_pass http://odoochat;

    }

    # Handle / requests

    location / {

       proxy_redirect off;

       proxy_pass http://odoo;

    }

    # Cache static files

    location ~* /web/static/ {

        proxy_cache_valid 200 90m;

        proxy_buffering on;

        expires 864000;

        proxy_pass http://odoo;

    }

    # Gzip

    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;

    gzip on;

}

重启Nginx

sudo systemctl restart nginx

修改odoo配置

sudo nano /etc/odoo13.conf

添加或修改

proxy_mode = True

sudo systemctl restart odoo13

https://example.com

更改绑定界面

sudo nano /etc/odoo13.conf

xmlrpc_interface = 127.0.0.1

netrpc_interface = 127.0.0.1

重启

sudo systemctl restart odoo13

完成。

如果有odoo实施或者二次开发的业务,可以给我发邮件283475615@qq.com 或者加我QQ:283475615