The latest version of Ubuntu 20.04 was 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 are much better compared to previous versions. Also, they focused on and improved 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 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 the system user, you need to install some necessary tools and libraries that are required to build Odoo dependencies.
Install pip3:
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.
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 Odoo 13. 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 is using PostgreSQL as the database server.
Install PostgreSQL:
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 - 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.
psql
ALTER 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 on the server.
sudo apt-get install git
Then change the system user to the Odoo user, which is created for Odoo installation. This will help to avoid the risk related to access rights issues.
sudo su - odoo -s /bin/bash
Next, clone the Odoo 13 Community version from the 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
exit
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 processing of the log file, create a configuration file for Odoo. You can copy the file that 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 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 access rights to the previously created user.
sudo chown odoo: /etc/odoo.conf
sudo 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:
“http://<your_domain_or_IP_address>:8069”
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 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 at boot time, you can use the following command:.
sudo systemctl enable odoo.service
Have a look at the following blog to explore more about How to Install Odoo 13 on Ubuntu 20.04 LTS