Knowledgebase

Question About Servers

How to Install Odoo 13 on CentOS 7 Print

  • 3

This article will guide you through the installation and configuration process of Odoo 13 in a CentOS 7.

Prerequisites

OS: CentOS 7

Resources: 2-core CPU & 2GB of RAM

Access: SSH connection to the server

Permissions: a user with 'sudo' privileges

Note: you can execute all of the commands below from the root user, but for security purposes, it is recommended that you use a separate user with sudo privileges.

Step 1: Connect to the server via SSH

The first step in the installation is to connect to your server via ssh. Use the following command

ssh username@IP_Address -p Port_number

Replace the 'username', 'IP_Address', and 'Port_number' with the correct ones for your server.

Step 2: Update the System

Before starting, make sure your CentOS 7 system is up to date by running the following command:

sudo yum update

Step 3: Install Dependencies

Next, you'll need to install some dependencies required by Odoo 13. These include Python 3, PostgreSQL, and several Python libraries. You can use the following command to install them:

sudo yum install -y epel-release yum-utils
sudo yum install -y python3-pip python3-devel git nodejs-less libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel
sudo yum install -y postgresql-server postgresql-contrib

Step 4: Install and Configure PostgreSQL

After installing PostgreSQL, you need to initialize the database and start the PostgreSQL service:

sudo postgresql-setup initdb
sudo systemctl start postgresql
sudo systemctl enable postgresql

Next, you need to create a PostgreSQL user and database for Odoo 13. You can use the following commands to create a user named "odoo" with the password "odoo" and a database named "odoo":

sudo su - postgres
createuser -s odoo
createdb -O odoo odoo
exit

Step 5: Install wkhtmltopdf

In order for Odoo to generate PDF reports, you need to install a tool called wkhtmltopdf. Install the required dependencies by running the following command:

sudo yum install -y xorg-x11-fonts-75dpi xorg-x11-fonts-Type1 libXext openssl-devel

Download the wkhtmltopdf package from the official website. You can find the download links at https://wkhtmltopdf.org/downloads.html. Choose the appropriate version for your system.

For example, to download version 0.12.6 for 64-bit CentOS 7, you can run the following command:

wget https://downloads.wkhtmltopdf.org/0.12/0.12.6/wkhtmltox-0.12.6-1.centos7.x86_64.rpm

Install the wkhtmltopdf package by running the following command:

sudo yum localinstall -y wkhtmltox-0.12.6-1.centos7.x86_64.rpm

Verify that wkhtmltopdf is installed correctly by running the following command:

wkhtmltopdf --version

This should display the version number of wkhtmltopdf.

Step 6: Install Virtualenv

Next, you'll need to install virtualenv to create a Python virtual environment for Odoo 13. You can install it using the following command:

sudo pip3 install virtualenv

Step 7: Create a Virtual Environment

Now you can create a new virtual environment for Odoo 13 using the following commands:

mkdir ~/odoo-venv
cd ~/odoo-venv
virtualenv -p python3 odoo-venv

Step 8: Activate the Virtual Environment

After creating the virtual environment, you need to activate it using the following command:

source ~/odoo-venv/odoo-venv/bin/activate

Step 9: Install Odoo 13

Now you're ready to install Odoo 13 within the virtual environment. You can use the following commands to download the Odoo 13 source code from GitHub and install it:

git clone https://github.com/odoo/odoo.git -b 13.0 --depth=1
cd odoo
pip3 install -r requirements.txt

Step 10: Create a directory for custom addons

Navigate to the root directory of the virtual environment by running the following command:

cd /path/to/odoo-venv/

Be sure to replace /path/to/odoo-venv with the actual path to your Odoo virtual environment. Create a new directory called custom_addons in the odoo directory within the virtual environment by running the following command:

mkdir odoo/custom_addons

Change the ownership of the custom_addons directory to the user who will be running the Odoo server by running the following command:

sudo chown -R odoo_user:odoo_user odoo/custom_addons

Replace odoo_user with the name of the user who will be running the Odoo server. Exit the Virtual environment by running this command:

deactivate

Step 11: Configure Odoo 13

Create a new file called "odoo.conf" in the etc directory of the virtual environment by running the following command:

sudo nano etc/odoo.conf

This will open the Nano editor, allowing you to create and edit the "odoo.conf" file within the virtual environment. Copy and paste the following configuration settings into the file:

[options]
addons_path = /path/to/odoo-venv/odoo/addons,,/path/to/odoo-venv/odoo/custom_addons
admin_passwd = admin_password
db_host = False
db_port = False
db_user = odoo_user
db_password = False
db_name = False
dbfilter = .*
logfile = /path/to/odoo-venv/odoo-server.log
logrotate = True

Be sure to replace /path/to/odoo-venv with the actual path to your Odoo virtual environment. Save the file and exit the Nano editor by pressing Ctrl+X, then Y, and then Enter.

Step 12: Create a Systemd Service File

To run Odoo 13 as a systemd service, you need to create a systemd service file. You can create a new file called "odoo.service" in the "/etc/systemd/system" directory using the following command:

sudo nano /etc/systemd/system/odoo.service

Add the following lines to the file:

[Unit]
Description=Odoo 13
After=postgresql.service

[Service]
Type=simple
User=<username>
Group=<group>
ExecStart=/home/<username>/odoo-venv/odoo-venv/bin/python3 /home/<username>/odoo-venv/odoo/odoo-bin -c /home/<username>/odoo-venv/odoo.conf
StandardOutput=journal+console

[Install]
WantedBy=default.target

Replace <username> and <group> with your Linux username and group name.

Save and close the file.

Step 13: Start and Enable the Odoo 13 Service

Now you can start the Odoo 13 service using the following command:

sudo systemctl start odoo

You can also enable the service to automatically start at boot time using the command below:

sudo systemctl enable odoo

Step 14: Check the Status of the Odoo 13 Service

You can check the status of the Odoo 13 service by running the following command:

sudo systemctl status odoo

If everything is working correctly, you should see output similar to the following:

● odoo.service - Odoo 13
   Loaded: loaded (/etc/systemd/system/odoo.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2023-02-23 15:22:17 UTC; 8s ago
 Main PID: 20406 (python3)
    Tasks: 1
   Memory: 42.9M
   CGroup: /system.slice/odoo.service
           └─20406 /home/<username>/odoo-venv/odoo-venv/bin/python3 /home/<username>/odoo-venv/odoo/odoo-bin -c /home/<username>/odoo-venv/odoo.conf

Step 15: Access Odoo 13

Now you can access Odoo 13 by opening a web browser and navigating to "http://SERVER_IP:8069" (replace "SERVER_IP" with the IP address of your server). You should see the Odoo 13 login page as shown below.

Note: If you're using a firewall on your server, you'll need to open port 8069 to allow inbound traffic to Odoo 13.

That's it! You've successfully installed Odoo 13 within a Python virtual environment on CentOS 7.


Was this answer helpful?

« Back

Enterprise-Grade Hardware

  • Samsung
  • Juniper
  • Western Digital
  • Supermicro
  • LSI
  • Intel
  • R1Soft Backups
  • cPanel
  • MySQL
  • Parallels
  • HP Partner