Linux Tactic

A Complete Guide to Installing Odoo 12 on CentOS 7

Installing Odoo 12 on CentOS 7

Odoo is a comprehensive suite of business applications including Sales, CRM, Accounting, Project management, Inventory management, and more. It’s an open-source alternative to popular commercial software like SAP and Salesforce.

This tutorial will guide you through the process of installing Odoo 12 on CentOS 7. We will cover all the necessary steps to get Odoo up and running on your server.

Prerequisites

Before we begin, make sure you have a CentOS 7 server set up with a non-root user with sudo privileges. You should have basic knowledge of Linux commands.

Install Python 3.6 and Odoo Dependencies

Odoo is written in Python, so we need to install Python 3.6 and other software dependencies before building Odoo. CentOS 7 comes with Python 2.7 by default, so we need to enable the Software Collections (SCL) repository to install Python 3.6. You can enable SCL by running the following commands:

sudo yum install centos-release-scl

sudo yum install rh-python36

After installing Python 3.6, we can build Odoo dependencies. Run the following command to install dependencies:

sudo yum install -y git gcc wget nodejs-less libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel

Create Odoo User

For better security, we need to create a new system user and group to run Odoo services. Run the following commands to create a new group and odoo user:

sudo groupadd -r odoo

sudo useradd -r -g odoo -d /opt/odoo -s /sbin/nologin odoo

Install and Configure PostgreSQL

Odoo uses the PostgreSQL database to store data, so we need to install and configure it. PostgreSQL is available in the default CentOS repositories.

sudo yum install postgresql-server

sudo postgresql-setup initdb

sudo systemctl enable postgresql

sudo systemctl start postgresql

After installing PostgreSQL, we need to create a new PostgreSQL user for Odoo to use. Run the following commands to create a new PostgreSQL user:

sudo su – postgres

createuser -d -R -S odoo

Install Wkhtmltopdf

Odoo uses Wkhtmltopdf to print PDF reports. To install Wkhtmltopdf, we need to enable the EPEL repository.

sudo yum install epel-release

sudo yum install wkhtmltopdf

Make sure you install the recommended version of Wkhtmltopdf for Odoo.

Install and Configure Odoo 12

Now that we have installed all the dependencies, we can install Odoo 12 from the GitHub repository. Clone the repository using the following command:

sudo su – odoo

git clone https://www.github.com/odoo/odoo –depth 1 –branch 12.0 /opt/odoo/odoo

After cloning the repository, we need to create a Python virtual environment for Odoo. Run the following commands to install the required Python modules:

cd /opt/odoo/odoo

sudo pip3 install virtualenv

sudo su – odoo

virtualenv -p python3 ~/venv/odoo

source ~/venv/odoo/bin/activate

pip3 install -r requirements.txt

Now that we have installed all the necessary dependencies, we can configure Odoo. Create a configuration file for Odoo using the following command:

sudo su – root

cd /etc/odoo

sudo nano odoo.conf

Add the following lines to the configuration file:

[options]

; This is the password that allows database operations:

admin_passwd = yourpassword

db_host = False

db_port = False

db_user = odoo

db_password = False

addons_path = /opt/odoo/odoo/addons,/opt/odoo/odoo/custom/addons

Create a systemd unit file

We need to create a systemd unit file to manage the Odoo service. Run the following command to create a new unit file:

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

Add the following lines to the file:

[Unit]

Description=Odoo

After=postgresql.service

[Service]

Type=simple

User=odoo

Group=odoo

ExecStart=/bin/bash -c ‘source /opt/odoo/odoo/venv/odoo/bin/activate && /opt/odoo/odoo/odoo-bin -c /etc/odoo/odoo.conf’

WorkingDirectory=/opt/odoo/odoo

StandardOutput=file:/var/log/odoo/odoo-server.log

StandardError=file:/var/log/odoo/odoo-server.log

[Install]

WantedBy=multi-user.target

Test the Installation

Before we test the installation, we need to make sure that the firewall is not blocking the incoming connections. Run the following command to open the port 8069 for incoming traffic:

sudo firewall-cmd –add-port=8069/tcp –permanent

sudo firewall-cmd –reload

Now start the Odoo service and visit the Odoo web page to test the installation:

sudo systemctl start odoo

sudo systemctl enable odoo

sudo systemctl status odoo

Open your web browser and visit http://your-server-ip:8069 and you should see the Odoo login page.

Enabling SCL and EPEL Repositories

Enabling the SCL and EPEL repositories will enable you to install additional software packages that are not available in the default CentOS repositories. Enabling these repositories is a straightforward process.

To enable the EPEL repository, run the following command:

sudo yum install epel-release

To enable the SCL repository, run the following command:

sudo yum install centos-release-scl

Conclusion

We have covered all the necessary steps to install Odoo 12 on CentOS 7. Odoo is a powerful suite of business applications that can help businesses manage their operations more efficiently.

By following this tutorial, you will be able to install Odoo on your own CentOS 7 server, and take advantage of its features. In order to successfully install Odoo 12 on a CentOS 7 server, you will need to install Python 3.6 and its dependencies, as well as create a new system user for running the Odoo service and installing the PostgreSQL database.

Installing Python 3.6 and Odoo Dependencies

Odoo is written in Python, so it is essential to ensure that the proper version of Python is installed on your server. CentOS 7 typically comes with Python 2.7 installed, which may not be sufficient for running Odoo.

To install Python 3.6 on your server, you can make use of the Software Collections (SCL) repository. This repository contains software collections containing more recent versions of various programming languages and services, including Python 3.6.

To install the Python 3.6 packages, you can use the following command:

sudo yum install centos-release-scl

sudo yum install rh-python36

After installing Python 3.6, you will also need to install the tools required to build Odoo dependencies. These include the GCC compiler, which is used to compile and build Python modules, as well as various libraries and development headers.

You can install these tools by running the following command:

sudo yum install -y git gcc wget nodejs-less libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel

Creating Odoo User and Installing PostgreSQL

Next, you will need to create a new system user and group for running the Odoo service. It is good practice to create a dedicated system user for running each service, as this provides better security and tracking of the service’s activity.

To create the odoo user and group, you can run the following commands:

sudo groupadd -r odoo

sudo useradd -r -g odoo -d /opt/odoo -s /sbin/nologin odoo

This will create the odoo system user with a home directory at /opt/odoo and a shell set to /sbin/nologin. The user is also added to the odoo system group, which will be used to manage access to the Odoo service files.

After creating the system user, you can proceed with installing and configuring the PostgreSQL database, which is used by Odoo to store data. First, you will need to install PostgreSQL using your system’s package manager:

sudo yum install postgresql-server

Once PostgreSQL is installed, you will need to initialize the database cluster and start the PostgreSQL service using the following commands:

sudo postgresql-setup initdb

sudo systemctl enable postgresql

sudo systemctl start postgresql

After initializing the PostgreSQL database cluster, you will also need to create a new PostgreSQL user for the Odoo service to use. You can create a new user for PostgreSQL by running the following commands:

sudo su – postgres

createuser -d -R -S odoo

This will create a new PostgreSQL user named odoo, which has the necessary permissions to access and manipulate the database for the Odoo service.

Conclusion

In this expansion of the Odoo installation guide, we covered in detail the process of installing Python 3.6 and its dependencies, as well as creating a new system user for the Odoo service and installing the PostgreSQL database. By following these steps, you will be able to install Odoo 12 on your CentOS 7 server with the necessary dependencies and configuration in place.

In order to successfully install and configure Odoo 12 on a CentOS 7 server, you will need to download and install Wkhtmltopdf, clone the Odoo 12 source code, create a Python virtual environment, install all required Python modules, create a systemd unit file, and start and enable the Odoo service.

Installing Wkhtmltopdf

Wkhtmltopdf is a tool that is used by Odoo to generate PDF reports. To install Wkhtmltopdf, you can download the recommended version from the Wkhtmltopdf website using the following wget command:

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

After downloading the file, you can install the RPM package using the YUM package manager:

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

This will install Wkhtmltopdf on your CentOS 7 server and ensure that it is properly configured for use by the Odoo service.

Installing and Configuring Odoo 12

With Wkhtmltopdf installed, you can now proceed with installing and configuring Odoo 12 on your CentOS 7 server. First, you will need to clone the Odoo 12 source code from the Odoo GitHub repository using the following command:

sudo git clone https://www.github.com/odoo/odoo –depth 1 –branch 12.0 /opt/odoo/odoo

This will clone the latest version of the Odoo 12 source code to the /opt/odoo/odoo directory on your server.

Next, you will need to enable the software collections repository so that you can access Python 3.6 binaries on your server. You can enable this repository by running the following command:

sudo yum install centos-release-scl

After enabling the repository, you can create a new Python virtual environment for the Odoo installation using the following commands:

sudo pip install virtualenv

sudo su – odoo

virtualenv -p python3 ~/venv/odoo

source ~/venv/odoo/bin/activate

This will create a new virtual environment for the Odoo installation and activate it so that you can easily access the required Python modules. Next, you will need to install all of the required Python modules for the Odoo installation.

You can do this by running the following command:

sudo pip3 install -r /opt/odoo/odoo/requirements.txt

This will install all of the required Python modules for the Odoo installation, ensuring that the application will run smoothly on your CentOS 7 server. Once the required Python modules have been installed, you can create a new directory for the custom addons using the following command:

sudo mkdir /opt/odoo/odoo/custom/addons

This will create a new directory where you can store your custom addons for the Odoo installation.

Next, you will need to create a systemd unit file so that you can manage the Odoo service using systemd. You can create a new systemd unit file using the following command:

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

This will create a new empty file where you can add the necessary configuration details for the Odoo service.

Once you have created the systemd unit file, you can start and enable the Odoo service by executing the following commands:

sudo systemctl start odoo

sudo systemctl enable odoo

This will ensure that the Odoo service starts up automatically whenever your server boots up, providing continuous availability for your business applications. To check the status of the Odoo service, you can use the following command:

sudo systemctl status odoo

This will display the current status of the Odoo service, including any error messages or warning messages that may be encountered during startup. If you want to see the messages logged by the Odoo service, you can use the following command:

sudo journalctl -u odoo -f

This will display the live stream of messages logged by the Odoo service, allowing you to monitor its performance in real-time.

Conclusion

In this expanded guide to installing and configuring Odoo 12 on a CentOS 7 server, we covered the process of downloading and installing Wkhtmltopdf, cloning the Odoo 12 source code, creating a Python virtual environment, installing the required Python modules, creating a directory for custom addons, creating a systemd unit file, starting and enabling the Odoo service, and checking the status and messages of the service. By following these detailed steps, you can ensure that your Odoo installation is properly configured and optimized for efficient business operations.

Testing the Installation

Once you have completed the installation of Odoo 12 on CentOS 7, it is important to test the installation to ensure that everything is working properly. If you are unable to access the Odoo page, it is likely that your firewall is blocking port 8069, which is the default port used by Odoo.

To check if your firewall is blocking port 8069, you can use the following command:

sudo firewall-cmd –list-ports

This will display a list of ports that are allowed by your firewall. If you do not see port 8069 in the list, then you will need to open the port to allow incoming connections to the Odoo service.

To open port 8069, you can use the following command:

sudo firewall-cmd –add-port=8069/tcp –permanent

sudo firewall-cmd –reload

This will add a permanent rule to your firewall configuration to allow incoming TCP connections on port 8069. The –reload option is used to apply the changes immediately.

Now that the port has been opened, you should be able to access the Odoo page using your web browser. Simply enter the URL http://your-server-ip:8069, replacing “your-server-ip” with the actual IP address of your server.

If you are still unable to access the Odoo page, it is possible that there may be other issues with your installation or configuration. In such cases, it is recommended to review the previous steps and ensure that all the necessary dependencies have been installed correctly.

Conclusion

In summary, we have covered the detailed process of installing Odoo 12 on a CentOS 7 server. Starting with the installation of Python 3.6 and its dependencies using the Software Collections (SCL) repository, we then created a new system user and group for running the Odoo service.

We also installed and configured PostgreSQL as the database backend for Odoo. To ensure that Odoo can generate PDF reports, we installed Wkhtmltopdf and verified the installation.

We then proceeded to install and configure Odoo 12 by cloning the source code from the Odoo GitHub repository, creating a Python virtual environment, and installing all required Python modules. Additionally, we created a directory for custom addons and set up a systemd unit file to manage the Odoo service.

Finally, we tested the installation by checking access to the Odoo web page and made sure that any potential firewall issues were resolved. By following these detailed steps, you can successfully set up Odoo 12 on CentOS 7 and leverage its powerful suite of business applications for efficient operations within your organization.

In this comprehensive guide, we have explored the step-by-step process of installing Odoo 12 on a CentOS 7 server. From installing Python 3.6 and its dependencies to setting up PostgreSQL and configuring Wkhtmltopdf, we covered all the necessary prerequisites for a successful installation.

We then delved into installing and configuring Odoo 12 itself, creating a Python virtual environment, and setting up a systemd unit file. Testing the installation and resolving firewall issues were important final steps.

By following this guide, you can confidently install and configure Odoo 12 on CentOS 7, harnessing its powerful suite of business applications to optimize your organization’s operations. Make the most of this open-source alternative to popular commercial software, and unlock the potential for enhanced efficiency and productivity in your business.

Popular Posts