如何在树莓派上安装Odoo POSBox?求助有效安装方案
Hey there! I’ve wrestled with getting Odoo POSBox up and running on a Raspberry Pi more than once, so I totally get how frustrating generic tutorials can be—they often ignore the ARM-specific hoops you have to jump through. Let’s break this down into actionable, Pi-friendly steps:
Prerequisites
First, make sure you’re starting with a clean slate:
- Use Raspberry Pi OS Lite (64-bit) (32-bit can work but has more dependency issues)
- Update your system fully before starting:
sudo apt update && sudo apt upgrade -y sudo reboot
1. Install Required System Dependencies
POSBox relies on a bunch of libraries—install them all in one go to avoid missing pieces:
sudo apt install -y python3-pip python3-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libssl-dev libjpeg-dev zlib1g-dev postgresql postgresql-contrib git nginx
2. Create a Dedicated Odoo User
Running Odoo as root is a bad idea—create a separate user for security:
sudo useradd -m -d /opt/odoo -U -r -s /bin/bash odoo
This creates a user odoo with home directory /opt/odoo.
3. Configure PostgreSQL for Odoo
PostgreSQL is Odoo’s default database—set up a user matching our Odoo user:
sudo su - postgres createuser -s odoo psql ALTER USER odoo WITH PASSWORD 'your_secure_password_here'; \q exit
Replace your_secure_password_here with a strong password you’ll remember later.
4. Install Odoo & POSBox Addons
We’ll use the official Odoo source code (stable branch, e.g., 16.0) since it includes the POSBox-specific addons:
sudo su - odoo git clone https://github.com/odoo/odoo.git --depth 1 --branch 16.0 /opt/odoo/odoo cd /opt/odoo/odoo
Now install Python dependencies—note that on ARM, psycopg2 needs a special install:
pip3 install psycopg2-binary pip3 install -r requirements.txt
If any dependencies fail, try installing them individually (common culprits are pillow or lxml—just run pip3 install pillow lxml separately).
5. Set Up the POSBox Configuration File
Copy the default config template and tweak it for POSBox:
cp /opt/odoo/odoo/debian/odoo.conf /opt/odoo/odoo.conf nano /opt/odoo/odoo.conf
Edit these key settings:
[options] admin_passwd = your_admin_password_here db_host = False db_port = False db_user = odoo db_password = your_secure_password_here addons_path = /opt/odoo/odoo/addons,/opt/odoo/odoo/posbox/addons server_wide_modules = web,posbox xmlrpc_port = 8069 logfile = /var/log/odoo/odoo.log
Save and exit (Ctrl+O, Enter, Ctrl+X). Then create the log directory and set permissions:
sudo mkdir /var/log/odoo sudo chown odoo:odoo /var/log/odoo
6. Create a Systemd Service (Auto-Start on Boot)
Make sure POSBox starts automatically when your Pi boots:
sudo nano /etc/systemd/system/odoo-posbox.service
Paste this content:
[Unit] Description=Odoo POSBox Requires=postgresql.service After=network.target postgresql.service [Service] Type=simple User=odoo ExecStart=/usr/bin/python3 /opt/odoo/odoo/odoo-bin -c /opt/odoo/odoo.conf WorkingDirectory=/opt/odoo/odoo Restart=always [Install] WantedBy=multi-user.target
Save, then enable and start the service:
sudo systemctl daemon-reload sudo systemctl enable odoo-posbox.service sudo systemctl start odoo-posbox.service
7. Test & Troubleshoot
Check if the service is running:
sudo systemctl status odoo-posbox.service
If it’s active, open a browser on another device and go to http://[your_pi_ip]:8069. You should see the Odoo login screen.
Common Fixes:
- Dependency errors: If
pip3 installfails, make sure you havepython3-devinstalled (we did this in step 1) and try upgrading pip first:pip3 install --upgrade pip - PostgreSQL connection issues: Double-check the
db_useranddb_passwordinodoo.confmatch what you set in step 3 - Port 8069 blocked: Ensure your Pi’s firewall allows incoming traffic on port 8069 (run
sudo ufw allow 8069if you’re using UFW) - POSBox not detecting hardware: Make sure your printer/scanner is connected via USB, and install any required drivers (most thermal printers work with CUPS—install with
sudo apt install cupsif needed)
内容的提问来源于stack exchange,提问作者Samoox

