The latest version of ubuntu 20.04 got released on this April with a particular emphasis on security and performance. As they mentioned in their release notes Ubuntu 20.04 have much better performance than 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 update
sudo apt-get upgrade
Step 2: Secure the server
After updating server we ensure that the server is remotely accessible
sudo apt-get install openssh-server fail2ban
Step 3: Add a new system user
Next, will create a system user for running 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, need to install some we dependencies also.
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
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.deb
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo 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 successful installation of PostgreSQL, you have to create a new PostgreSQL user for managing odoo databases.
sudo su - postgres
createuser --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.
ALTER USER odoo13 WITH SUPERUSER;
Then use “\q” for exit from the psql and use “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 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 the access right 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 the Odoo. Odoo will maintain log files.
create a directory to store the log file
sudo mkdir /var/log/odoo
Next will give the complete access of 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 in the configuration file. For that, you can use text editor called ‘nano’
sudo nano /etc/odoo.conf
The configuration file as shown below:
; 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 database
db_host: the database host
db_port: the database port
db_user: the database user name
db_password: the database password
addons_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.conf
sudo chmod 640 /etc/odoo.conf
Step 8: Configure Odoo Service
After successful creation of the configuration file, create a service to run Odoo. you have to create a new file in the directory /etc/systemd/system/ for service named ‘odoo.service’.
sudo nano /etc/systemd/system/odoo.service
The file should contain the following contents.
# Ubuntu/Debian convention:
ExecStart=/opt/odoo/odoo-bin -c /etc/odoo.conf
After saving the file give full access to the system user we created for Odoo installation
sudo chmod 755 /etc/systemd/system/odoo.service
sudo chown root: /etc/systemd/system/odoo.service
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 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