Self-Hosted Installation

This guide covers installing and configuring AgriOS on your own infrastructure.

Prerequisites

Before starting, ensure you have:

  • A Linux server meeting the system requirements

  • Root or sudo access

  • A domain name (for production)

  • Basic familiarity with Linux administration

Installation Methods

Method 2: Native Installation

For more control over the environment, install Odoo and AgriOS natively.

1. Install System Dependencies

# Ubuntu 22.04/24.04
sudo apt update
sudo apt install -y python3-pip python3-dev python3-venv \
    libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev \
    libldap2-dev build-essential libssl-dev libffi-dev \
    libjpeg-dev libpq-dev liblcms2-dev libblas-dev \
    libatlas-base-dev wkhtmltopdf nodejs npm git

2. Install PostgreSQL

sudo apt install postgresql postgresql-client
sudo -u postgres createuser -s odoo
sudo -u postgres createdb agrios

3. Create Odoo User

sudo useradd -m -d /opt/odoo -U -r -s /bin/bash odoo

4. Install Odoo

sudo su - odoo
git clone https://github.com/odoo/odoo.git --depth 1 --branch 18.0 /opt/odoo/odoo
python3 -m venv /opt/odoo/venv
source /opt/odoo/venv/bin/activate
pip install -r /opt/odoo/odoo/requirements.txt

5. Install AgriOS Modules

git clone https://github.com/advanceinsight/AgriOS.git /opt/odoo/agrios
pip install -r /opt/odoo/agrios/requirements.txt  # If present

6. Configure Odoo

Create /opt/odoo/odoo.conf:

[options]
admin_passwd = your_admin_password
db_host = localhost
db_port = 5432
db_user = odoo
db_password = false
addons_path = /opt/odoo/odoo/addons,/opt/odoo/agrios
default_productivity_apps = True

7. Create Systemd Service

Create /etc/systemd/system/odoo.service:

[Unit]
Description=Odoo
After=network.target postgresql.service

[Service]
Type=simple
User=odoo
ExecStart=/opt/odoo/venv/bin/python /opt/odoo/odoo/odoo-bin -c /opt/odoo/odoo.conf
Restart=on-failure

[Install]
WantedBy=multi-user.target

8. Start Odoo

sudo systemctl daemon-reload
sudo systemctl enable odoo
sudo systemctl start odoo

Initial Setup

Create Database

  1. Access the Odoo database manager at http://yourserver:8069/web/database/manager

  2. Click Create Database

  3. Enter:

    • Master password (from config)

    • Database name (e.g., agrios)

    • Admin email and password

    • Language and country

  4. Click Create Database

Install AgriOS Modules

  1. Log in as administrator

  2. Navigate to Apps

  3. Click Update Apps List

  4. Search for and install:

    • agrios_farmer

    • agrios_plot

    • agrios_training

    • agrios_trade

    • agrios_kobo (if using KoBoToolbox)

    • agrios_theme

Production Configuration

Reverse Proxy (Nginx)

For production, use Nginx as a reverse proxy:

upstream odoo {
    server 127.0.0.1:8069;
}

upstream odoo-chat {
    server 127.0.0.1:8072;
}

server {
    listen 80;
    server_name yourdomain.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    server_name yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

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

    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;

    location / {
        proxy_pass http://odoo;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /longpolling {
        proxy_pass http://odoo-chat;
    }

    location ~* /web/static/ {
        proxy_cache_valid 200 90m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://odoo;
    }
}

SSL Certificate

Use Let’s Encrypt for free SSL certificates:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com

Backups

Set up automated database backups:

# Create backup script
cat > /opt/odoo/backup.sh << 'EOF'
#!/bin/bash
BACKUP_DIR=/opt/odoo/backups
DATE=$(date +%Y%m%d_%H%M%S)
pg_dump agrios | gzip > $BACKUP_DIR/agrios_$DATE.sql.gz
# Keep only last 7 days
find $BACKUP_DIR -name "*.sql.gz" -mtime +7 -delete
EOF

chmod +x /opt/odoo/backup.sh

# Add to crontab
echo "0 2 * * * /opt/odoo/backup.sh" | sudo crontab -u odoo -

Troubleshooting

Common Issues

Odoo won’t start

  • Check logs: journalctl -u odoo -f

  • Verify PostgreSQL is running: systemctl status postgresql

  • Check permissions on config and log files

Database connection errors

  • Verify PostgreSQL user exists

  • Check pg_hba.conf authentication settings

  • Ensure database password matches configuration

Module not found

  • Verify addons_path includes AgriOS modules

  • Run “Update Apps List” in Odoo

  • Check module dependencies are installed

Getting Help

  • Review Odoo documentation: https://www.odoo.com/documentation/

  • Open an issue on the AgriOS repository

  • Contact Advance Insight for commercial support