Odoo (formerly known as OpenERP) is a suite of open-source business applications. The most used modules for Odoo include Point of Sale (POS), Inventory, CRM, Website, Live Chat, e-Commerce, Billing, Accounting, Warehouse, and others. The range of the modules that can be installed in one application makes Odoo very popular nowadays.
Let’s learn how to install and start using Odoo 14 on a Debian OS. Remember, if you want to skip this part and let others automate it for you, you can do so by subscribing to any Debian hosting plan and acquiring all the assistance you’ll ever need. In this tutorial, we will show you how to install Odoo 14 on Debian 11 with Apache as a reverse proxy.
Prerequisites
- A Debian 11 VPS.
- At least 2GB of RAM.
- SSH access with sudo privileges, or root access.
Step 1. Update System
First of all, we need to log in to our Debian 10 VPS through SSH:
ssh master@IP_Address -p Port_number
Replace “master” with a user that has sudo privileges or root if necessary. Additionally, replace “IP_Address” and “Port_Number” with your server’s respective IP address and SSH port number. Next, let’s make sure that we’re on Debian 11. You can verify it with this command:
$ lsb_release -a
You should get this as the output:
Distributor ID: Debian<br>Description: Debian GNU/Linux 11 (bulleseye)<br>Release: 11<br>Codename: bullseye
Then, run the following command to make sure that all installed packages on the server are updated to their latest available versions:
$ sudo apt update && sudo apt upgrade
Step 2. Add System User
We will install the Odoo instance under a system user account. So, we need to create a new system account.
$ sudo useradd -m -d /opt/odoo14 -U -r -s /bin/bash odoo14
Step 3. Install Dependencies
We need to install some Python dependencies to proceed with installing Odoo in our Debian 11 system. Let’s install them by running this command below.
$ sudo apt install build-essential wget git python3-pip python3-dev python3-venv \<br>python3-wheel libfreetype6-dev libxml2-dev libzip-dev libsasl2-dev \<br>python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev \<br>libxslt1-dev libldap2-dev libtiff5-dev libopenjp2-7-dev
Step 4. Install PostgreSQL
For data storage, Odoo uses PostgreSQL. Invoke the command below to install PostgreSQL on Debian 11.
$ sudo apt install postgresql
Once the installation is completed, add a postgresql user for our Odoo 14, run this command:
$ sudo su - postgres -c "createuser -s odoo14"
Step 5. Install Wkhtmltopdf
Wkhtmltopdf is an open-source command line tool to render HTML data into PDF format using Qt webkit. To install wkhtmltopdf on your Debian 11 server, follow these steps below.
$ sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb
$ sudo apt install ./wkhtmltox_0.12.5-1.buster_amd64.deb
$ sudo apt -f install
Step 6. Install Odoo
There are several ways to install Odoo on a Debian 11 machine, But, in this tutorial, Odoo 14 will be installed under a python virtual environment. Let’s switch to system user ‘odoo14’
$ sudo su - odoo14
The command above should bring you to /opt/odoo14 and log in as user ‘odoo14’. Now, download Odoo from Github
$ git clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0 odoo14
Create python virtual environment
Run the following command to create a new python virtual environment.
$ python3 -m venv odoo14-venv
The virtual environment is installed, now we need to activate it
$ source odoo14-venv/bin/activate
Once invoked, your shell prompt would look like this:
(odoo14-venv) odoo14@debian11:~$
Next, let’s install Odoo
(odoo14-venv) odoo14@debian11:~$ pip3 install wheel (odoo14-venv) odoo14@debian11:~$ pip3 install -r odoo14/requirements.txt
Once completed, we can create a new directory to store our custom Odoo addons. This command is run under the system user ‘odoo14’.
(odoo14-venv) odoo14@debian11:~$ deactivate $ mkdir /opt/odoo14/odoo14/custom-addons
Now, exit from user ‘odoo14’ and create Odoo configuration file.
$ exit<br>$ sudo nano /etc/odoo14.conf
Paste the following contents into the file.
[options]<br>admin_passwd = m0d1fyth15<br>db_host = False<br>db_port = False<br>db_user = odoo14<br>db_password = False<br>addons_path = /opt/odoo14/odoo14/addons,/opt/odoo14/odoo14/custom-addons<br>xmlrpc_port = 8069
Make sure to modify the value of admin_passwd key above to a strong password. This is your Odoo’s master password, you need it to create or delete databases.
Create Odoo Systemd Unit file
In this step, we will create a systemd unit file, it is required to start/stop/restart Odoo.
$ sudo nano /etc/systemd/system/odoo14.service
Paste the following content into the systemd unit file above.
[Unit] Description=Odoo14 Requires=postgresql.service After=network.target postgresql.service [Service] Type=simple SyslogIdentifier=odoo14 PermissionsStartOnly=true User=odoo14 Group=odoo14 ExecStart=/opt/odoo14/odoo14-venv/bin/python3 /opt/odoo14/odoo14/odoo-bin -c /etc/odoo14.conf StandardOutput=journal+console [Install] WantedBy=multi-user.target
That’s it. We can now reload systemd and run Odoo.
$ sudo systemctl daemon-reload<br>$ sudo systemctl start odoo14
Check if Odoo is starting by running this command:
$ sudo systemctl status odoo14
Open your web browser and navigate to http://YOUR_SERVER_IP_ADDRESS:8069
you would see Odoo page.
Step 7. Install and Configure Apache
Odoo has been successfully installed at http://YOUR_SERVER_IP_ADDRESS:8069
and if we want to access it through our domain name or sub domain name, we need to create a reverse proxy. In this tutorial, we will use Apache as a reverse proxy to Odoo 14 instance.
To install apache, run this command:
$ sudo apt install apache2
Once installed or if it’s already installed, we can proceed with creating a virtual host file for our Odoo domain/subdomain.
$ sudo nano /etc/apache2/sites-available/yourdomain.com.conf
Then paste the following content into the configuration file. Remember to replace the domain name with your actual domain or sub domain name.
<VirtualHost *:80> ServerName yourdomain.com ServerAlias www.yourdomain.com ErrorLog ${APACHE_LOG_DIR}/yourdomain-error.log CustomLog ${APACHE_LOG_DIR}/access.log combined ProxyRequests Off <Proxy *> Order deny,allow Require all granted </Proxy> ProxyPass / http://127.0.0.1:8069/ ProxyPassReverse / http://127.0.0.1:8069/ <Location /> Order allow,deny Require all granted </Location> </VirtualHost>
Save the file then exit and run this command to enable the virtual host.
$ sudo a2ensite yourdomain.com
Do not forget to run the following commands to activate the proxy modules.
$ sudo a2enmod proxy<br>$ sudo a2enmod proxy_http
After enabling the virtual host and proxy, we need to restart apache
$ sudo systemctl restart apache2
That’s it! At this point, you should be able to access your Odoo instance both at http://YOURDOMAIN.COM
and http://YOUR_SERVER_IP_ADDRESS:8069
. To prevent your Odoo instance from being accessible when users access it through its port, we can disable direct access to the Odoo instances by configuring it to listen only on the local interface.
$ sudo nano /etc/odoo14.conf
Add this line:
xmlrpc_interface = 127.0.0.1
Save the file then exit and restart Odoo
$ sudo systemctl restart odoo14
That’s it all. Your Odoo instance is now only accessible from your domain or sub domain name. You can create a new database now.
Congratulations! You have successfully installed Odoo 14 on Debian 11.
You can secure your Odoo website by installing a free SSL certificate from Let’s Encrypt.
Of course, if you are one of our Debian Hosting customers, you don’t have to install Odoo 14 on Debian 11 with Apache as a reverse proxy on your own – simply ask our admins, sit back, and relax. Our admins will install Odoo 14 on Debian 11 with Apache as a reverse proxy for you immediately, along with many useful optimizations that we can do for you. Managing an Odoo website is not just about the installation, we can help you with optimizing your Odoo instance if you have a VPS with us.
If you liked this post about how to install Odoo 14 on Debian 11 with Apache as a reverse proxy, please share it with your friends on social networks or simply leave a comment in the comments section. Thanks.
very good tutorial, highly recommended