Installing multiple instances of Odoo on the same machine
In this tutorial, we will show you how to install multiple instances of Odoo on a single Ubuntu 16.04 VPS using a Python virtual environment. This guide should work on other Linux VPS systems, just as well, but was tested and written for an Ubuntu 16.04 VPS.
Login to your VPS via SSH
ssh [email protected]_IP
Update your system and install all required packages
sudo apt-get update && apt-get -y upgrade sudo apt-get install git wkhtmltopdf python-pip python-dev python-virtualenv libevent-dev gcc libjpeg-dev libxml2-dev libssl-dev libsasl2-dev node-less libldap2-dev libxslt-dev
Installing PostgreSQL
Installing PostgreSQL with apt:
apt install postgresql-9.5 postgresql-server-dev-9.5 systemctl enable postgresql.service systemctl start postgresql.service
Creating Odoo Users
We will install two instances of Odoo, Odoo version 10 and Odoo version 9. To create system users for both:
sudo adduser --system --group odoo10 --home /opt/odoo10 sudo adduser --system --group odoo9 --home /opt/odoo9
Create a PostgreSQL user database, odoo10 and odoo9:
su - postgres -c "createuser --createdb --username postgres --no-createrole --no-superuser --no-password odoo10" su - postgres -c "createuser --createdb --username postgres --no-createrole --no-superuser --no-password odoo9"
Install Odoo
First, we will install Odoo version 10. To switch to user odoo10:
sudo su - odoo10 -s /bin/bash
Cloning Odoo 10 from Github:
git clone https://www.github.com/odoo/odoo --depth 1 --branch 10.0 --single-branch /opt/odoo10
Create a python virtual environment and install all requirements:
cd /opt/odoo10 virtualenv ./venv source ./venv/bin/activate pip install -r requirements.txt
Switch your user:
exit
To install Odoo version 9, switch to user odoo9:
sudo su - odoo9 -s /bin/bash
Cloning Odoo 9.0 from Github:
git clone https://www.github.com/odoo/odoo --depth 1 --branch 9.0 --single-branch /opt/odoo9
Create a python virtual environment and install all requirements:
cd /opt/odoo9 virtualenv ./venv source ./venv/bin/activate pip install -r requirements.txt
Switch to your user:
exit
Setting up Odoo
We will configure Odoo 10 to listen on port 8010 and Odoo 9 to port 8009 and set a master admin password. You can also set the port numbers according to your wishes.
>sudo nano /etc/odoo10.conf
[options] admin_passwd = ваш_сложный_пароль db_host = False db_port = False db_user = odoo10 db_password = False addons_path = /opt/odoo10/addons logfile = /var/log/odoo10.log xmlrpc_port = 8010
sudo nano /etc/odoo9.conf
[options] admin_passwd = ваш_сложный_пароль db_host = False db_port = False db_user = odoo9 db_password = False addons_path = /opt/odoo9/addons logfile = /var/log/odoo9.log xmlrpc_port = 8009
Systemd scripting:
sudo nano /lib/systemd/system/odoo10.service
[Unit] Description=Odoo 10 Requires=postgresql.service After=postgresql.service [Service] Type=simple PermissionsStartOnly=true User=odoo10 Group=odoo10 SyslogIdentifier=odoo10 ExecStart=/opt/odoo10/venv/bin/python2 /opt/odoo10/odoo-bin -c /etc/odoo10.conf [Install] WantedBy=multi-user.target
sudo nano /lib/systemd/system/odoo9.service
[Unit] Description=Odoo 10 Requires=postgresql.service After=postgresql.service [Service] Type=simple PermissionsStartOnly=true User=odoo9 Group=odoo9 SyslogIdentifier=odoo9 ExecStart=/opt/odoo9/venv/bin/python2 /opt/odoo9/openerp-server -c /etc/odoo9.conf [Install] WantedBy=multi-user.target
Final steps
Enable both Odoo instances to start at boot:
sudo systemctl enable odoo10.service sudo systemctl enable odoo9.service
To launch instances of Odoo 10 and Odoo 9, run the following command:
sudo systemctl start odoo10.service sudo systemctl start odoo9.service
You can now access the Odoo 10 installation at http://your_ip_address:8010
and installing Odoo 9 at http://your_ip_address:8009
…
That’s all. You have successfully installed Odoo version 10 and version 9 on your Ubuntu VPS. Now open your browser, enter the address of your installation and create a database user and administrator. For more information on how to manage your Odoo installation, please refer to Odoo documentation… If you want to make your Odoo faster, check out our tutorial on how to speed up Odoo.