odoo15 安装部署详细教程
apt-get update
apt-get install git
#安装python3, 版本大于3.75以上.
sudo apt-get install python3-dev
sudo apt install python3-pip
pip install --upgrade pip
#安装数据库
sudo apt-get install postgresql -y
sudo apt-get install postgresql-contrib -y
#添加数据库用户
sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
#修改数据库配置
vim /etc/postgresql/10/main/postgresql.conf
listen 改为 *
vim /etc/postgresql/10/main/pg_hba.conf
#local all postgres trust
#local all odoo md5
#添加odoo系统用户
sudo adduser odoo
sudo mkdir /var/log/odoo
sudo chown -R odoo:odoo /var/log/odoo
#获取代码
cd /opt
git clone https://gitee.com/mirrors/odoo.git -b 15.0 --depth=1
chown -R odoo:odoo /opt/odoo
#安装依赖
sudo apt-get install python3-ldap
sudo apt-get install python3-psycopg2
sudo pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
#安装中文字体
sudo apt-get install fonts-wqy-zenhei
#安装wkhtmltopdf 这个需要完善
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb
sudo dpkg -i wkhtmltox_0.12.5-1.trusty_amd64.deb
apt install -f
# 查看可用的版本 apt-cache madison wkhtmltopdf
apt install wkhtmltopdf
#运行测试
su odoo
python3 odoo/odoo-bin -c local.conf
====
[options]
addons_path = /opt/odoo/odoo/addons,/opt/odoo/addons,/opt/addons_15e
admin_passwd = admin15
db_user = odoo
db_password = odoo
;dbfilter =
logfile = /var/log/odoo/odoo.log
===
#添加启动服务 /etc/systemd/system/odoo16.service
====================
[Unit]
Description=odoo
After=postgresql.service
[Service]
Type=simple
User=odoo
Group=odoo
ExecStart=/opt/odoo/odoo-bin -c /opt/local.conf
[Install]
WantedBy=multi-user.target
==================================
chmod + x /etc/systemd/system/odoo16.service #修改启动文件权限
systemctl daemon-reload # 重载进程配置
#查看服务知否正常
service odoo restart
service odoo status
#查看日志是否生成
tail -f /var/log/odoo/odoo.log
# 部署代理
sudo apt-get install nginx -y
##################/etc/nginx/sites-enabled
server{
listen 80;
#listen 443 ssl;
server_name odoo;
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;
#ssl_certificate /etc/nginx/ssl/5376128_www.biotephy.com.pem; ##ssl证书
#ssl_certificate_key /etc/nginx/ssl/5376128_www.biotephy.com.key;
#ssl_protocols TLSv1.2 TLSv1.1 TLSv1; ##协议
#keepalive_timeout 120;
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;
}
}
# 常见问题
psycopg2 安装报错 , 可以 pip isntall psycopg2-binary 代替