Ubuntu is one of the operating systems in which the Odoo platform is supported. Moreover, you should follow a series of synchronised steps to install and run the platform in it.
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
Here is the step by step description to install Odoo into ubuntu, use the commands available in these steps to configure it to be operational.
Step 1: Update your system
First, you have to update the server or the system. You can update it through the use of 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 and secure to operate.
sudo apt-get install openssh-server fail2ban
Step 3: User Creation
The next step is to create a system user for Odoo, you can create a system user by using the command described below:
sudo adduser --system --home=/opt/odoo --group odoo
If you follow the above steps precisely, 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 therefore you have to install and configure the PostgreSQL database server in order to run Odoo 13 in it. You can install PostgreSQL using the following command:
sudo apt-get install postgresql
This will install PostgreSQL on your server.
Furthermore 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. In addition, while running the above command the Postgres will ask you to create and enter a password for the created user.
Further after creating the user, change the user as to superuser using the following command
psql
ALTER USER odoo13 WITH SUPERUSER;
After changing the user, use the command “\q” to exit Furthermore, to 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 that occurs during the running of the above command or you get a error message, try the command 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 based dependencies also. Therefore 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. Moreover, the recommended version of wkhtmltopdf is 0.12.5 that you can download and install to be operational 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. Moreover, before cloning, you need to ensure that git is installed and if not 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 and errors generating. Therefore to do so, run the following command.
sudo su - odoo -s /bin/bash
Now we are ready to clone odoo13 from the Github repo. In addition, 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 of the code will download the Odoo source files to the user’s home directory which will be /opt/odoo
After that you can exit from the Odoo user using the “exit” command in order to continue the installation process.
Step 7: Configure Odoo
As we have done cloning Odoo 13 from Github repo, now we have to configure the Odoo followed by that we have to create a log file for Odoo. Moreover, Odoo will create and maintain log files here therefore, initially 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 that was previously created. You can do it via running the following command:
sudo chown odoo:root /var/log/odoo
After creating the log directory, we need to create a configuration file for running Odoo. Moreover, there will be a configuration file that comes with Odoo. However, we have to copy that file to a more appropriate location. Therefore, 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 therefore, edit the created configuration file by using a text editor called nano. Furthermore, you can use the following command to do that:
sudo nano /etc/odoo.conf
Now you can alter the configuration file as 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
Now you can alter the configuration file as shown below:
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 now have to provide ownership for the file to the Odoo user which was created previously. Moreover, the ownership can be provided to the user by using 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 step is to create Odoo service.
Step 8: Configure Odoo Service
As we have created the configuration file, now we have to create a service to run Odoo, for that lets 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,
[Unit]
Description=Odoo
Documentation=http://www.odoo.com
[Service]
# Ubuntu/Debian convention:
Type=simple
User=odoo
ExecStart=/opt/odoo/odoo-bin -c /etc/odoo.conf
[Install]
WantedBy=default.target
After creating the service file we have to provide full access rights to this file for the root user, for that you can run the following command-
sudo chmod 755 /etc/systemd/system/odoo.service
sudo chown root: /etc/systemd/system/odoo.service
Step 9: Test Installation
As we have done creating the Odoo service and the Odoo installation is done now we have to start the Odoo service that we have created to 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
As the Odoo service is running, now we have completed the installation of Odoo 13. Furthermore, the Odoo service will start when we run the start command mentioned above.
In addition, to make the Odoo service start automatically on boot time, we have to run the following command:
sudo systemctl enable odoo.service
Now we have completed the Odoo 13 installation. In addition, for accessing Odoo 13, open a browser window and enter the following address in the address bar.
“http://<your_domain_or_IP_address>:8069”
If every aspect is configured properly and as per the standards the page will be redirected to Odoo’s database creation page. Furthermore, if you want to change the default port number from 8069 you have to change it in the configuration file.If you are using the latest version of Ubuntu. Our installation tutorial will help you to install Odoo without any issues. Moreover you can refer to our latest blog on How to Install Odoo 13 on Ubuntu 20.04 LTS.