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:
Now when you couple there strengths with the power given by the cloud computing, you can also benefit from:
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.
To have a running instance of Odoo, here are the requirements your system must meet:
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:
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.
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.
Source installation requires manually installing these dependencies:
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.
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.
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.
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
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
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.
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:
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.
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.
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.
Getting Started with JAM Stack Using Jekyll and Alibaba Cloud OSS
2,599 posts | 762 followers
FollowAlibaba Cloud MVP - November 15, 2019
Hernan Pardo - March 31, 2020
Alibaba Clouder - November 27, 2018
Alibaba Clouder - July 5, 2019
Alibaba Clouder - November 21, 2019
Alibaba Clouder - July 5, 2019
2,599 posts | 762 followers
FollowAn online MPP warehousing service based on the Greenplum Database open source program
Learn MoreAlibaba Cloud PolarDB for PostgreSQL is an in-house relational database service 100% compatible with PostgreSQL and highly compatible with the Oracle syntax.
Learn MoreA low-code development platform to make work easier
Learn MoreHelp enterprises build high-quality, stable mobile apps
Learn MoreMore Posts by Alibaba Clouder