Centos7 部署 Odoo10.0 生产环境
来源:https://jalena.bcsytv.com/archives/1796
准备工作
# EPEL repository
yum install -y epel-release yum-utils yum-fastestmirror python-pip python-wheel
yum upgrade python-setuptools
pip install --upgrade pip
# Update OS
yum -y update
PostgreSQL安装
# 获取安装源地址:https://yum.postgresql.org/repopackages.php#pg96
yum install -y https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
# 清理缓存
yum clean all
# 查找当前最新的版本
yum -y search postgresql96
yum list | grep postgresql96
# 安装
yum -y install postgresql96-server
# 查看安装好的服务名
systemctl -l | grep postgresql
systemctl list-unit-files | grep postgresql
# 初始化数据库
find / -name postgresql*-setup
/usr/pgsql-9.6/bin/postgresql96-setup initdb
# 设置开机启动
systemctl enable postgresql-9.6
# 启动数据库
systemctl start postgresql-9.6
# 查看服务运行情况
systemctl status postgresql-9.6
# 停止服务
systemctl stop postgresql-9.6
# 重置超级管理员密码
su - postgres -c psql
alter user postgres with password 'new password';
# 查看用户
\du
# 查看帮助
\?
# 退出
\q
# 开启外部访问
# FAQ:https://www.postgresql.org/docs/9.6/static/auth-pg-hba-conf.html
find / -name pg_hba.conf
echo "host odoo all 0.0.0.0/0 md5" >> /var/lib/pgsql/9.6/data/pg_hba.conf
# 开放防火墙postgresql服务
firewall-cmd --permanent --get-services | grep postgresql # 查看防火墙规则文件是否存在
firewall-cmd --add-service=postgresql --permanent
# 重载防火墙
firewall-cmd --reload
# 查看是否开启
firewall-cmd --query-service postgresql
firewall-cmd --list-services
firewall-cmd --list-all
Odoo 安装
# 添加Odoo 10 源
yum-config-manager --add-repo=https://nightly.odoo.com/10.0/nightly/rpm/odoo.repo
# 安装Odoo 10
yum update && yum -y install odoo
# 生成配置文件
odoo --save --config myodoo.cfg --stop-after-init
# 设置开机启动
systemctl enable odoo
# 修改配置
vi /etc/odoo/odoo.conf
# 启动Odoo
systemctl start odoo
# 重启Odoo
systemctl restart odoo
# 停止Odoo
systemctl stop odoo
# 检查运行情况
systemctl status odoo
ps aux | grep odoo
# 查看运行日志
tail -f /var/log/odoo/odoo-server.log
# 开启防火墙
firewall-cmd --zone=public --add-port=8069/tcp --permanent
# 重载规则
firewall-cmd --reload
# 查看是否生效
firewall-cmd --list-all
初始化Odoo
# 切换到Odoo用户
su - odoo
# 进入Odoo Shell
python /usr/bin/odoo shell -c /etc/odoo/odoo.conf -d odoo
打印支持 —— wkhtmltopdf
# https://github.com/wkhtmltopdf/wkhtmltopdf/releases/0.12.2.1/
yum -y install https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm
# 测试
wkhtmltopdf -V