How to Install Odoo 10 with subdomain filtering


odoo

In this tutorial, we will show you how to install Odoo 10 on an Ubuntu 16.04 VPS and configure it to use sub-domain filtering so users can run multiple Odoo instances on different sub-domains (with a different database for each subdomain).

Make sure your OS package list and the OS packages are up to date by running the following commands:

sudo apt-get update
sudo apt-get upgrade

Then, start with the Odoo 10 installation. The easiest way to install Odoo 10 on your Linux VPS is to use the Odoo install script available at github.com, so download the script to a directory on your server:

cd /opt
wget https://raw.githubusercontent.com/Yenthe666/InstallScript/10.0/odoo_install.sh

Edit the script and change the Odoo master password. Also, you can change the Odoo username, Odoo install path, Odoo port number, Odoo version (Enterprise, Community) etc.

vi odoo_install.sh
#set the superadmin password
OE_SUPERADMIN="admin"

Replace ‘admin’ with a strong password, e.g.:

OE_SUPERADMIN="Adm1NPa55w0^D"

Make the Odoo install script executable:

chmod +x odoo_install.sh

Run the Odoo install script and allow some time for the installation process to complete.

./odoo_install.sh

Once the Odoo 10 installation is complete, edit the Odoo configuration file (/etc/odoo-server.conf) and configure it for subdomain filtering, i.e. add dbfilter = ^%d$ to it:

vi /etc/odoo-server.conf
[options]
; This is the password that allows database operations:
admin_passwd = Adm1NPa55w0^D
db_host = False
db_port = False
db_user = odoo
db_password = False
dbfilter = ^%d$
addons_path = /usr/lib/python2.7/dist-packages/odoo/addons
[options]
logfile = /var/log/odoo/odoo-server.log
addons_path=/odoo/odoo-server/addons,/odoo/custom/addons
xmlrpc_port = 8069

Do not forget to replace the Odoo master password with the one you set in the Odoo install script. Also if you modified Odoo addons_path, Odoo port number or so, you need to change them to the Odoo configuration too.

Edit the config.py Odoo script:

vi /odoo/odoo-server/odoo/tools/config.py

Change:

"--db-filter", dest="dbfilter", my_default='.*'

to

"--db-filter", dest="dbfilter", my_default='%d'

Then, restart the Odoo server for the changes to take effect:

/etc/init.d/odoo-server restart
Get an Odoo VPS from us and our EPIC 24/7 Support Team will install, configure and optimize Odoo for you, for free.

Install Apache, pip and mod-wsgi:

sudo apt-get install python-pip apache2 libapache2-mod-wsgi

Disable the default Apache configuration file:

a2dissite 000-default.conf

Create a new Apache configuration file. For example, create a new Apache configuration file named ‘odoo.conf’:

vi /etc/apache2/sites-available/odoo.conf

Enable the ‘odoo.conf’ Apache configuration file:

a2ensite odoo

Add the following lines to it:
<VirtualHost *:80>
ServerName your-domain.com
ServerAlias *.your-domain.com
WSGIScriptAlias / /odoo/odoo-server/odoo/service/wsgi_server.py
WSGIDaemonProcess oe user=odoo group=odoo processes=2 python-path=/odoo/odoo-server/ display-name=apache-odoo
WSGIProcessGroup oe
ErrorLog /var/log/odoo/odoo-error.log
CustomLog /var/log/odoo/odoo-access.log combined
<Directory /opt/odoo>
#Order allow,deny
#Allow from all
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Restart the Apache web server for the changes to take effect:

service apache2 restart

That is it. Odoo 10 is configured to use sub-domain filtering now.

Open http://subdomain1.your-domain.com:8069 in a web browser, enter the Odoo master password, the database name, email address and password, select a country from the drop-down selection box and click ‘Create database’.
Repeat the same steps for subdomain2.your-domain.com etc., and then you can access each Odoo instance using http://subdomain1.your-domain.com:8069 , http://subdomain2.your-domain.com:8069 and so on.


Of course, you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Odoo 10 with subdomain filtering for you. They are available 24×7 and will take care of your request immediately.

You can also check one of our previous tutorials: Install Odoo 10 on CentOS 7 with Apache as a reverse proxy

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Tutorials
Create MySQL user and Grant Permissions to MySQL Database
Tutorials
How to Speed Up Your Magento eCommerce Site
Tutorials
Install CandyCane on an Ubuntu 14.04 VPS
  • Stella

    StellaStella

    Author Reply

    Thanks. do you have anything like this for CENTOS 7?


  • Sabu

    SabuSabu

    Author Reply

    Hi Please let me know how can I duplicate one sub domain database to a new sub domain. Thank you


    • admin

      adminadmin

      Author Reply

      Go to your_server_address:odoo_port/web/database/manager and click on the “Duplicate Database” button. The new database name should be same as your new subdomain.


  • Ugorji Nnanna

    Thanks a lot for this. I have installed Odoo 10 on Centos 7.

    I can’t seem to find a config.py file (/odoo/odoo-server/odoo/tools/config.py)

    Please could you guide me to what directory to find this file for Centos 7?

    Thank you.


    • admin

      adminadmin

      Author Reply

      If the installation was successful (no errors when running ./odoo_install.sh) you should be able to open that file, if not try to run the script again.


  • Pillar

    PillarPillar

    Author Reply

    Thank you for the post,
    I did all steps but i didn’t where “subdomain1, subdomain2, subdomainx …etc” will be configured.

    if my VPS IP is xxx.xxx.xxx and i need to use my company domain instead, didn’t i need to some entries on my domain to point to this IP ? I’m really lost as i spend 5 days searching how to do so and still no progress, please can you let me know the steps (just headlines) ?
    I’ll be very thankful if you had any helpful links


    • admin

      adminadmin

      Author Reply

      You can install Odoo 10 and configure Apache as a reverse proxy so you can access Odoo via your company domain name using these instructions.


  • Abdul Jaleel

    Hi,

    Do you have any example for enabling SSL as well based on the same installation and configuration


    • admin

      adminadmin

      Author Reply

      We do not have any example for enabling SSL, but you should be able to install it without a problem. The installation should be the same as for any other application.


    • Robert

      RobertRobert

      Author Reply

      for the SSL you can use Let’s Encrypt, i know the conf of this in Nginx, but i dont have idea in apache runs


  • Robert

    RobertRobert

    Author Reply

    Hello, i have this list of subdomain: company1.domain.com, company2.domain.com and i need a custom domain for company2 example: company2.com but when i create a db in company it dont detect the database :/


    • admin

      adminadmin

      Author Reply

      The databasename name must be same as the subdomain name. If you want to create a database for company2.domain.com, go to http://company2.domain.com and create a database named company2


  • Dedy

    DedyDedy

    Author Reply

    Hi, thank for your post.
    I install Odoo 9 in my server with 40 core & 48 GB RAM but it usually down when accessed by many users (I have about 400 retail store).
    I tried to separate app & database but still down when accessed by many users.
    What’s the minimum requirements for Odoo which accessed by many user like mine?
    Thanks for your answer.


 
Free Migration to RoseHosting. Award Winning Linux VPS Hosting with Fully Managed Support. Coupon RHBLOG50 for 50% offOrder Now
+