---
# System prepended metadata

title: Installation Odoo
tags: [Odoo]

---

###### tags: `Odoo`
# Installation Odoo

### 1. Commencez par installer les packages :

#### 1.a Avec la base de donnée
```shell!
sudo apt-get update -y;sudo apt install postgresql -y;sudo apt install nginx -y;sudo apt install python3-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev     libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev libfreetype6-dev     liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev libpq-dev -y
```

#### 1.a Si vous voulez gérer vous même la base de donnée
```shell!
sudo apt-get update -y;sudo apt install nginx -y;sudo apt install python3-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev     libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev libfreetype6-dev     liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev libpq-dev -y
```

### 2a. Depuis un fichier `.deb`
 - télécharger la bonne version depuis la page [https://www.odoo.com/fr_FR/page/download](https://www.odoo.com/fr_FR/page/download) avec le code d'activation Enterprise pour la version Enterprise
 - placez le dans le répertoir utilisateur
 - Éxécutez votre fichier `.deb` avec `sudo apt install ./YOUR_FILE_NAME.deb -y`

### 2b. Sinon, on peut le télécharger via le repo :
Changer `xx` par la version souhaitée
```shell!
sudo wget -O - https://nightly.odoo.com/odoo.key | sudo apt-key add -
sudo echo "deb http://nightly.odoo.com/xx.0/nightly/deb/ ./" >> sudo /etc/apt/sources.list.d/odoo.list
sudo apt-get install odoo -y
```

### 3. Puis :
```shell!
sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb -y
sudo apt update -y;sudo apt upgrade -y;sudo apt autoremove -y
sudo rm /etc/nginx/sites-enabled/default;sudo nano /etc/nginx/sites-enabled/default
```

écrivez le contenu : 

```nginx=
upstream odoo {
  server 127.0.0.1:8069;
}
upstream odoochat {
  server 127.0.0.1:8072;
}
# http -> https
server {
  listen 80;
  server_name YOUR_DOMAIN_NAME;
  rewrite ^(.*) https://$host$1 permanent;
}

server {
  listen 443 ssl;
  client_max_body_size 10M;
  server_name YOUR_DOMAIN_NAME;
  proxy_read_timeout 720s;
  proxy_connect_timeout 720s;
  proxy_send_timeout 720s;

  # Add Headers for odoo proxy mode
  proxy_set_header X-Forwarded-Host $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header X-Real-IP $remote_addr;

  # SSL parameters
  ssl_certificate /etc/ssl/nginx/server.crt;
  ssl_certificate_key /etc/ssl/nginx/server.key;
  ssl_session_timeout 30m;
  ssl_protocols TLSv1.2;
  ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
  ssl_prefer_server_ciphers off;

  # log
  access_log /var/log/nginx/odoo.access.log;
  error_log /var/log/nginx/odoo.error.log;

  # Redirect longpoll requests to odoo longpolling port
  location /longpolling {
    proxy_pass http://odoochat;
  }

  # Redirect requests to odoo backend server
  location / {
    proxy_redirect off;
    proxy_pass http://odoo;
  }

  # common gzip
  gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
  gzip on;
}
```

( remplacez "YOUR_DOMAIN_NAME" par votre nom de domaine )

placez vos fichiers certificats dans `/etc/ssl/nginx/server.crt`
et `/etc/ssl/nginx/server.key`

```shell!
sudo nano /etc/odoo/odoo.conf
```

```python=
[options]
proxy_mode = True
```

Pour spécifier une base de donnée externe il faut rajouter les paramètres : 

```python=
db_host = XXXXXX
db_name = XXXXXX
db_password = XXXXXX
db_port = XXXXXX
db_user = XXXXXX
```

Pour spécifier l'emplacement de stockage des données il faut rajouter le paramètre : 

```python=
data_dir = FULL_FILE_PATH
```

Une fois terminé, redémarer votre système
```shell!
sudo systemctl restart nginx;sudo service odoo restart
```

### 4. Erreurs

Si erreurs de polices à l'impression :
```shell!
sudo apt install ttf-mscorefonts-installer
```

Si erreur réseau, "Content not found" dans wkhtmltopdf, mettre dans Odoo paramètres system : ```report.url = http://0.0.0.0:8069```


### 5. Quick Install v15 comunity

```shell
sudo wget -O - https://nightly.odoo.com/odoo.key | sudo apt-key add - && sudo echo "deb http://nightly.odoo.com/15.0/nightly/deb/ ./" >> sudo /etc/apt/sources.list.d/odoo.list && sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb && sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb -y && sudo apt install postgresql -y && sudo apt install nginx -y && sudo apt install python3-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev libpq-dev -y && sudo apt install odoo -y && sudo apt update -y && sudo apt upgrade -y && sudo apt autoremove -y && echo "[options]
proxy_mode = True
addons_path = /usr/lib/python3/dist-packages/odoo/addons,/home/ubuntu/odoo/d4e-common-def
workers = 3" > /etc/odoo/odoo.conf && echo "upstream odoo {
  server 127.0.0.1:8069;
}
upstream odoochat {
  server 127.0.0.1:8072;
}
# http -> https
server {
  listen 80;
  server_name YOUR_DOMAIN_NAME;
  rewrite ^(.*) https://$host$1 permanent;
}

server {
  listen 443 ssl;
  client_max_body_size 10M;
  server_name YOUR_DOMAIN_NAME;
  proxy_read_timeout 720s;
  proxy_connect_timeout 720s;
  proxy_send_timeout 720s;

  # Add Headers for odoo proxy mode
  proxy_set_header X-Forwarded-Host $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header X-Real-IP $remote_addr;

  # SSL parameters
  ssl_certificate /etc/ssl/nginx/server.crt;
  ssl_certificate_key /etc/ssl/nginx/server.key;
  ssl_session_timeout 30m;
  ssl_protocols TLSv1.2;
  ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
  ssl_prefer_server_ciphers off;

  # log
  access_log /var/log/nginx/odoo.access.log;
  error_log /var/log/nginx/odoo.error.log;

  # Redirect longpoll requests to odoo longpolling port
  location /longpolling {
    proxy_pass http://odoochat;
  }

  # Redirect requests to odoo backend server
  location / {
    proxy_redirect off;
    proxy_pass http://odoo;
  }

  # common gzip
  gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
  gzip on;
}" > /etc/nginx/sites-enabled/default && sudo mkdir /etc/ssl/nginx; cp server.crt /etc/ssl/nginx/server.crt; cp server.key /etc/ssl/nginx/server.key && sudo systemctl restart nginx ; sudo systemctl status nginx ; sudo service odoo restart ; sudo service odoo status
```
