Overslaan naar inhoud
  • +31 653-919-302
Cafayate.Net
  • 0
  • 0
  • Aanmelden
  • Nederlands English (US) Español (AR)
  • Contact
  • Startpagina
  • Blog
  • Vacatures
  • Contact
Cafayate.Net
  • 0
  • 0
    • Startpagina
    • Blog
    • Vacatures
    • Contact
  • +31 653-919-302
  • Nederlands English (US) Español (AR)
  • Aanmelden
  • Contact

How to install and run Odoo 9.0 in production?

  • Alle blogs
  • Tech Blog
  • How to install and run Odoo 9.0 in production?
  • 5 maart 2021 in
    Administrator

    It’s quite easy to get Odoo up and running for production use, although it will require a little patience. In this tutorial, you’ll learn how to install Odoo in minutes.

    Sure you can install Odoo in a few clicks using Bitnami or a paid Software-as-a-Service offer from Odoo.com. But if you intend to customize Odoo and develop (or hire a developer) custom modules that are perfect for your needs, opt to installing Odoo on your own server.

    Odoo (known as OpenERP before) is an elegant ERP and CRM solution that has the potential to multiply your business productivity. The version of Odoo we are going to use is 9.0, but this guide also applies to 8.0.

    I believe you have come to this page because you have decided to use Odoo. But if you are yet to try Odoo, head on to the official installation steps to install Odoo on your local machine.

    In this post I assume that you are ready to put Odoo to work for your business. Before you proceed with the steps, the following should have been met.

    1. You have an Internet-enabled server that you can access or connect to. You can set up a virtual server in the cloud using Google Cloud Compute service or Amazon Web Service (AWS) EC2 [new article “Getting a Cloud Compute service for Odoo” will be out soon].
    2. A Linux operating system. I suggest Ubuntu; the server edition will do. When you set up a virtual server in Google Cloud Compute or AWS EC2, choose Ubuntu 14.04 or the new Ubuntu 16.04.
    3. A static public IP address. Of course, you do not want to access Odoo on a temporary IP address.
    4. A domain pointed to your static public IP address. Of course, you want to access Odoo on a website like www.example.com instead of an IP address.
    5. An SSL certificate, if you want to run Odoo on HTTPS. Get an SSL certificate for free.

     

    Now, let’s begin installing Odoo.

    1. Download and install Odoo 9.0
    2. Download and install Nginx
    3. Installing an SSL certificate
    4. Testing

     

    UPDATE 2016-06-03: If you’re on Ubuntu 16.04, you need a minor pre-requisite: just run this command:

    wget http://launchpadlibrarian.net/109052632/python-support_1.0.15_all.deb
    sudo dpkg -i python-support_1.0.15_all.deb

     

    1. Download and install Odoo 9.0

    We’re going to install Odoo from the official source. To do this, log in to your server as a superuser through SSH [new article “How to connect to your server using SSH” will be out soon], then open a terminal and type the following:

    sudo su
    wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
    echo "deb http://nightly.odoo.com/9.0/nightly/deb/ ./" >> /etc/apt/sources.list
    apt-get update && apt-get install odoo

     

    This will install Odoo automatically including all its dependencies and then start it for you. You can test it right away by firing up a browser and going to http://your-ip-address-or-domain:8069. If you are using a cloud server (Google Cloud Compute or AWS EC2) don’t see anything, port 8069 may have been blocked. Follow these instructions to enable port 8069.

    Optional: To print PDF reports in Odoo, install wkhtmltopdf. Execute the following commands to download wkhtmltopdf:

    Note: Change wget URL to the wkhtmltopdf tar package from this link http://wkhtmltopdf.org/downloads.html depending on your machine.

    wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
    tar -xvf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
    cd wkhtmltox/bin
    sudo cp wkhtmltopdf  /usr/bin/wkhtmltopdf
    sudo chmod ugo+x /usr/bin/wkhtmltopdf

     

    2. Download and install Nginx

    For production use, Odoo needs to run behind a web server so that you can install an SSL, compress Odoo’s static files, use a domain to acces Odoo, and make other server configurations that will lower the load on Odoo. Install Nginx (pronounced as Engine X) by executing the following commands:

    sudo apt-get install nginx

     

    Open http://your-ip-address-or-domain on your browser and you should see this:

    Nginx welcome page

     

     

    Now we’re going to replace that page with Odoo. Since Odoo serves pages on port 8069 by default, we’ll have to direct traffic on port 80 (that’s your http://ip-address-or-domain where you see the Nginx welcome page). Let’s start by creating an Nginx configuration for your site.

    Open a terminal and install VIM for editing text or use nano:

    sudo apt-get install vim

     

    Then execute the following command:

    sudo vim /etc/nginx/sites-available/your-site.com

     

    Inside the editor, paste and modify the following:

    server {
    listen 10.0.1.42:80 default;
    # replace `example.com` with your domain
    server_name example.com;

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

    location / {
    proxy_pass http://127.0.0.1:8069;
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

    proxy_buffer_size 128k;
    proxy_buffers 16 64k;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location ~* /web/static/ {
    proxy_buffering off;
    proxy_pass http://127.0.0.1:8069;
    }
    }
    # Redirect people who may have bookmarked the URL with the 8069 port to port 80
    server {
    listen 10.0.1.42:8069;
    server_name example.com;

    add_header Strict-Transport-Security max-age=2592000;
    rewrite ^/.*$ http://$host$request_uri? permanent;
    }

     

    Replace all 10.0.1.42 with your machine’s internal IP address (may not necessarily be your public IP address). To get your machine’s internal IP address, just run this command:

    ip route get 8.8.8.8 | awk '{print $NF; exit}'

     

    We need to link this configuration file to a file in /etc/nginx/sites-enabled. So execute this:

    sudo ln -s /etc/nginx/sites-available/your-site.com /etc/nginx/sites-enabled/your-site.com

     

    We also need to edit the default configuration file sites-available folder, if it exists. Execute this:

    sudo vim /etc/nginx/sites-available/default.conf

     

    Replace the line listen 80 default; to listen 80; since it will conflict with your-site.com configuration as we have set it to default. Execute sudo nginx -t to check if there are no errors in your configuration changes.

    Now we need to edit Odoo’s configuration so it runs on the localhost ONLY. Execute the following commands with sudo:

    sudo vim /etc/odoo/openerp-server.conf

     

    Add this line on the file: xmlrpc_interface = 127.0.0.1

    Now let’s test these crude configurations. Execute:

    sudo /etc/init.d/odoo restart
    sudo /etc/init.d/nginx restart

     

    Open your browser and go to http://your-ip-address-or-domain. You should see Odoo now being served directly on your website without the port 8069.

    But your Odoo set-up doesn’t stop there. Let’s add some more configurations to increase Odoo’s capabilities.

    Open /etc/odoo/openerp-server.conf and update it as follows:

    [options]
    ; comments starts with semicolon
    ; this is the password that allows database operations, replace this with your own:
    admin_passwd = nCJusTR48LA4kyMA
    ; replace this with your database name
    dbfilter = test-db
    ; replace this with 1 + num of cores in your machine * 2
    workers = 3
    db_host = False
    db_port = False
    db_user = odoo
    db_password = False
    addons_path = /usr/lib/python2.7/dist-packages/openerp/addons,/etc/odoo/addons/external
    csv_internal_sep = ,
    limit_memory_hard = 2684354560
    limit_memory_soft = 2147483648
    limit_time_cpu = 60
    limit_time_real = 120
    longpolling_port = 8072
    max_cron_threads = 1
    proxy_mode = True
    xmlrpc_interface = 127.0.0.1

     

    Open /etc/nginx/sites-available/your-site.com and add this below the location / {…} block:

    location /longpolling {
    proxy_pass http://127.0.0.1:8072;
    }

     

    Open /etc/nginx/nginx.conf and update as follows:

    user www-data;
    worker_processes auto;
    pid /run/nginx.pid;

    events {
    worker_connections 768;
    # multi_accept on;
    }

    http {
    ##
    # Basic Settings
    ##
    sendfile on;
    ## max size of file that can be uploaded to Odoo
    client_max_body_size 100M;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 600;
    types_hash_max_size 2048;
    # server_tokens off;
    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    # Allows smaller size of contents being sent by the server
    ##
    gzip on;
    gzip_disable "msie6";

    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    }

     

    Because we have workers in odoo configuration and longpolling_port, we’ll need openerp-geventscript that will enable the live chat feature running on port 8072. Download the script by executing:

    cd /usr/bin
    sudo wget https://github.com/odoo/odoo/raw/9.0/openerp-gevent openerp-gevent
    sudo chmod ugo+x openerp-gevent
    sudo pip install psycogreen

     

    Now let’s restart Odoo and Nginx, again just execute:

    sudo /etc/init.d/odoo restart
    sudo /etc/init.d/nginx restart

     

    Now open Odoo on your browser and that’s it. If you don’t need to secure Odoo with SSL, you can now test and use it.

     

    3. Installing an SSL certificate

    It is strongly recommended that you run Odoo in secure HTTPS as Odoo sends out unencrypted plain text that may contain sensitive information including your credentials.

    Copy your SSL certificate and private key to /etc/nginx/ssl. If the directory does not exist, create it.

    Create a strong Diffie-Hellman group to further increase security. To do this, execute:

    sudo openssl dhparam -out /etc/nginx/ssl/dhparams.pem 2048

     

    Edit the file /etc/nginx/sites-available/your-site.com as follows:

    server {
    listen 10.0.1.42:80 default;
    # replace `example.com` with your domain
    server_name example.com;

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

    # Enables SSL
    ssl on;
    # replace with the path to your certificate and private key
    ssl_certificate /etc/nginx/ssl/your-site.crt;
    ssl_certificate_key /etc/nginx/ssl/your-site.key;

    ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA";
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    # replace with path to the Diffie-Hellman group you created
    ssl_dhparam /etc/nginx/ssl/dhparams.pem;

    location / {
    proxy_pass http://127.0.0.1:8069;
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

    proxy_buffer_size 128k;
    proxy_buffers 16 64k;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    # tells Odoo that we are using HTTPS
    proxy_set_header X-Forwarded-Proto https;
    }

    location /longpolling {
    # enables Odoo’s live chat feature
    proxy_pass http://127.0.0.1:8072;
    }

    location ~* /web/static/ {
    proxy_buffering off;
    proxy_pass http://127.0.0.1:8069;
    }
    }
    # Redirect people who may have bookmarked the URL with the 8069 port to port 80
    server {
    listen 10.0.1.42:8069;
    server_name example.com;

    add_header Strict-Transport-Security max-age=2592000;
    rewrite ^/.*$ https://$host$request_uri? permanent;
    }

    # Automatically redirects user to https
    server {
    listen 10.0.1.42:80;
    server_name example.com;

    add_header Strict-Transport-Security max-age=2592000;
    rewrite ^/.*$ https://$host$request_uri? permanent;
    }

     

    Again, replace all 10.0.1.42 with your machine’s internal IP address.

    Finally, let’s restart Odoo and Nginx:

    sudo /etc/init.d/odoo restart
    sudo /etc/init.d/nginx restart

     

    Congratulations, you have now installed Odoo successfully and running securely.

     

    4. Testing

    Open your browser and go to http://your-IP-or-domain to access Odoo. Create a database named as the one you have in your opener-server.conf. Use the admin password in the same file for the Master Password.

    Open your browser Developer Tools (Ctrl+Shift+I in Chrome) and check if there are no errors in the console. Go to the Network tab and reload the Odoo web page. Click on a JavaScript or CSS file and check its response headers.

    testing-odoo-browser-console.png

     

    Now, let’s actually try Odoo. Log in to your Odoo, go to Apps and install Website Live Chat. Try out this app and look for errors in the console. If you don’t see any errors, your Odoo will now run as nicely as it should be. If you need help or clarification, leave a comment below. Enjoy!

    in Tech Blog
    LXC, Bridge, Dnsmasq, Iptables en Vagrant

    Ontworpen voor bedrijven

    We zijn een team van gepassioneerde mensen met als doel levens te verbeteren met vernieuwende producten. We ontwikkelen geweldige oplossingen voor al je zakelijke uitdagingen. Onze producten zijn ontworpen voor kleine tot middelgrote bedrijven die hun prestaties willen optimaliseren.

    Neem contact op

    Plantexel
    Pedernera
    Salta Capital 
    Argentina

    • +31 653-919-302
    • [email protected]
    Volg ons
    Copyright © Plantexel
    Nederlands | English (US) | Español (AR)