This blog details the procedure to be followed while installing Odoo 13 in Ubuntu 18.04.
Follow the below steps to install Odoo 13 on Ubuntu 18.04
Step 1: Update your system
First, you have to update the server or the system. You can update it through the following commands
sudo apt-get update
sudo apt-get upgrade
Step 2: Secure your server
After making sure that the server is up to date, run the below command to make sure the server/system is remotely accessible.
sudo apt-get install openssh-server fail2ban
Step 3: User Creation
The next is to create a system user for Odoo, you can create a system user by using the below command-
sudo adduser --system --home=/opt/odoo --group odoo
If you follow the above steps, the source code of odoo will reside in the home directory of the created user.
Step 4: Configure PostgreSQL
Odoo needs PostgreSQL to run properly in a system. You have to install and configure the PostgreSQL database server in order to run odoo13. You can install PostgreSQL as follows.
sudo apt-get install postgresql
This will install PostgreSQL on your server.
For creating new PostgreSQL users for managing odoo databases run the below command.
sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo13
By running the above command a user named odoo13 will be created. While running the above command the Postgres will ask you to enter a password for the created user.
After creating the user, change the user as to superuser using the following command
ALTER USER odoo13 WITH SUPERUSER;
After changing the user use “\q” to exit.After that exit from Postgres user by “exit” command to continue the installation.
Step 5: Installing dependencies for Odoo
After installing and configuring PostgreSQL, you have to install the dependencies for Odoo.
Install pip3 by running the below command-
sudo apt-get install -y python3-pip
After installing pip3, you have to install the other dependencies using the pip3, for that run the below command.
sudo pip3 install Babel chardet decorator docutils ebaysdk feedparser gevent greenlet html2text Jinja2 libsass lxml Mako MarkupSafe mock num2words ofxparse passlib Pillow psutil psycopg2 pydot pyldap pyparsing PyPDF2 pyserial python-dateutil pytz pyusb PyYAML qrcode reportlab requests suds-jurko vatnumber vobject Werkzeug XlsxWriter xlwt xlrd polib
In case, if any error occurs during the running of the above command, try the below-
sudo pip3 install Babel chardet decorator docutils ebaysdk feedparser gevent greenlet html2text Jinja2 libsass lxml Mako MarkupSafe mock num2words ofxparse passlib Pillow psutil psycopg2-binary pydot pyldap pyparsing PyPDF2 pyserial python-dateutil pytz pyusb PyYAML qrcode reportlab requests suds-jurko vatnumber vobject Werkzeug XlsxWriter xlwt xlrd polib
After the successful installation of the above dependencies, you have to install some other web dependencies also. To install these dependencies run the below commands.
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
For printing PDF reports, Odoo needs wkhtmltopdf, the recommended version of wkhtmltopdf is 0.12.5. You can download and install it by running 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 6: Clone Odoo from Github
After completing the installation of dependencies the next is to clone Odoo 13 from the Github repo. Before cloning, you need to ensure that git is installed. You can install it from the below command.
sudo apt-get install git
After that, in order to clone Odoo 13, we should change the user as the system user we created for Odoo 13 installation. Otherwise, there will be access to rights-related issues. For that run the following command.
sudo su - odoo -s /bin/bash
Now we are ready to clone odoo13 from the Github repo. You can clone the community edition of Odoo 13 by running the following command.
git clone https://www.github.com/odoo/odoo --depth 1 --branch 13.0 --single-branch .
The ‘.’ command at the end will download the Odoo source files to the user’s home directory which will be /opt/odoo
After that exit from the Odoo user using the “exit” command in order to continue the installation process.
Step 7: Configure Odoo
We have done cloning Odoo 13 from Github repo, now we have to configure the Odoo. After that, we have to create a log file for Odoo. Odoo will create and maintain log files here. For that first, create a directory to store the log file, for that run the following command.
sudo mkdir /var/log/odoo
After that give full access to this directory for the Odoo user previously created. You can do it via running the below command-
sudo chown odoo:root /var/log/odoo
After done creating the log directory, we need to create a configuration file for running Odoo. There will be a configuration file that comes with Odoo we have to copy that file to a more appropriate location. Run the following command for copying the log file.
sudo cp /opt/odoo/debian/odoo.conf /etc/odoo.conf
After copying the configuration file, we have to make some changes in the configuration file in order to ensure the smooth running of Odoo, for that edit the created configuration file by using a text editor called nano. You can use the following command for that.
sudo nano /etc/odoo.conf
Alter 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: specify the database host
db_port: specify the database port
db_user: specify the database user name
db_password: specify the database password
addons_path: specify additional addons paths (separated by commas)
logfile: Specify the log file to store the log details.
After creating the configuration file as mentioned above, we have to provide ownership for the file to the Odoo user which is created previously. You can give the ownership by following the command-
sudo chown odoo: /etc/odoo.conf
sudo chmod 640 /etc/odoo.conf
After changing the ownership of the configuration file, the next is to create Odoo service. You can create an Odoo service as follows.
Step 8: Configure Odoo Service
After done creating the configuration file, we have to create a service to run Odoo, for that, create a new file for service named ‘odoo.service’ in the directory /etc/systemd/system/ by running the following command.
sudo nano /etc/systemd/system/odoo.service
Set content of the file as follows,
# Ubuntu/Debian convention:
ExecStart=/opt/odoo/odoo-bin -c /etc/odoo.conf
After creating the service file we have to provide full access rights to this file for the root user, for that, run the following command-
sudo chmod 755 /etc/systemd/system/odoo.service
sudo chown root: /etc/systemd/system/odoo.service
Step 9: Test Installation
We have done creating the Odoo service and Odoo installation. Now we have to start the Odoo service we have created for that run, using the following command.
sudo systemctl start odoo.service
In order to check the log file you can run the following command, from that you will be able to see the log running Odoo.
sudo tail -f /var/log/odoo/odoo.log
Now we have completed the installation of Odoo 13. The Odoo service will start when we run the start command mentioned above.
For making the Odoo service start automatically on boot time, we have to run the following command also.
sudo systemctl enable odoo.service
We have completed the odoo13 installation now. For accessing the Odoo 13, open a browser window and enter the following address in the address bar.
If everything is working properly the page will be redirected to Odoo’s database creation page. If you want to change the default port number from 8069 you have to change it in the configuration file.You can refer our latest blog on How to Install Odoo 13 on Ubuntu 20.04 LTS. If you are using the latest version of Ubuntu. Our installation tutorial will help you to install Odoo without any issues.