Odoo has launched the latest version of Odoo 14 with so many exciting features. Let us see the steps to install Odoo 14 in the ubuntu server with the version of 20.04 LTS. I hope this blog will help you to understand the installation process of Odoo.
Step-1: Keep update your Server
First of all login to the server using the ssh command. Eg: ssh username@<IP address>. Then use the following command to update your system.
sudo apt-get update
sudo apt-get upgrade
Step 2: Secure your system
After updating the server we ensure that the server is remotely accessible and install Fail2ban which is used to protect from SSH attacks
sudo apt-get install openssh-server fail2ban
Step 3: Create a system user
Now let us create a new system user for the Odoo service. Then we will limit the permissions of all Odoo related files and directories for this specific user.
sudo adduser --system --home=/opt/odoo --group odoo
Step 4: Installing Packages and libraries
Next, install some libraries and depending packages to run Odoo.
sudo apt-get install -y python3-pip
Install Packages and libraries:
sudo apt-get install python-dev python3-dev libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev libpq-dev libjpeg8-dev liblcms2-dev libblas-dev libatlas-base-dev
Ensure that all packages are successfully installed. Then some web dependencies also need to install.
sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less less-plugin-clean-css
sudo apt-get install -y node-less
Step: 5: Configure PostgreSQL
Odoo’s databases are handled by the PostgreSQL database server. So next need to set-up PostgreSQL properly.
Install Postgres from the Debian repository.
sudo apt-get install postgresql
Then we have to create a database user for managing odoo databases. So first we need to switch user to Postgres
sudo su - postgres
Now create a user odoo14 with the following command. At the time you must have to provide a new password for the user odoo14 and that password is needed to provide in the odoo conf file at the last step of the installation.
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo14
Next made this user as a superuser for getting more privileges.
ALTER USER odoo14 WITH SUPERUSER;
It will print a success message in the terminal. Now exit from the psql and Postgres. With the following commands
Step 6: Get Odoo community from git
Next, we have to place the odoo source file into our server. We can easily clone the community edition from Odoo’s GitHub repository.
To clone from git we must ensure git is installed in the server.
sudo apt-get install git
Before cloning, we have to change the system user as odoo (which is created in Step 3) to make the odoo system more secure.
sudo su - odoo -s /bin/bash
Next step clone from odoo repository and the corresponding branch
git clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0 --single-branch .
Source files are cloned to the home directory of user odoo. The home directory of the user, specified at the time of user creation. Which is /opt/odoo.
Then exit and continue the installation
Step 7: Install required python packages
Odoo using various python packages and libraries for different purposes. To run odoo we need to install them using pip3. The required dependencies are listed in requirement.txt file which is contained in the odoo folder. So we can specify this file to the pip install command. It will automatically install one by one package listed in the file requirement.txt
sudo pip3 install -r /opt/odoo/requirements.txt
We have to ensure that every package is installed without fail. Otherwise, it will cause to getting an error at the time of run odoo.
Odoo using wkhtmltopdf for printing pdf reports. The latest edition of Odoo supports the 0.12.5 version of wkhtmltopdf to support headers and footers.
Use following commands to download and install wkhtmltopdf
sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo apt install -f
Step 8: Configuration of Odoo
Odoo wants to know some information like database user, password, addons locations, etc. to run the system. These things will be provided in the configuration file. So next we have to create a configuration file for Odoo. within the odoo folder containing a sample file of configuration. We can copy it to a specific location. Usually, we place configuration files in /etc location.
To copy the configuration file to /etc :
sudo cp /opt/odoo/debian/odoo.conf /etc/odoo.conf
Next step is we need to provide necessary details into the file.
sudo nano /etc/odoo.conf
Update conf file same as below
; This is the password that allows database operations:
admin_passwd = admin
db_host = False
db_port = False
db_user = odoo14
db_password = False
addons_path = /opt/odoo/addons
logfile = /var/log/odoo/odoo.log
The configuration file should have at least the following parameters:
admin_passwd: Provide strong password, it will required during database create/delete/restore operations
db_host: the database host
db_port: the database port
db_user: the database user name
db_password: provide db user password
addons_path: if you have enterprise edition or third party modules create another directory and specify the paths here separated by commas
logfile: the log file path
We need to set access rights to the system used for the conf file.
sudo chown odoo: /etc/odoo.conf
sudo chmod 640 /etc/odoo.conf
Odoo will maintain logs in a log file that is specified in the configuration. create a directory for logs. Usually, logs are contained in the location /var/log. So we can also create a directory inside this location named odoo.
sudo mkdir /var/log/odoo
As we did earlier, this directory has also set permission for user odoo.
sudo chown odoo:root /var/log/odoo
Step 9: Create new service for odoo
After successfully configured odoo, create a service for Odoo.
For that create a new file in /etc/systemd/system named ‘odoo.service’.
sudo nano /etc/systemd/system/odoo.service
Place the following into the file.
# Ubuntu/Debian convention:
ExecStart=/opt/odoo/odoo-bin -c /etc/odoo.conf
Next set permissions for the root user to this file.
sudo chmod 755 /etc/systemd/system/odoo.service
sudo chown root: /etc/systemd/system/odoo.service
Step 10: Run Odoo 14
Now the installation procedures are successfully completed. Let’s start and test odoo. Use the following command to start odoo service.
sudo systemctl start odoo.service
And check status of odoo service
sudo systemctl status odoo.service
If it is in the active state you can access Odoo by entering the following URL.
If everything is working well the page will be redirected to Odoo’s database creation page.
You can check the log file specified in the configuration file.
sudo tail -f /var/log/odoo/odoo.log
If the odoo running successfully, the installation process is completed. You can run the odoo using the previous command.
If you need Odoo service starts automatically on boot time, you can use the following command.
sudo systemctl enable odoo.service
Refer to our previous blogs on how to install Odoo in Different Ubuntu version.