Create a new system user for the new Odoo installation.
sudo adduser --system --home=/home/odoo17-NAME --group odoo17-NAME
Odoo 17 requires Python 3.10 – Check it’s installed and the right version:
Check Python 3 .10 is installed.
Check pip3 is installed.
Check Postgre is installed. If not > sudo apt install postgresql postgresql-client
Create new user for Postgre database.
sudo -u postgres createuser -s $USER
createdb $USER
Setup and install the database
sudo su - postgres createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo17-NAME #Create a database user
psql ALTER USER odoo17-NAME WITH SUPERUSER;
\q exit (any special chars in usernames needs to be in "" double quotes!) # Change to users directory
sudo su - odoo17-NAME -s /bin/bash
git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 --single-branch .
exit
Install Required Python Packages
sudo pip3 install -r /opt/odoo/requirements.txt
Setup Conf file
sudo cp /home/odoo17-NAME/debian/odoo.conf /home/odoo17-NAME/odoo17.conf sudo nano /home/odoo17-NAME/odoo17.conf
[options] ; This is the password that allows database operations: admin_passwd = admin db_host = False db_port = False db_user = odoo17 db_password = False addons_path = /home/odoo17-NAME/addons, /home/odoo17-NAME/custom-modules logfile = /home/odoo17-NAME/odoo17.log
Use the custom-modules directory (you’ll need to create it) or don’t. It makes life much easier when adding new modules (add to this directory to test first).
Install dependencies
sudo apt install python3-pip libldap2-dev libpq-dev libsasl2-dev
Use virtual environment for python if required. https://pypi.org/project/virtualenv/
cd /CommunityPath
$ pip install -r requirements.txt
Apache config will need a VALID CA SLL Certificate (Not server self signed) in Virtualmin can do this on the panel (make sure dns control is setup correctly and auto renew is on).
Modify the relevant Apache conf file to proxy forward to the correct port for the relevant Odoo installation on the correct port. (You will need to have different ports for main and websockets so not 8069 and 8072 if already used.)
Run odoo-bin directly or create a service to run this instance of Odoo i.e. Odoo17-Name1 Odoo17-Name2 etc.
Addons path can have multiple arguments and should have! Leave the base modules in the Addons folder and use extra-modules for additional ones. (It’s much easier to manage then!)
open server on the main port at localhost or external IP (or if modified apache conf and setup dns to point to server ip the relevant domain name).
Create service:
Create a file called odoo17-NAME in the folder /etc/systemd/system
[Unit]
Description=Odoo17-NAME
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo17-NAME
PermissionsStartOnly=true
User=odoo17-NAME
Group=odoo17-NAME
ExecStart=/home/odoo17-NAME/venv/bin/python3 /home/odoo17-NAME/odoo-bin -c /etc/odoo17.conf –logfile /home/odoo17-NAME/odoo17.log –log-handler :ERROR –log-handler werkzeug:CRITICAL –email-from EMAILADDRESS –smtp 127.0.0.1 –smtp-port 25 –smtp-user EMAILADDRESS –smtp-password PASSWORD
;SEE > https://www.odoo.com/documentation/14.0/developer/reference/cli.html
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
sudo chmod 755 /etc/systemd/system/odoo17.service sudo chown root: /etc/systemd/system/odoo17.service
sudo systemctl start odoo17-NAME.service
sudo systemctl status odoo17-NAME.service
sudo systemctl enable odoo17-NAME.service
To check the logs sudo journalctl -u odoo17-cd -e > /home/odoo17-cd/odoo.txt BACKUP DATABASE cd /home/backups/odoo17/ sudo -u postgres pg_dump odoo17cd > odoo17cd_backup.sql BACKUP DIRECTORY tar -czvf odoo17cd_home_backup.tar.gz /home/odoo17cd/