上QQ阅读APP看书,第一时间看更新
How to do it...
To install Odoo for production, you need to carry out the following steps:
- As root, install the dependencies and build dependencies:
# apt-get update
# apt-get install git python3.5 postgresql nano virtualenv \ gcc python3.5-dev libxml2-dev libxslt1-dev \ libevent-dev libsasl2-dev libldap2-dev libpq-dev \ libpng-dev libjpeg-dev node-less node-clean-css \
xfonts-75dpi xfonts-base wget xz-utils # wget -O wkhtmltox.tar.xz \
https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
# tar xvf wkhtmltox.tar.xz
# mv wkhtmltox/lib/* /usr/local/lib/
# mv wkhtmltox/bin/* /usr/local/bin/
# mv wkhtmltox/share/man/man1 /usr/local/share/man/
- As root, create a user called odoo:
# adduser odoo
- Configure the PostgreSQL database:
# sudo -u postgres createuser odoo # sudo -u postgres createdb -O odoo odoo_project
- As odoo, clone the project repository:
# su odoo $ mkdir ~/odoo-prod $ cd ~/odoo-prod $ git clone https://github.com/yourlogin/project.git project $ mkdir -p project/src
- As the odoo user, clone the Odoo source code:
$ cd project/src $ git clone -b 11.0 --single-branch
https://github.com/odoo/odoo.git odoo
- Create virtualenv and install the dependencies:
$ virtualenv -p python3 ~/env-odoo-11.0 $ source ~/env-odoo-11.0/bin/activate $ pip3 install -r odoo/requirements.txt
- Clone all third-party addon repositories in the project/src subdirectory:
$ git clone -b 11.0 https://github.com/OCA/partner-contact.git
- Create the ~/odoo-prod/project/bin directory:
$ mkdir ~/odoo-prod/project/bin
- Create a script to easily start Odoo in the production environment in ~/odoo-prod/project/bin/start-odoo:
#! /bin/sh PYTHON=~odoo/env-odoo-11.0/bin/python3 ODOO=~odoo/odoo-prod/project/src/odoo/odoo-bin CONF=~odoo/odoo-prod/project/production.conf ${PYTHON} ${ODOO} -c ${CONF} "$@"
- Make the script executable:
$ chmod +x ~/odoo-prod/project/bin/start-odoo
- As root, uninstall gcc:
# apt-get remove gcc