Effortlessly Installing Odoo 12 on Ubuntu 22.04: A Step-by-Step Guide
Introduction
Odoo is a powerful, open-source business management software suite that offers a wide range of applications for various business needs, including CRM, accounting, inventory management, and more. Installing Odoo 12 on Ubuntu 22.04 can be a straightforward process if you follow the right steps. In this step-by-step guide, we’ll walk you through the process of installing Odoo 12 on Ubuntu 22.04, ensuring a hassle-free experience.
Before You Begin:
Before diving into the installation process, it’s important to ensure that you have the following prerequisites in place:
1. Ubuntu 22.04: Make sure you have a clean installation of Ubuntu 22.04 LTS on your server or virtual machine.
2. Root Access or Sudo Privileges: You should have root access or sudo privileges to execute commands with administrative rights.
3.Updated System: Ensure your Ubuntu system is up-to-date by running the following commands:
sudo apt update
sudo apt upgrade
Step 1: Install PostgreSQL Database Server
Odoo requires a PostgreSQL database to store its data. To install PostgreSQL, run the following command:
sudo apt install postgresql
Once installed, you need to create a PostgreSQL user and database for Odoo:
sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo12
createdb --username postgres --owner odoo12 --encoding unicode_collation=en_US.utf8 --template=template0 odoo12
exit
Step 2: Install Required Dependencies
Odoo has several Python dependencies that need to be installed. You can use the following command to install them:
sudo apt install python3-pip python3-dev libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev libjpeg8-dev liblcms2-dev libblas-dev libatlas-base-dev libopenjp2-7 libtiff5-dev libjpeg62-dev libjpeg-dev libopenjp2-7 libtiff5-dev libjpeg62-dev libfreetype6-dev liblcms2-dev libblas-dev libatlas-base-dev libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev libjpeg8-dev liblcms2-dev libblas-dev libatlas-base-dev libopenjp2-7 libtiff5-dev libjpeg62-dev libjpeg-dev libopenjp2-7 libtiff5-dev libjpeg62-dev libfreetype6-dev liblcms2-dev libblas-dev libatlas-base-dev libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev
Step 3: Install and Configure Wkhtmltopdf
Wkhtmltopdf is a tool that Odoo uses to generate PDF reports. You can install it with the following commands:
sudo apt install wkhtmltopdf
sudo apt install -y fontconfig
Step 4: Create a System User for Odoo
It is a good practice to create a system user for Odoo to enhance security. Run the following commands to create a system user named ‘odoo’:
sudo adduser --system --home=/opt/odoo --group odoo
Step 5: Install and Configure Odoo
Now, let’s proceed with installing Odoo 12. You can use pip3 to install Odoo:
sudo pip3 install -U setuptools
sudo pip3 install odoo
Next, you’ll need to create a configuration file for Odoo. Create a new file at `/etc/odoo.conf` and open it for editing:
sudo nano /etc/odoo.conf
Inside this file, add the following configuration (you can customize it as needed):
[options]
; This is the password that allows database operations:
admin_passwd = your_admin_password
db_host = False
db_port = False
db_user = odoo12
db_password = False
logfile = /var/log/odoo/odoo.log
addons_path = /opt/odoo/addons
Replace `your_admin_password` with a strong password for the Odoo admin user. Save and close the file.
Step 6: Set Up Odoo as a System Service
To run Odoo as a system service, you’ll need to create a systemd service unit file. Create a new file at `/etc/systemd/system/odoo.service` and open it for editing:
sudo nano /etc/systemd/system/odoo.service
Inside this file, add the following content:
[Unit]
Description=Odoo
Documentation=http://www.odoo.com
[Service]
# Ubuntu/Debian convention:
Type=simple
User=odoo
ExecStart=/usr/local/bin/odoo -c /etc/odoo.conf
[Install]
WantedBy=default.target
Save and close the file.
Step 7: Create Log Directory and Set Permissions
Create a log directory for Odoo and set the appropriate permissions:
sudo mkdir /var/log/odoo
sudo chown odoo:root /var/log/odoo
Step 8: Start and Enable Odoo Service
Start the Odoo service and enable it to start at boot:
sudo systemctl start odoo
sudo systemctl enable odoo
Step 9: Access Odoo in Your Web Browser
Once Odoo is up and running, open your web browser and enter your server’s IP address or domain name followed by port 8069 (the default Odoo port). For example:
http://your_server_ip:8069
You should see the Odoo login page. Log in with the admin user and the password you set in the configuration file.
Conclusion:
Congratulations! You have successfully installed Odoo 12 on Ubuntu 22.04. You can now start configuring Odoo to meet your specific business needs and explore its wide range of features and modules. Odoo is a versatile and powerful platform that can help streamline your business operations, so take the time to explore its capabilities and make the most of this installation.