Odoo 11 生产环境搭建(Debian 4.9.51-1)

简单记录Odoo 11.0 社区版安装过程

1. 创建个odoo用户和组

1
2
3
4
5
6
7
8
9
OE_USER="odoo"
OE_HOME="/$OE_USER"

#Python env
OE_PYTHON_ENV="${OE_HOME}/python_env"

adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER >> ./install_log
#The user should also be added to the sudo'ers group.
adduser $OE_USER sudo >> ./install_log

2. 安装依赖

1
apt install libjpeg-dev curl wget git python-pip gdebi-core python-dev libxml2-dev libxslt1-dev zlib1g-dev libldap2-dev libsasl2-dev node-clean-css node-less python-gevent -y >> ./install_log

3. 安装wkhtmltox

1
2
3
wget --quiet https://nightly.odoo.com/extra/wkhtmltox-0.12.1.2_linux-jessie-amd64.deb

sudo dpkg -i wkhtmltox-0.12.1.2_linux-jessie-amd64.deb

4. Git 下载源码

1
2
3
OE_VERSION=11.0
OE_HOME_EXT="$OE_HOME/"
git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/ >> ./install_log

5. 安装依赖

1
2
3
4
5
pip install  virtualenv >> ./install_log
mkdir $OE_PYTHON_ENV >> ./install_log
virtualenv $OE_PYTHON_ENV -p /usr/bin/python3.6 >> ./install_log
source /odoo/python_env/bin/activate && pip3 install -r $OE_HOME_EXT/requirements.txt >> ./install_log
deactivate

6. 配置systemd服务

文件位置
/etc/systemd/system/$OE_CONFIG.service

内容

1
2
3
4
5
6
7
8
9
[Unit]
Description=Odoo server
Documentation=https://odoo.com
After=network.target

[Service]
User=odoo
Group=odoo
ExecStart=$OE_PYTHON_ENV/bin/python $OE_HOME_EXT/odoo-bin --config=/etc/${OE_CONFIG}.conf

7. 设置开机启动

1
systemctl enable $OE_CONFIG.service

8. 启动服务

1
systemctl start $OE_CONFIG.service