×
Community Blog How To Install Odoo on Alibaba Cloud

How To Install Odoo on Alibaba Cloud

In this tutorial, you will learn how you can install Odoo version 12 on an Alibaba Cloud ECS instance to run your business from the cloud.

By Bineli Manga, Alibaba Cloud Community Blog author.

Odoo is an Open-source Enterprise Resource Planning software. It is the most used in its category of software, and it is suitable for enterprise-level applications development.

In this tutorial, I will show you how you can install Odoo version 12 on Alibaba Cloud Elastic Compute Service (ECS) instance to run your business from the cloud.

To get back to what exactly Odoo is, Odoo is written in Python and can help a company manage a broad range of internal processes, including: human resources, accounting, finances, and sales, among other things.

Next, compared to commercials alternatives such as SAP ERP, Oracle ERP One, or Microsoft Dynamics, Odoo offers a many advantages, which include the following:

  • open-source code
  • a large community of contributors and builders
  • affordable technical experts
  • easy-to-customize modules

Now when you couple there strengths with the power given by the cloud computing, you can also benefit from:

  • reductions in installation costs
  • reductions in operating and maintaining costs
  • infinite scalability of your services
  • multiple availability zones and regions

Nowadays, there are many Cloud providers out there, but we are going to use Alibaba Cloud provider, since it has a good choice for starting a business in China.

Requirements

To have a running instance of Odoo, here are the requirements your system must meet:

Odoo Editions

The Odoo ERP comes in two different flavors: the Odoo Community Edition, which is both free and open-source, and the Odoo Enterprise edition, which is closed source and the commercial version of it.

For this tutorial, we will use the Odoo Community Edition. The installation steps are not that much different to the enterprise edition, and lucky for us we already have access to the source code of the Open source edition.

Also, when it comes to installing Odoo, you can choose from four different optiona:

  • Online installation: this option is suitable when you want to get a quick view at Odoo features. In this option, you don't need to install anything on a server, since everything is already installed and setup on Odoo's own cloud provider. You can use Odoo Cloud to create demo instances for testing Odoo features or use Odoo Saas offers to run a production ready Odoo instance on the cloud. Here you don't have access to the source code of Odoo and you cannot tweak it based on your specific needs.
  • Packaged installers: this option is suitable for testing Odoo features on-premise, or for dev or long term production Odoo installations. These are Odoo packages installers for Windows and Linux provided by Odoo company. These packages are bundled with all the required dependencies automatically set up so you don't have to bother much and run manual commands to add other packages that may break the stability of your system.
  • Source installs: Odoo source installation is the best one when you try to learn how Odoo works internally or when you have to do some custom developments. Already, this installation option is suitable for Odoo installation when it comes to maintainability options. You have to use concurrent versionning systems such as Git or Svn to easyly update Odoo.
  • Docker images: for those who like containerized environments, you can also use Docker images to deploy Odoo on production servers. This option is suitable for adavanced users who can perfectly determine their needs and calculate the server burdens. You can find all the materials about Odoo installation on docker container on the official Odoo container registry.

In this tutorial, we will choose to do the installation from the source code. We chose the source code install option because it will be more useful to better understand how Odoo works and later how you can customized its working.

Installation

As we discussed before, the source install is more suitable when you want to develop new modules, since the source code is open, and then more accessible than using the package installer.

This method of installation gives you the freedom to customize the starting and stopping of Odoo to fit your exact needs. Another advantage of this method is that it allows for a greater control over the system through environment variables and allows you to more easily control the running and testing of different Odoo instances side-by-side.

Installing System Dependencies

Source installation requires manually installing these dependencies:

  • Installing Python 3.5 or later

Make sure you are using the right version and that the alias python3 is present in your PATH using the following command:

$ python --version
$ python3 --version

If only Python 2.7 is installed, you should download and install Python 3.5 and setup the environment variable.

  • Install Pip and Virtualenv

Pip is the package manager used to install python packages. To check that Pip is installed, just run the following command:

$ pip --version

If it is not installed, you have to download the get-pip.py script and install it by running the following commands:

$ curl https://bootstrap.pypa.org/get-pip.py -o get-pip.py
# python get-pip.py

Virtualenv is a tool to create Python isolated environments because it's sometimes preferable to not mix your distribution Python modules packages with globally installed python modules with pip.

To get virtualenv installed, just run the following command once Pip is installed :

$ pip install --user virtualenv

The --user switch is used to prevent errors while installing the package, due of the lack of privileges, because of not running this command as the root user.

  • Installing PostgreSQL

To install PostgresSQL on your system, you have to run the following command:

# apt install postgresql -y

After installation, you will need to create a Postgres user: by default the only user is postgres, and Odoo forbids connecting as postgres.

Then create a Postgres user named like your login name:

$ su                           # Then you enter the root password
# su postgres                  # To switch the current user to postgres user
# psql -U postgres             # To activate the postgres database for changes
# CREATE ROLE <username> WITH CREATEDB LOGIN ENCRYPTED PASSWORD '<password>';

In the above code, the last command will create a user with <username> and <password>, that must be identical to the regular system user.

Because the role login is the same as your UNIX login UNIX sockets can be used without a password.

  • Installing Other dependencies

To install these dependencies, you have to run the following commands inside a virtual environment :

# apt-get install build-essential python3-dev libxslt-dev libzip-dev libldap2-dev libsasl2-dev

Install Odoo

Get Odoo source from Git

You can get Odoo by downloading it as a zip file or by cloning its repository from the Odoo's official github account.

The Git option has the advantage of easy future updates while the drawback is that when a clone a repository, you get all the previous changes done to the repo with you, so the Odoo repo clone can be quite long. To avoid this size issue, you can limit the depth of files version that you clone by using the --depth 1 switch when cloning the repo.

Please run the following commands to clone the git repository:

Make sure Git is installed in your system. To check it, you have to run the following command:

$ git --version

If this command doesn't return you the Git version, then it is not installed and you have to run the following command to install it:

# apt-get install git

After that, you can, clone the git repository using the following command:

$ git clone --depth 1 https://github.com/odoo/odoo.git

This command should have created a folder odoo containing the source code of Odoo. Hereafter is the structure of this folder:

odoo
├── addons
├── CONTRIBUTING.md
├── COPYRIGHT
├── debian
├── doc
├── LICENSE
├── MANIFEST.in
├── odoo
├── odoo-bin
├── README.md
├── requirements.txt
├── SECURITY.md
├── setup
├── setup.cfg
└── setup.py

  1. Install Odoo's dependencies in virtual environment.
  2. Create an isolated environment to install python dependencies.

Now we can create a virtual environment for Odoo like this:

$ virtualenv -p /usr/bin/python3 odoo-venv

With this command, we ask for an isolated Python3 environment that will be named odoo-env. If the command works as expected, your prompt should have changed to remind you that you are using an isolated environment.

Now let's install the Odoo required python packages:

$ cd odoo
$ source ../odoo-venv/bin/activate
(odoo-venv)$ pip install -r requirements.txt

After a little while, you should be ready to run odoo from the command line as explained above.

  • Running Odoo

Once all dependencies are set up, Odoo can be launched by running odoo-bin. You have to provide configurations for Odoo to run properly. Then, configurations can be provided either through command-line arguments or through a configuration file.

Common necessary configurations are:

  • PostgreSQL host, port, user and password.

Odoo has no default configurations beyond psycopg2's default configurations: connects over a UNIX socket on port 5432 with the current user and no password. By default this should work on Linux and OS X, but it will not work on windows as it does not support UNIX sockets.

  • Custom addons path beyond the defaults, to load your own modules

Now you can run Odoo by typing the command below. This command is used to run Odoo with the addons path specified and a filter for the database.

$ source odoo-venv/bin/activate
(odoo-venv)$ ./odoo-bin --addons-path=addons,../mymodules --db-filter=mydb$

Where ../mymodules is a directory with additional addons and mydb the default database to serve on: http://localhost:8069.

Here is a look at the browser after opening that address inside it :

This page shows that, Odoo has correctly been installed in your system.

Conclusion

In this tutorial, you have seen how someone can install Odoo 12 in a Debian VM stored on Alibaba Cloud. The only thing remaining is how to configure it to use your business apps and how to harden it to protect your customers data from being hacked. You may be interested in installing Odoo on the cloud as a containerized application, because it brings more flexibility on the architecture and the scalability of your deployments. However, all these two points will make the object of future tutorials that will come next this one.

0 1 0
Share on

Alibaba Clouder

2,605 posts | 747 followers

You may also like

Comments