[PYTHON] Install Odoo on Alibaba Cloud ECS instance

This tutorial will show you how to install ** Odoo ** version 12 on your ** Alibaba Cloud ECS ** instance and run your business from the cloud.

Requirements

In order to run an instance of Odoo, the following conditions must be met.

--Install Python 2.7 with Pip and Virtualenv. --PostgreSQL for Odoo's data storage. --Git to get the source code of Odoo from the official repository on GitHub. --Debian virtual machine (hosted on Alibaba cloud)

Odoo Edition

Odoo ERP comes in two different flavors: the free and open source Odoo Community Edition and the closed source commercial version of Odoo Enterprise Edition.

For this tutorial, we will use Odoo Community Edition. The installation procedure is not much different from the enterprise version, and fortunately the open source version of the source code is already accessible.

Also, when it comes to installing Odoo, you can choose from four different options a.

-** Online installation : Suitable when you want to check the function of Odoo immediately. With this option, everything is installed on Odoo's own cloud provider, so you don't need to install anything on your server. You can use the Odoo cloud to create a demo instance to test Odoo's functionality, or use the Odoo Saas offer to run a production Odoo instance on the cloud. You don't have access to the Odoo source code here, nor can you mess with it based on your specific needs. - Packaged installer **: This option is suitable for testing Odoo functionality on-premises, for developers and long-term production Odoo installations. Odoo package installer for Windows and Linux provided by Odoo. All necessary dependencies are automatically set up for these packages, so you can manually run commands or many to add other packages that can compromise your system's stability. You don't have to worry about that.

-** Source installation : Odoo source installation is perfect when you are trying to learn how Odoo works internally or when you have to do custom development. Already, this installation option is suitable for Odoo installation when it comes to maintainability options. To easily update Odoo, you need to use a parallel version control system such as Git or Svn. - Docker image **: If you like containerized environments, you can also use the Docker image to deploy Odoo on your production server. This option is suitable for advanced users who can perfectly determine their needs and calculate the server load. The Official Registry of Odoo Containers has all the documentation on installing Odoo in Docker containers. I am.

For this tutorial, choose to install from source code. I chose the source code installation option because it helps me understand how Odoo works.

Installation

As mentioned earlier, if you want to develop a new module, the source code is open, so source installation is better than using the package installer.

With this mounting method, you are free to customize the start and stop of Odoo to suit your needs. Another advantage of this method is that you can use environment variables to control your system, making it easier to control the running and testing of different Odoo instances side-by-side.

System dependency installation

Source installation requires you to manually install these dependencies.

-** Python 3.5 or later installation **

Make sure you are using the correct version and that the alias python3 exists in PATH using the following command:

$ python --version
$ python3 --version

If you only have Python 2.7 installed, you will need to download and install Python 3.5 and set environment variables.

-** Installing Pip and Virtualenv **

** Pip ** is a package manager for installing python packages. To check if Pip is installed, just run the following command:

$ pip --version

If it is not installed, you need to download the get-pip.py script and run the following command to install it.

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

Virtualenv is a Python quarantine, as it may be desirable not to mix packages of Python modules installed globally with pip with Python modules from the distribution. A tool for creating an environment.

To install virtualenv, simply run the following command once Pip is installed.

$ pip install --user virtualenv

Use the --user switch to prevent errors during package installation because you are not running this command as the root user and you do not have permission.

-** Install PostgreSQL **

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

# apt install postgresql -y

After installation, you need to create a Postgres user. By default, the only user is postgres, and Odoo does not allow connections with postgres.

Then create a Postgres user with a name 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>';

The above code creates a user with <username> and <password> in the last command, which should be the same as a normal system user.

Role logins are the same as UNIX logins, so UNIX sockets can be used without a password.

-** Install other dependencies **

To install these dependencies, you need to run the following command in your 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 the repository from Odoo's official github account. I can do it.

The Git option has the advantage of being easy to update in the future, but the downside is that cloning the Odoo repository can be very long, as you will get all the previous changes together when you clone the repository. To avoid this size issue, you can limit the depth of the duplicated file version by using the --depth 1 switch when duplicating the repo.

Clone the git repository by running the following command.

Make sure you have Git installed. To check it, you need to run the following command:

$ git --version

If this command doesn't return the version of Git, it means that Git isn't installed and you need to run the following command to install it.

# apt-get install git

Then clone the git repository with the following command:

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

When you run this command, you should have created a folder odo with the ** Odoo ** source code. The structure of this folder is explained below.

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 dependencies in the virtual environment. ** ** 2, ** Create an isolated environment for installing python dependencies. ** ** Now you can create an Odoo virtual environment like this.

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

This command requires an isolated Python3 environment named ʻodoo-env`. If the command works as expected, the prompt should have changed to signal that you are using an isolated environment.

Now let's install the required python packages for Odoo.

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

After some time, you should be able to run odo from the command line as described above.

-** Run Odoo **

After setting all the dependencies, you can start Odoo by running ʻodoo-bin`. You need to provide the settings for Odoo to work properly. And Settings is [Command Line Arguments](https: // www.odoo.com/documentation/12.0/reference/cmdline.html?spm=a2c65.11461447.0.0.42751ad8VvoYa5#reference-cmdline) or Configuration File (https://www.odoo.com/documentation/12.0/reference) It can be provided via /cmdline.html?spm=a2c65.11461447.0.0.42751ad8VvoYa5#reference-cmdline-config).

The generally required configuration is as follows.

--PostgreSQL host, port, user, password.

Odoo has no default settings other than psycopg2 default settings: UNIX socket on port 5432. Use to connect with the current user without a password. By default it should work on Linux and OS X, but it doesn't work on Windows because it doesn't support UNIX sockets.

--Cross-default custom add-on path for loading your own modules

You can now run Odoo by typing the following command: This command is for running Odoo with the add-on path specified and the database filtered.

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

./mymodules is the directory containing additional add-ons and mydb is the default database for servicing: http: //localhost:8069.

Here, let's take a look at the browser after opening the address in it.

This page shows that Odoo is properly installed on your system.

Conclusion

In this tutorial we have seen how to install Odoo 12 on a Debian VM stored on Alibaba Cloud. All that remains is how to set it up to use the business app and how to consolidate it to protect the data of hacked customers. You may be interested in installing Odoo in the cloud as a containerized application. But all of these two points are for future tutorials that will come next.

Recommended Posts

Install Odoo on Alibaba Cloud ECS instance
Setting up a CentOS 7 server hosted on Alibaba Cloud ECS
Installing Anaconda Python on an ECS instance
How to deploy a Django application on Alibaba Cloud
Encrypt ACME on Alibaba Cloud: Create ACME endpoints, directories, ACME accounts
Install mecab on Marvericks
Install Tensorflow on Mac
Install TensorFlow on Ubuntu
Install python on WSL
Install Faiss on CentOS 7
Install pyenv on mac
Install pip on Mavericks
Install Python on Pidora.
Install mongodb on termux
Install Scrapy on python3
Install docker on Fedora31
Install numba on CentOS 7.2
Install Python on Mac
Install Python 3 on Mac
Install Plone (4.3.6) on MacOSX (10.10.3)
Install Python3.4 on CentOS 6.6
Install JModelica on Ubuntu
Install Anaconda on Windows 10
Install numpy on Marvericks
Install python on windows
Install enebular-agent on Chromebook
Install pycuda on Windows10
Install mecab-python on CentOS
Install Python 2.7.3 on CentOS 5.4
Install pygraphviz on Windows 10
Install Python 3.3 on Ubuntu 12.04
Install Chainer 1.5.0 on Windows
Install Python 3.4 on Mac
Install Caffe on Mac
Install Theano on Ubuntu 12.04
Install pyenv on OSX
Install mecab on mac
Install awscli on centos7
Install angr on Ubuntu 18.04
Install Chainer on CentOS 6.7
Install mecab-python on Mac
Install pip / pip3 on Ubuntu
Install Python 3.6 on Docker
Encrypt ACME on Alibaba Cloud: Concepts Related to SSL Certificates