Cài đặt nguồn

The source 'installation' is not about installing Odoo but running it directly from the source instead.

Using the Odoo source can be more convenient for module developers as it is more easily accessible than using packaged installers.

It makes starting and stopping Odoo more flexible and explicit than the services set up by the packaged installers. Also, it allows overriding settings using command-line parameters without needing to edit a configuration file.

Finally, it provides greater control over the system's setup and allows to more easily keep (and run) multiple versions of Odoo side-by-side.

Fetch the sources

There are two ways to obtain the source code of Odoo: as a ZIP archive or through Git.

Lưu trữ

Phiên bản Community:

Phiên bản Enterprise:

Git

Ghi chú

It is required to have Git installed, and it is recommended to have a basic knowledge of Git commands to proceed.

To clone a Git repository, choose between cloning with HTTPS or SSH. In most cases, the best option is HTTPS. However, choose SSH to contribute to Odoo source code or when following the Getting Started developer tutorial.

$ git clone https://github.com/odoo/odoo.git
$ git clone https://github.com/odoo/enterprise.git

Ghi chú

Kho lưu trữ git Enterprise không chứa mã nguồn Odoo đầy đủ. Nó chỉ là một tập hợp các add-on bổ sung. Mã máy chủ chính nằm trong phiên bản Community. Chạy phiên bản Enterprise có nghĩa là chạy máy chủ từ phiên bản Community với tùy chọn addons-path được thiết lập cho phiên bản Enterprise trong một thư mục cụ thể. Cần phải sao chép cả kho lưu trữ Community và Enterprise để bản cài đặt Odoo Enterprise hoạt động.

Chuẩn bị

Python

Odoo requires Python 3.10 or later to run.

Thay đổi trong phiên bản 17: Minimum requirement updated from Python 3.7 to Python 3.10.

Use a package manager to download and install Python 3 if needed.

Ghi chú

If Python 3 is already installed, make sure that the version is 3.10 or above, as previous versions are not compatible with Odoo.

$ python3 --version

Verify that pip is also installed for this version.

$ pip3 --version

PostgreSQL

Odoo uses PostgreSQL as its database management system.

Use a package manager to download and install PostgreSQL (supported versions: 12.0 or above). It can be achieved by executing the following:

$ sudo apt install postgresql postgresql-client

By default, the only user is postgres. As Odoo forbids connecting as postgres, create a new PostgreSQL user.

$ sudo -u postgres createuser -d -R -S $USER
$ createdb $USER

Ghi chú

Because the PostgreSQL user has the same name as the Unix login, it is possible to connect to the database without a password.

Phần phụ thuộc

Using distribution packages is the preferred way of installing dependencies. Alternatively, install the Python dependencies with pip.

On Debian/Ubuntu, the following commands should install the required packages:

$ cd odoo #CommunityPath
$ sudo ./setup/debinstall.sh

The setup/debinstall.sh script will parse the debian/control file and install the found packages.

Ghi chú

For languages using a right-to-left interface (such as Arabic or Hebrew), the rtlcss package is required.

  1. Download and install nodejs and npm with a package manager.

  2. Cài đặt rtlcss:

    $ sudo npm install -g rtlcss
    

Cảnh báo

wkhtmltopdf is not installed through pip and must be installed manually in version 0.12.6 for it to support headers and footers. Check out the wkhtmltopdf wiki for more details on the various versions.

Chạy Odoo

Once all dependencies are set up, Odoo can be launched by running odoo-bin, the command-line interface of the server. It is located at the root of the Odoo Community directory.

To configure the server, either specify command-line arguments or a configuration file.

Mẹo

For the Enterprise edition, add the path to the enterprise add-ons to the addons-path argument. Note that it must come before the other paths in addons-path for add-ons to be loaded correctly.

Cấu hình cần thiết phổ biến là:

  • Người dùng và mật khẩu PostgreSQL.

  • Custom addon paths beyond the defaults to load custom modules.

A typical way to run the server would be:

$ cd /CommunityPath
$ python3 odoo-bin --addons-path=addons -d mydb

Where CommunityPath is the path of the Odoo Community installation, and mydb is the name of the PostgreSQL database.

After the server has started (the INFO log odoo.modules.loading: Modules loaded. is printed), open http://localhost:8069 in a web browser and log into the Odoo database with the base administrator account: use admin as the email and, again, admin as the password.

Mẹo

  • From there, create and manage new users.

  • The user account used to log into Odoo's web interface differs from the --db_user CLI argument.