Odoo 11 Development Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

How to do it...

To install Odoo from source, you need to follow these steps:

  1. Run the following commands to install the main dependencies:
$ sudo apt-get update
$ sudo apt-get install -y git python3.5 postgresql nano virtualenv
\ xz-utils wget fontconfig libfreetype6 libx11-6 libxext6 libxrender1 \ node-less node-clean-css xfonts-75dpi
  1. Download and install wkhtmltopdf:
$ 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
$ sudo mv wkhtmltox/lib/ /usr/local/lib/
$ sudo mv wkhtmltox/bin/ /usr/local/bin/
$ sudo mv wkhtmltox/share/man/man1 /usr/local/share/man/
  1. Now, use this to install the build dependencies:
$ sudo apt-get install -y gcc python3.5-dev libxml2-dev \
libxslt1-dev libevent-dev libsasl2-dev libssl1.0-dev libldap2-dev \
libpq-dev libpng-dev libjpeg-dev
  1. Configure PostgreSQL:
$ sudo -u postgres createuser --createdb $(whoami)
$ createdb $(whoami)
  1. Configure git:
$ git config --global user.name "Your Name"
$ git config --global user.email youremail@example.com
  1. Clone the Odoo code base:
$ mkdir ~/odoo-dev
$ cd ~/odoo-dev
$ git clone -b 11.0 --single-branch\ https://github.com/odoo/odoo.git
$ cd odoo
  1. Create an odoo-11.0 virtual environment and activate it:
$ virtualenv -p python3 ~/odoo-11.0
$ source ~/odoo-11.0/bin/activate
  1. Install the Python dependencies of Odoo in virtualenv:
$ pip3 install -r requirements.txt
  1. Create and start your first Odoo instances:
$ createdb odoo-test
$ python3 odoo-bin -d odoo-test --addons-path=addons \
--db-filter=odoo-test$
  1. Point your browser to http://localhost:8069 and authenticate it using the admin account and admin as password.

You can download the example code files for this book from your account at: http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files emailed to you directly.

You can download the code files by following these steps:

  • Log in or register to our website using your email address and password
  • Hover the mouse pointer on the SUPPORT tab at the top
  • Click on Code Downloads & Errata
  • Enter the name of the book in the Search box
  • Select the book for which you're looking to download the code files
  • Choose where you purchased this book from in the drop-down menu
  • Click on Code Download

You can also download the Code Files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Note that you need to be logged in to your Packt account.

Once the file is downloaded, ensure that you unzip or extract the folder using the latest version of the following:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux