odoo9 部署步详细步骤
sudo apt-get update
sudo apt-get dist-upgrade
一:安装和配置pg
sudo apt-get install postgresql
sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
exit
#修改 postgresql.conf (打开listen端口), pg_hba.conf , 测试pguser odoo 可登陆。 主要包含如下2行,
#local all postgres trust
#local all odoo peer
二: 安装python依赖, lessc, wkhtmltopdf 等
#pylib
sudo apt-get install python-pip node-less python-dateutil python-docutils python-feedparser python-gdata \
python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid \
python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing \
python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject \
python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-requests python-pypdf \
python-passlib unzip python-decorator python-xlrd
#lessc
sudo apt-get install -y nodejs
apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less less-plugin-clean-css
#wkhtmltopdf 版本.01以上, 安装完 , wkhtmltopdf --version 测试版本
sudo apt-get install wkhtmltopdf
三:部署odoo
创建odoo 系统用户。
adduser odoo
创建log, datadir, dbback 目录, odoo用户需要有权限
sudo chown -R odoo:odoo dirname
配置 openerp-server.conf, 修改的参数 addons_path data_dir dbfilter db_user db_password
配置好测试下启动, 日志文件正确,能正常打开页面,可以打印pdf
四:设置supervisor 自动启动
sudo apt-get install supervisor
添加odoo9的conf 启动。 /etc/supervisor/conf.d/odoo9.conf
[program:odoo9]
command = python odoo/odoo.py -c local.conf
directory = /opt/odoo9/
user=odoo
五:nginx反向代理和性能优化
sudo apt-get isntall nginx
server{
listen 80;
server_name odoo9;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
client_max_body_size 200m;
keepalive_timeout 60;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://0.0.0.0:8069;
proxy_redirect off;
proxy_buffering off;
proxy_read_timeout 1500;
}
location /longpolling/ {
proxy_pass http://0.0.0.0:8072/longpolling/;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 1500;
}
}
openerp-server.conf 中的选项 works , limit_time_cpu =600 limit_time_read=10000