How to Install Odoo 13 on Ubuntu 20.04 LTS
The latest version of ubuntu 20.04 got released in April 2020 with a particular emphasis on security and performance. As they mentioned in their release note, the performance standards of Ubuntu 20.04 is much better compared to previous versions. Also, they focused on and improvised the security side. About a server both are very essential features. Let’s see how to install Odoo 13 on Ubuntu 20.04 LTS Server.
Step 1: Update your Server
First of all login to the server or connect through ssh using the terminal. Then update your system.
sudo apt-get updatesudo apt-get upgrade
Step 2: Secure the server
After updating the server we ensure that the server is remotely accessible
sudo apt-get install openssh-server fail2ban
Step 3: Add a new system user
Next, we will create a system user for running the Odoo service.
sudo adduser --system --home=/opt/odoo --group odoo
Step 4: Installing Packages and libraries
After creating system user, need to install some necessary tools and libraries which are required to build Odoo dependencies.
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
After installation of the packages and libraries, we need to install some web dependencies also.
sudo apt-get install -y npmsudo ln -s /usr/bin/nodejs /usr/bin/nodesudo npm install -g less less-plugin-clean-csssudo apt-get install -y node-less
Install wkhtmltopdf to print PDF reports. ‘0.12.5’ is the recommended version for Odoo13. You can install wkhtmltopdf using the following command.
sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.debsudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.debsudo apt install –f
Step: 5: Configure PostgreSQL
PostgreSQL must be correctly installed for Odoo to run. Odoo using PostgreSQL as the database server.
sudo apt-get install postgresql
After the successful installation of PostgreSQL, you have to create a new PostgreSQL user for managing odoo databases.
sudo su - postgrescreateuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo13
After executing the command, the odoo13 user is generated and a password is given.
Then change the user as a superuser.
psqlALTER USER odoo13 WITH SUPERUSER;
Then use “\q” for exit from the psql and use the “exit” command to continue the installation
Step 6: Clone Odoo from git
After the configuration of PostgreSQL, you have to clone Odoo 13 from the Github repo. So first ensure that git is installed in the server.
sudo apt-get install git
Then change system user to Odoo user which is created for Odoo installation. This will help to avoid the risk related to the access rights issues.
sudo su - odoo -s /bin/bash
Next clone Odoo 13 Community version from Odoo GitHub Repository.
git clone https://www.github.com/odoo/odoo --depth 1 --branch 13.0 --single-branch .
This will download the source files to the created user’s home directory which will be /opt/odoo
Then exit and continue the installation
Step 7: Install Required Dependencies for Odoo
Odoo needs some dependencies to run smoothly. And these required dependencies are listed in the file requirements.txt located within the odoo directory
sudo pip3 install -r /opt/odoo/requirements.txt
Step 8: Configure Odoo
After the successful installation of dependencies, we have to configure Odoo. Odoo will maintain log files.
Create a directory to store the log file
sudo mkdir /var/log/odoo
Next, we will give complete access to this directory to the user odoo.
sudo chown odoo:root /var/log/odoo
After the process of the log file, create a configuration file for Odoo. You can copy that file which comes with Odoo, to an appropriate location.
To copy the configuration file:
sudo cp /opt/odoo/debian/odoo.conf /etc/odoo.conf
Now you have to make some changes to the configuration file. For that, you can use a text editor called ‘nano’
sudo nano /etc/odoo.conf
The configuration file is shown below:
[options] ; This is the password that allows database operations: ; admin_passwd = admin db_host = False db_port = False db_user = odoo13 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: admin password for PostgreSQL databasedb_host: the database hostdb_port: the database portdb_user: the database user namedb_password: the database passwordaddons_path: addons paths (separated by commas)logfile: the log file path
Next, we have to give the access rights to the previously created user.
sudo chown odoo: /etc/odoo.confsudo chmod 640 /etc/odoo.conf
Step 9: Test Odoo Installation
Now we have successfully completed the Odoo service creation and Odoo installation. Now start the Odoo service.
sudo systemctl start odoo.service
Now you can access Odoo using a web browser. Enter 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 is running successfully, the installation process has been completed. You can run Odoo using the previous command.
If you need the Odoo service to start automatically on boot time, you can use the following command.