Sursa¶
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.
Preluați sursele¶
There are two ways to obtain the source code of Odoo: as a ZIP archive or through Git.
Arhivează¶
Community edition:
Enterprise edition:
Git¶
Notă
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
$ git clone git@github.com:odoo/odoo.git
$ git clone git@github.com:odoo/enterprise.git
C:\> git clone https://github.com/odoo/odoo.git
C:\> git clone https://github.com/odoo/enterprise.git
C:\> git clone git@github.com:odoo/odoo.git
C:\> git clone git@github.com:odoo/enterprise.git
$ git clone https://github.com/odoo/odoo.git
$ git clone https://github.com/odoo/enterprise.git
$ git clone git@github.com:odoo/odoo.git
$ git clone git@github.com:odoo/enterprise.git
Notă
The Enterprise git repository does not contain the full Odoo source code. It is only a
collection of extra add-ons. The main server code is in the Community edition. Running the
Enterprise version means running the server from the Community version with the addons-path
option set to the folder with the Enterprise edition. It is required to clone both the Community
and Enterprise repositories to have a working Odoo Enterprise installation.
Pregătiți¶
Python¶
Odoo requires Python 3.7 or later to run.
Use a package manager to download and install Python 3 if needed.
Download the latest version of Python 3 and install it.
În timpul instalării, verificați Add Python 3 to PATH, apoi faceți clic pe Customize Installation și asigurați-vă că pip este bifat.
Notă
Dacă Python 3 este deja instalat, asigurați-vă că versiunea este 3.7 sau mai recentă, deoarece versiunile anterioare nu sunt compatibile cu Odoo.
$ python3 --version
C:\> python --version
$ python3 --version
Verify that pip is also installed for this version.
$ pip3 --version
C:\> pip --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
Download PostgreSQL (supported versions: 12.0 or above) and install it.
Use Postgres.app to download and install PostgreSQL (supported version: 12.0 or above).
Sfat
To make the command line tools bundled with Postgres.app available, make sure to set up the
$PATH
variable by following the Postgres.app CLI tools instructions.
By default, the only user is postgres
. As Odoo forbids connecting as postgres
, create a new
PostgreSQL user.
$ sudo -u postgres createuser -s $USER
$ createdb $USER
Notă
Because the PostgreSQL user has the same name as the Unix login, it is possible to connect to the database without a password.
Add PostgreSQL’s
bin
directory (by default:C:\Program Files\PostgreSQL\<version>\bin
) to thePATH
.Creați un utilizator postgres cu o parolă utilizând interfața grafică pg admin:
Deschideți pgAdmin.
Faceți dublu clic pe server pentru a crea o conexiune.
Selectați
.Enter the username in the Role Name field (e.g.,
odoo
).Open the Definition tab, enter a password (e.g.,
odoo
), and click Save.Deschideți fila Privileges și comutați Can login? la
Yes
și Create database? laYes
.
$ sudo -u postgres createuser -s $USER
$ createdb $USER
Notă
Because the PostgreSQL user has the same name as the Unix login, it is possible to connect to the database without a password.
Dependințe¶
Using distribution packages is the preferred way of installing dependencies. Alternatively, install the Python dependencies with pip.
For Debian-based systems, the packages are listed in the debian/control file of the Odoo sources.
Pe Debian/Ubuntu, următoarele comenzi ar trebui să instaleze pachetele necesare:
$ cd /CommunityPath
$ sed -n -e '/^Depends:/,/^Pre/ s/ python3-\(.*\),/python3-\1/p' debian/control | sudo xargs apt-get install -y
As some of the Python packages need a compilation step, they require system libraries to be installed.
On Debian/Ubuntu, the following command should install these required libraries:
$ sudo apt install python3-pip libldap2-dev libpq-dev libsasl2-dev
Odoo dependencies are listed in the requirements.txt
file located at the root of
the Odoo Community directory.
Notă
The Python packages in requirements.txt
are based on their stable/LTS
Debian/Ubuntu corresponding version at the moment of the Odoo release. For example,
for Odoo 15.0, the python3-babel
package version is 2.8.0 in Debian Bullseye and
2.6.0 in Ubuntu Focal. The lowest version is then chosen in the
requirements.txt
.
Sfat
It can be preferable not to mix Python module packages between different instances of Odoo or with the system. However, it is possible to use virtualenv to create isolated Python environments.
Navigate to the path of the Odoo Community installation (CommunityPath
) and run
pip on the requirements file to install the requirements for the current user.
$ cd /CommunityPath
$ pip install -r requirements.txt
Before installing the dependencies, download and install the Build Tools for Visual Studio. Select C++ build tools in the Workloads tab and install them when prompted.
Odoo dependencies are listed in the requirements.txt
file located at the root of the Odoo
Community directory.
Sfat
It can be preferable not to mix Python module packages between different instances of Odoo or with the system. However, it is possible to use virtualenv to create isolated Python environments.
Navigate to the path of the Odoo Community installation (CommunityPath
) and run pip on
the requirements file in a terminal with Administrator privileges:
C:\> cd \CommunityPath
C:\> pip install setuptools wheel
C:\> pip install -r requirements.txt
Odoo dependencies are listed in the requirements.txt
file located at the root of the Odoo
Community directory.
Sfat
It can be preferable not to mix Python module packages between different instances of Odoo or with the system. However, it is possible to use virtualenv to create isolated Python environments.
Navigate to the path of the Odoo Community installation (CommunityPath
) and run pip on
the requirements file:
$ cd /CommunityPath
$ pip3 install setuptools wheel
$ pip3 install -r requirements.txt
Notă
For languages using a right-to-left interface (such as Arabic or Hebrew), the rtlcss
package is required.
Download and install nodejs and npm with a package manager.
Instalați
rtlcss
:$ sudo npm install -g rtlcss
Download and install nodejs.
Instalați
rtlcss
:C:\> npm install -g rtlcss
Edit the system environment’s variable
PATH
to add the folder wherertlcss.cmd
is located (typically:C:\Users\<user>\AppData\Roaming\npm\
).
Atenționare
wkhtmltopdf
is not installed through pip and must be installed manually in version 0.12.5 for it to support headers and
footers. Check out the wkhtmltopdf wiki for
more details on the various versions.
Rularea Odoo¶
Odată ce toate dependențele sunt configurate, Odoo poate fi lansat prin executarea odoo-bin
, interfața de linie de comandă a serverului. Se găsește la rădăcina directorului Odoo Community.
To configure the server, either specify command-line arguments or a configuration file.
Sfat
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.
Configurări necesare comune sunt:
Utilizatorul și parola PostgreSQL.
Custom addon paths beyond the defaults to load custom modules.
O modalitate tipică de a rula serverul ar fi:
$ cd /CommunityPath
$ python3 odoo-bin --addons-path=addons -d mydb
Unde CommunityPath
este calea instalării Odoo Community, și mydb
este numele bazei de date PostgreSQL.
C:\> cd CommunityPath/
C:\> python odoo-bin -r dbuser -w dbpassword --addons-path=addons -d mydb
Unde CommunityPath
este calea instalării Odoo Community, dbuser
este login-ul PostgreSQL, dbpassword
este parola PostgreSQL, și mydb
este numele bazei de date PostgreSQL.
$ cd /CommunityPath
$ python3 odoo-bin --addons-path=addons -d mydb
Unde CommunityPath
este calea instalării Odoo Community, și mydb
este numele bazei de date PostgreSQL.
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.
Sfat