centos8安装odoo14
程序员文章站
2022-06-11 09:10:46
...
sudo dnf update -y # 升级系统安装包
# 安装所需依赖
sudo dnf install python3 python3-devel git gcc redhat-rpm-config libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel curl unzip -y
# 安装wkhtmltopdf
sudo dnf install https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos8.x86_64.rpm
# 验证安装版本
wkhtmltopdf --version
# 安装 PostgreSQL
sudo dnf install postgresql postgresql-server postgresql-contrib -y
# 初始化数据库
sudo postgresql-setup initdb
# 启动服务
sudo systemctl start postgresql
sudo systemctl enable postgresql
# 创建数据库用户(需与下面的系统用户名称保持一致)
sudo su - postgres -c "createuser -s odoo14"
# 创建系统用户
sudo useradd -m -U -r -d /opt/odoo14 -s /bin/bash odoo14
# 创建目录
sudo mkdir /opt/odoo
sudo chown odoo14: /opt/odoo
# 切换用户、克隆代码
sudo su - odoo14
git clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0 /opt/odoo/odoo14
# 创建自定义 addon 文件夹
mkdir /opt/odoo/odoo14-custom-addons
# 创建虚拟环境
cd /opt/odoo14 && python3 -m venv odoo14-venv
# **虚拟环境
source odoo14-venv/bin/activate
# 在虚拟环境中安装 Python依赖包
pip install wheel
pip install -r /opt/odoo/odoo14/requirements.txt
# 退出当前用户
deactivate && exit
# 创建日志文件并授权
sudo mkdir /var/log/odoo14 && sudo touch /var/log/odoo14/odoo14.log
sudo chown -R odoo14: /var/log/odoo14/
编辑配置文件(请修改master_password)
# sudo vi /etc/odoo14.conf
[options]
; This is the password that allows database operations:
admin_passwd = master_password
db_host = False
db_port = False
db_user = odoo14
db_password = False
xmlrpc_port = 8069
; longpolling_port = 8072
logfile = /var/log/odoo14/odoo14.log
logrotate = True
addons_path = /opt/odoo/odoo14/addons,/opt/odoo/odoo14-custom-addons
proxy_mode = True # 配合 Nginx 使用
创建systemd启动文件
# sudo vi /etc/systemd/system/odoo14.service
[Unit]
Description=Odoo14
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo14
PermissionsStartOnly=true
User=odoo14
Group=odoo14
ExecStart=/opt/odoo14/odoo14-venv/bin/python3 /opt/odoo/odoo14/odoo-bin -c /etc/odoo14.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
载入配置文件并启动服务
sudo systemctl daemon-reload
sudo systemctl start odoo14
sudo systemctl enable odoo14
# 查看启动状态
sudo systemctl status odoo14
安装 Nginx 并进行配置(以下 yourdomain.com 仅为示例,请使用自己的域名,测试目的可能过 host绑定来使用该域名)
sudo dnf install nginx -y
# sudo vi /etc/nginx/conf.d/yourdomain.com.conf
upstream odooserver {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
server {
listen 80;
server_name yourdomain.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;
# log files
access_log /var/log/nginx/yourdomain.com.log;
error_log /var/log/nginx/yourdomain.com.log;
# Handle longpoll requests
location /longpolling {
proxy_pass http://odoochat;
}
# 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_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
启动 Nginx
sudo systemctl start nginx
sudo systemctl enable nginx
注意系统默认可能开启 SELinux 而导致80端口无法直接访问
setenforce 0
# vi /etc/selinux/config
SELINUX=disabled
上一篇: 搜狗浏览器不能保存密码该怎么办?
推荐阅读
-
ApowerREC屏幕录像机如何安装?ApowerREC屏幕录像机安装破解教程
-
木疙瘩动画制作软件如何使用?木疙瘩动画制作软件安装使用教程
-
阿里云服务器ECS上ubuntu安装nginx后默认站点页面打开错误,显示无法访问此网站
-
win7系统安装网银助手时提示您尚未正确安装错误的两种解决方法图文教程
-
win7安装Office提示1603/1902错误解决方法
-
PTC Arbortext Editor 7.1中文破解版安装许可激活图文详细教程
-
service pack3下载怎么安装(service pack3安装教程)
-
XMind 8 Update 7破解补丁中文授权一键注册安装破解教程(免序列号)
-
Artensoft Photo Collage Maker Pro安装汉化破解教程
-
ANSYS Electronics Suite Desktop 18.0增强套件破解安装图文教程