Introduction
Odoo is an open source ERP and CRM platform that is used by businesses of all sizes. It is a powerful and versatile tool that can help you manage your business operations more efficiently. Installing Odoo on Ubuntu is a relatively straightforward process, and this guide will walk you through the steps. With a few simple commands, you can have Odoo up and running in no time.
How to Install Odoo on Ubuntu
1. Install the necessary dependencies:
sudo apt-get install python-pip python-dev libxml2-dev libxslt1-dev libevent-dev libsasl2-dev libldap2-dev libpq-dev libpng-dev libjpeg-dev
2. Install PostgreSQL:
sudo apt-get install postgresql
3. Create a PostgreSQL user for Odoo:
sudo -u postgres createuser –createdb –username postgres –no-createrole –no-superuser –pwprompt odoo
4. Install the Odoo package:
sudo pip install odoo
5. Create a configuration file for Odoo:
sudo nano /etc/odoo-server.conf
6. Add the following lines to the configuration file:
[options]
admin_passwd = your_password
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /usr/local/lib/python2.7/dist-packages/odoo/addons
7. Create a new system user for Odoo:
sudo adduser –system –home=/opt/odoo –group odoo
8. Create a log file for Odoo:
sudo touch /var/log/odoo/odoo-server.log
sudo chown odoo: /var/log/odoo/odoo-server.log
9. Create a startup script for Odoo:
sudo nano /etc/init.d/odoo-server
10. Add the following lines to the startup script:
#!/bin/sh
### BEGIN INIT INFO
# Provides: odoo-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Odoo
# Description: Odoo Open Source ERP and CRM
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
DAEMON=/usr/local/bin/odoo-bin
NAME=odoo-server
DESC=odoo-server
# Specify the user name (Default: odoo).
USER=odoo
# Specify an alternate config file (Default: /etc/odoo-server.conf).
CONFIGFILE=”/etc/odoo-server.conf”
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon.
DAEMON_OPTS=”-c $CONFIGFILE”
[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}
case “${1}” in
start)
echo -n “Starting ${DESC}: ”
start-stop-daemon –start –quiet –pidfile ${PIDFILE} \
–chuid ${USER} –background –make-pidfile \
–exec ${DAEMON} — ${DAEMON_OPTS}
echo “${NAME}.”
;;
stop)
echo -n “Stopping ${DESC}: ”
start-stop-daemon –stop –quiet –pidfile ${PIDFILE} \
–oknodo
echo “${NAME}.”
;;
restart|force-reload)
echo -n “Restarting ${DESC}: ”
start-stop-daemon –stop –quiet –pidfile ${PIDFILE} \
–oknodo
sleep 1
start-stop-daemon –start –quiet –pidfile ${PIDFILE} \
–chuid ${USER} –background –make-pidfile \
–exec ${DAEMON} — ${DAEMON_OPTS}
echo “${NAME}.”
;;
*)
N=/etc/init.d/${NAME}
echo “Usage: ${NAME} {start|stop|restart|force-reload}” >&2
exit 1
;;
esac
exit 0
11. Make the startup script executable:
sudo chmod 755 /etc/init.d/odoo-server
12. Update the system startup links:
sudo update-rc.d odoo-server defaults
13. Start the Odoo service:
sudo service odoo-server start
14. Access the Odoo web interface:
http://your_server_ip:8069
Introduction
Odoo is a web-based suite of open source business management applications. The platform includes various business solutions, such as CRM, warehouse management, accounting, billing, website builder, etc.
Odoo Community edition is available for Ubuntu for free, but you can switch to the Enterprise edition as needed.
This tutorial provides steps on installing Odoo 15 on Ubuntu 20.04 in a Python virtual environment.
Prerequisites
Install Odoo on Ubuntu
After meeting all the prerequisites, follow the steps below to install Odoo 15 on Ubuntu in a Python virtual environment.
Installing Odoo in a virtual environment creates an isolated system and allows testing of different versions on the same machine.
Step 1: Update Repository
Open the terminal and update the apt repository:
sudo apt update
Wait for the update to finish before proceeding to the next step.
Step 2: Install Odoo Dependencies
Install Odoo dependencies with the following command:
sudo apt install -y build-essential wget python3-dev python3-venv python3-wheel libfreetype6-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev libxslt1-dev libldap2-dev libtiff5-dev libjpeg8-dev libopenjp2-7-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev
Make sure there are no typos to avoid missing packages.
The installation fetches all additional dependencies necessary for Odoo installation.
Step 3: Create Odoo User
Running Odoo as a root user poses a security risk. Create a new system user, group, and home directory named Odoo:
sudo useradd -m -d /opt/odoo -U -r -s /bin/bash odoo
The username can be different if it matches the PostgreSQL user and the configuration file information.
Step 4: Install and Configure PostgreSQL
Odoo uses PostgreSQL as the database. Install PostgreSQL from the official Ubuntu repositories with:
sudo apt install postgresql
Press Y when prompted to continue. Once the installation finishes, create a Postgres user with the same name from the previous step:
sudo su - postgres -c "createuser -s odoo"
The command creates a user named odoo to manage the database.
Step 5: Install wkhtmltopdf
The wkhtmltopdf set of open source tools helps render HTML pages into PDFs and images for generating reports in various formats.
To download the installer, run:
sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
The command fetches the Debian package. To install the package, run:
sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb
Press Y when asked to continue the installation. Wait for the process to complete before continuing.
Step 6: Install and Configure Odoo
To install Odoo, follow the steps below:
1. Switch to the odoo user with the sudo su command:
sudo su - odoo
2. Clone the Odoo 15 source code from the Git repository:
git clone https://www.github.com/odoo/odoo --depth 1 --branch 15.0 /opt/odoo15/odoo
4. Navigate to the odoo directory and create a Python virtual environment for Odoo:
cd /opt/odoo
python3 -m venv odoo-venv
5. Activate the environment with:
source odoo-venv/bin/activate
The environment name shows in the terminal before the user.
5. Install the following requirements for Odoo:
pip3 install wheel
pip3 install -r odoo/requirements.txt
Wait for the installation to complete.
6. After this, Odoo requires additional setup and configuration. Deactivate the environment with:
deactivate
7. Create a separate directory for custom addons:
mkdir /opt/odoo/odoo-custom-addons
This directory defines where Odoo searches for modules.
8. Switch back to the sudo user with:
exit
9. Create the odoo.conf file using the nano text editor:
sudo nano /etc/odoo.conf
Paste the following contents into the odoo.conf file:
[options]
; Database operations password:
admin_passwd = PASSWORD
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /opt/odoo/odoo/addons,/opt/odoo/odoo-custom-addons
Change the admin_password
field to a secure password for the database. The addons_path
field contains the paths to Odoo module locations. Save and close the file.
10. Create the odoo.service file with:
sudo nano /etc/systemd/system/odoo.service
Paste the following contents into the file:
[Unit]
Description=Odoo
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo
PermissionsStartOnly=true
User=odoo
Group=odoo
ExecStart=/opt/odoo/odoo-venv/bin/python3 /opt/odoo/odoo/odoo-bin -c /etc/odoo.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
The service connects to Odoo through the Python virtual environment and uses the configuration file from the previous step. Save the changes and close the file.
11. Update the service list:
sudo systemctl daemon-reload
The Odoo service is now available.
Step 7: Start and Test Odoo
To start and test Odoo, do the following:
1. Enable the Odoo service on system startup:
sudo systemctl enable --now odoo
2. Check the service status with:
sudo systemctl status odoo
The status shows as active (running)
.
3. The journalctl file contains all the information about the running service:
sudo journalctl -u odoo
Use this file to check for any potential errors.
4. Lastly, access Odoo from the browser on localhost port 8069:
http://localhost:8069
The page shows the Odoo initial setup. Use the admin_password
from the /etc/odoo.conf file as the master password.
Step 8: Enable Multiprocessing (Optional)
Odoo works in multithreading mode by default. Change the server to the multiprocessing mode before deployment to better use system resources and ensure stability.
The number of CPUs helps approximate the number of workers:
- Maximum workers = (CPUs * 2) + 1. For 4 CPUs, the system would have a maximum of 9 workers.
- One worker serves around six concurrent users theoretically. For 24 simultaneous users, the system requires at least four workers.
- A cron worker requires one CPU.
Therefore, a system with 4 CPUs and 24 concurrent users needs at least six workers, plus an additional cron worker.
The number of workers and RAM distribution determine the total RAM Odoo needs:
- Total RAM = Workers * ((Light worker ratio * Light worker RAM) + (Heavy worker ratio * Heavy worker RAM))
If there are around 80% light workers that use 100GB RAM and 20% heavy workers that use 1GB RAM, the calculation is:
Total RAM = 7 * ((100*0.8)+(1024*0.2)) = 1993.6
Odoo requires a total of 2GB RAM. Add the information to the /etc/odoo.conf file:
[options]
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200
max_cron_threads = 1
workers = 6
To apply the changes, restart the Odoo service:
sudo systemctl restart odoo
The remaining system resources are available for the PostgreSQL database and any other services running on the system.
Step 9: Change Port Number (Optional)
By default, Odoo listens on port 8069. Changing the default port number is a good security practice.
Add the following lines to the /etc/odoo.conf file to have Odoo listen only on 127.0.0.1 port 1111:
xmlrpc_interface = 127.0.0.1
netrpc_interface = 127.0.0.1
xmlrpc_port = 1111
Restart the Odoo service to apply the changes:
sudo systemctl restart odoo
The changes apply immediately.
Conclusion
After following the steps in this guide, you should have Odoo 15 on installed Ubuntu. The system is in a Python virtual environment, making it easy to test multiple versions before deploying.
How to Install Odoo on Ubuntu
Odoo is an open-source suite of business applications that includes modules for project management, billing, accounting, inventory management, and more. It is a powerful and versatile platform that can be used to manage a variety of business processes. Installing Odoo on Ubuntu is a straightforward process that can be completed in just a few steps.
Prerequisites
Before you can install Odoo on Ubuntu, you will need to make sure that your system meets the following requirements:
- Ubuntu 16.04 or higher
- Python 3.5 or higher
- PostgreSQL 9.5 or higher
Step 1: Install PostgreSQL
The first step in installing Odoo on Ubuntu is to install PostgreSQL. PostgreSQL is an open-source object-relational database system that is used by Odoo. To install PostgreSQL, open a terminal window and enter the following command:
sudo apt-get install postgresql
Once the installation is complete, you will need to create a PostgreSQL user for Odoo. To do this, enter the following command:
sudo -u postgres createuser --createdb --username postgres --no-createrole --pwprompt odoo
You will be prompted to enter a password for the odoo user. Make sure to choose a secure password and remember it for later.
Step 2: Install Odoo
Now that PostgreSQL is installed, you can install Odoo. To do this, enter the following command:
sudo apt-get install odoo
Once the installation is complete, you will need to configure Odoo. To do this, open the Odoo configuration file with a text editor:
sudo nano /etc/odoo/odoo.conf
In the configuration file, you will need to set the database user and password. To do this, add the following lines to the file:
db_user = odoo
db_password = your_password
Be sure to replace “your_password” with the password you chose for the odoo user in Step 1.
Step 3: Start the Odoo Service
Once the configuration is complete, you can start the Odoo service. To do this, enter the following command:
sudo service odoo start
Once the service is started, you can access the Odoo web interface by opening a web browser and navigating to http://localhost:8069.
Conclusion
Installing Odoo on Ubuntu is a straightforward process that can be completed in just a few steps. With Odoo installed, you can begin managing your business processes with ease.