如何在Debian 10(Buster)Linux上安装ODOO 13

时间:2020-02-23 14:32:48  来源:igfitidea点击:

ODOO是一组流行的基于Web的开源业务应用程序,以解决所有业务需求和需求。
本教程已写入,帮助Linux用户在Debian 10(Buster)Linux上安装ODOO。
ODOO包括一系列业务应用此类CRM,建设器,电子商务,仓库管理,项目管理,计费和会计,销售点,人力资源,营销,制造,购买管理只是提及一些。

在Debian 10(Buster)Linux上安装ODOO ERP

所有我们需要的ODOO包都可以在Debian和ODOO存储库上添加。
我们不会做任何手动建设的软件包。
现在潜入Debian 10 Linux上的Odoo安装。

第1步:更新系统

首先更新Debian Linux。

sudo apt update
sudo apt -y upgrade

执行升级时,必须重新启动。

sudo reboot

第2步:安装PostgreSQL数据库

ODOO使用PostgreSQL数据库作为其数据的主要存储。
PostgreSQL数据库服务器必须在我们的Debian系统上手动安装。

在Debian上安装PostgreSQL 12

第3步:安装wkhtmltopdf

ODOO需要WKHTMLTOPDF进行报告生成和打印。
上游Debian存储库中可用的WKHTMLTOPDF的版本不支持标题和页脚,因此它不被用作直接依赖性。

在Ubuntu 18.04/Debian 10 Linux上安装WKHTMLTopdf&wkhtmltoImage

第4步:在Debian 10上安装ODOO 13(Buster)

在在Debian 10(Buster)上安装ODOO 13之前,我们需要将ODOO APT存储库添加到本地系统。

wget -O - https://nightly.odoo.com/odoo.key | sudo apt-key add 
echo "deb http://nightly.odoo.com/13.0/nightly/deb/./" | sudo tee /etc/apt/sources.list.d/odoo.list

添加存储库后,请更新APT缓存并在Debian 10上安装ODOO 13.

sudo apt update
sudo apt install odoo

在Debian 10上安装ODOO 13后,服务将自动启动。

$systemctl status odoo
 ● odoo.service - Odoo Open Source ERP and CRM
    Loaded: loaded (/lib/systemd/system/odoo.service; enabled; vendor preset: enabled)
    Active: active (running) since Sat 2019-10-19 20:57:11 UTC; 20s ago
  Main PID: 8793 (odoo)
     Tasks: 4 (limit: 4719)
    Memory: 61.5M
    CGroup: /system.slice/odoo.service
            └─8793 /usr/bin/python3 /usr/bin/odoo --config /etc/odoo/odoo.conf --logfile /var/log/odoo/odoo-server.log
 Oct 19 20:57:11 deb10 systemd[1]: Started Odoo Open Source ERP and CRM.

设置服务以启动每个系统重新启动。

$sudo systemctl enable --now odoo

ODOO服务应绑定到TCP端口8069启动后。

$ss -tunelp | grep 8069
tcp   LISTEN  0       128                  0.0.0.0:8069           0.0.0.0:*      uid:113 ino:1906251 sk:d <->

第5步:配置nginx代理(没有SSL) - 不推荐

将nginx安装到系统上:

sudo apt -y install nginx vim

为ODOO创建新的配置文件。

sudo vim /etc/nginx/conf.d/odoo.conf

修改此配置代码段以适合设置。

# Odoo Upstreams
upstream odooserver {
 server 127.0.0.1:8069;
}
server {
    listen 80;
    server_name erp.theitroad.com;
    access_log /var/log/nginx/odoo_access.log;
    error_log /var/log/nginx/odoo_error.log;

    # Proxy settings
    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;
    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;
    # Request for root domain
    location/{
       proxy_redirect off;
       proxy_pass http://odooserver;
    }
    # Cache static files
    location ~* /web/static/{
        proxy_cache_valid 200 90m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://odooserver;
    }
    # Gzip
    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
    gzip on;
}

我的服务域在此示例中是ERP.ONITOAD.COM,用正确的域替换它以与ODOO一起使用。
外部访问也需要有效的DNS记录。

检查配置语法:

$sudo nginx  -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

如果设置正常,请重新启动nginx服务。

sudo systemctl restart nginx

步骤6:配置Nginx代理(带SSL证书) - 推荐

始终建议使用SSL加密进行生产部署。
Let’s Encrypt 是一个免费的SSL,我们可以在设置中使用。

获取让我们为域加密SSL证书。

wget https://dl.eff.org/certbot-auto
chmod +x certbot-auto
sudo mv certbot-auto /usr/local/bin/certbot-auto
sudo systemctl stop nginx
export DOMAIN="erp.theitroad.com"
export EMAIL="Hyman@theitroad"
sudo /usr/local/bin/certbot-auto certonly --standalone -d ${DOMAIN} --preferred-challenges http --agree-tos -n -m ${EMAIL} --keep-until-expiring

如果执行通过,将打印出证书和链文件的路径。

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/erp.theitroad.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/erp.theitroad.com/privkey.pem
   Your cert will expire on 2017-01-17. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again. To non-interactively renew *all* of your certificates, run
   "certbot-auto renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:
   Donating to ISRG/Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

创建Cron续订证书。

$sudo crontab -e
15 3 * * * /usr/local/bin/certbot-auto renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx"

创建nginx配置文件。

sudo vim /etc/nginx/conf.d/odoo.conf

粘贴下面的文件并修改以适合环境。

# Odoo Upstreams
upstream odooserver {
 server 127.0.0.1:8069;
}
# http to https redirection
server {
    listen 80;
    server_name erp.theitroad.com;
    return 301 https://erp.theitroad.com$request_uri;
}
server {
    listen 443 ssl;
    server_name erp.theitroad.com;
    access_log /var/log/nginx/odoo_access.log;
    error_log /var/log/nginx/odoo_error.log;
   
   # SSL
    ssl_certificate /etc/letsencrypt/live/erp.theitroad.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/erp.theitroad.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/erp.theitroad.com/chain.pem;

    # Proxy settings
    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;
    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;
    # Request for root domain
    location/{
       proxy_redirect off;
       proxy_pass http://odooserver;
    }
    # Cache static files
    location ~* /web/static/{
        proxy_cache_valid 200 90m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://odooserver;
    }
    # Gzip Compression
    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
    gzip on;
}

验证nginx配置。

$sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

重新启动nginx。

sudo systemctl restart nginx

第6步:访问Debian 10 Linux上的ODOO

从Web的域名访问ODOO网页 - https://dnshostname

设置管理员用户的数据库名称,管理员用户电子邮件地址和密码。

输入必填详细信息以创建数据库。
单击"创建数据库"后,我们将从可以安装ODOO业务应用程序的位置重定向到管理页面。