Installing Odoo from the source
Ready-to-install Odoo packages can be found at
nightly.odoo.com
, available as Windows (.exe
), Debian (.deb
), CentOS (.rpm
), and source code tarballs (.tar.gz
).
As developers, we will prefer installing them directly from the GitHub repository. This will end up giving us more control over versions and updates.
To keep things tidy, let's work in a /odoo-dev
directory inside our home
directory.
Note
Throughout the book, we will assume that /odoo-dev
is the directory where your Odoo server is installed.
First, make sure you are logged in as the user we created now or during the installation process, not as the root
. Assuming your user is odoo
, confirm it with the following command:
$ whoami
odoo
$ echo $HOME
/home/odoo
Now we can use this script. It shows us how to install Odoo from the source into a Debian/Ubuntu system.
First, install the basic dependencies to get us started:
$ sudo apt-get update && sudo apt-get upgrade #Install system updates
$ sudo apt-get install git # Install Git
$ sudo apt-get install npm # Install NodeJs and its package manager
$ sudo ln -s /usr/bin/nodejs /usr/bin/node # call node runs nodejs
$ sudo npm install -g less less-plugin-clean-css #Install less compiler
Starting from version 9.0, the Odoo web client requires the less
CSS preprocessor to be installed in the system, in order for web pages to be rendered correctly. To install this, we need Node.js and npm.
Next, we need to get the Odoo source code and install all its dependencies. The Odoo source code includes an utility script, inside the odoo/setup/
directory, to help us install the required dependencies in a Debian/Ubuntu system:
$ mkdir ~/odoo-dev # Create a directory to work in
$ cd ~/odoo-dev # Go into our work directory
$ git clone https://github.com/odoo/odoo.git -b 10.0 --depth=1 # Get Odoo source code
$ ./odoo/setup/setup_dev.py setup_deps # Installs Odoo system dependencies
$ ./odoo/setup/setup_dev.py setup_pg # Installs PostgreSQL & db superuser for unix user
At the end, Odoo should be ready to use. The ~
symbol is a shortcut for our home
directory (for example, /home/odoo
). The git -b 10.0
option tells Git to explicitly download the 10.0 branch of Odoo. At the time of writing, this is redundant since 10.0 is the default branch; however, this may change, so it may make the script future-proof. The --depth=1
option tells Git to download only the last revision, instead of the full change history, making the download smaller and faster.
To start an Odoo server instance, just run:
$ ~/odoo-dev/odoo/odoo-bin
Tip
In Odoo 10, the odoo.py
script, used in previous versions to start the server, was replaced with odoo-bin
.
By default, Odoo instances listen on port 8069
, so if we point a browser to http://<server-address>:8069
, we will reach these instances. When we access it for the first time, it shows us an assistant to create a new database, as shown in the following screenshot:
As a developer, we will need to work with several databases, so it's more convenient to create them from the command line, so we will learn how to do this. Now press
Ctrl
+
C
in the terminal to stop the Odoo server and get back to the command prompt.