Odoo 8 was released in September 2014 and reached its end of life on October 5, 2017 (when Odoo 9 was released). It requires out-dated Python 2.7 which is not available on Ubuntu 22.04. However, there are still some reasons for us to install Odoo 8 on Ubuntu 22.04:
- You don’t have an earlier version of Ubuntu that supports Python 2.7 and other libraries that Odoo 8 requires.
- Migration to another later Odoo version
- and others (please advise me yours by leaving comment)
In this tutorial, we expect results as follow:
- Odoo 8’s source code locates at /opt/odoo/odoo8
- It run under a unix account named odoo8 belong to the group named odoo
- It can connect to local PostgreSQL under the role named odoo8 that can NOT create databases. An empty database must be created before and authorized for the odoo8 account.
Now, I will guide you through 6 steps to achieve that:
- Create Linux/Unix user account and group to run Odoo 8
- Install Python 2.7
- Download Odoo 8 source code from GitHub
- Install python packages and libraries that Odoo 8 requires
- Install PostgreSQL 9.6
- Run the Odoo 8 and create the first instance
Step1 – Create Odoo running user account
For security, we should install and run Odoo 8 under a separate Linux user that has the following specifications:
- The user account will not be able to login for security purpose
- The user account should be a system account under which daemons and other automatic processes run.
- A dedicated home directory for storing data and custom Odoo addons. It’s a good practice to make it under the /home/ directory
Run the following command to create the group odoo:
sudo addgroup odoo
Run the following command to create the user account odoo8 and add to the group odoo:
sudo adduser odoo8 --system \ --home=/home/odoo8 --disabled-login \ --disabled-password --ingroup odoo
Step 2 – Install Python 2.7
Although Python 2.7 was dropped since Ubuntu 20.04, we can still install it by following my tutorial on how to install Python 2.7 on Ubuntu 22.04.
After that, please create a virtual environment for Odoo 8 so that we can isolate it from others to not break existing things. Please make sure you’ve installed virtualenv for Python 2.7.
Create parent folders for Odoo 8’s virtual environment
sudo mkdir -p /python-venv/2.7/odoo8
Grant the group odoo and account odoo8:
sudo chown -hR odoo8: /python-venv/2.7/odoo8
Switch to odoo8’s bash
sudo su - odoo8 -s /bin/bash
Create a virtual environment and name it odoo8
Now, exit odoo8 to get back to the previous user account.
Step 3 – Download Odoo 8 source code from GitHub
I assume that we will store Odoo source code in /opt/odoo so that we could have Odoo 8 source code in /opt/odoo/odoo8 and (in the future) Odoo9 source code in /opt/odoo/odoo9, etc.
Create directory odoo inside the /opt
sudo mkdir /opt/odoo
Grant access rights for the group odoo
sudo chown root:odoo /opt/odoo
To download the source code of Odoo 8, just run the command:
git clone -b 8.0 https://github.com/odoo/odoo.git /opt/odoo/odoo8
If you prefer to download it over SSH for performance and security, you may follow my tutorial on how to clone github repo over SSH on Ubuntu 22.04. Then, the command to download Odoo 8 will be:
git clone -b 8.0 email@example.com:odoo/odoo.git /opt/odoo/odoo8
Depending on your internet connection speed, the process may take a few minutes or more. Please be patient!
After the process is completed, you will find the Odoo 8 source code in the directory
Now we need to take an action to secure the source code:
sudo chown -hR root:odoo /opt/odoo/odoo8
Step 4 – Install Odoo 8’s required packages and libraries
You can run the command below to install packages that are required for later Python library installation
sudo apt install build-essential python-setuptools \ python2-dev libpq-dev libxml2-dev libxslt1-dev \ zlib1g-dev libsasl2-dev libldap2-dev libssl-dev \ libjpeg-dev
Odoo generates PDF from HTML, that’s why we need the wkhtmltopdf.
sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb # force install dependencies sudo apt -f install
Install Python Libraries
Firstly, we need to activate the Odoo8 virtual environment that we’ve created above by executing the command
# enter odoo8's bash sudo su - odoo8 -s /bin/bash # activate the virtual env odoo8 source /python-venv/2.7/odoo8/bin/activate
After activate, you will find (odoo8) as the prefix of your command promt. Then you can start install Odoo 8’s required packages and libraries using pip command as below
pip install -r /opt/odoo/odoo8/requirements.txt
Please note that the version of the library psycopg2 specified in the above requirements.txt is 2.7.1 which is not compatible with the Ubuntu 22.04’s glib. We need to upgrade the psycopg2 to the version 184.108.40.206 using the command below:
pip install psycopg2==220.127.116.11
Now, try to run the following command:
You can expect to see the result as follow
If no error appears, congrats! Now you can hit Ctrl+C twite to stop Odoo 8. After that, you can exit the virtual enviroment by running the command:
Now, exit the odoo8 account
Step 5 – Install PostgreSQL 9.6
PostgreSQL 9.6 is an end-of-life version of PostgreSQL. It is not available in Ubuntu 22.04 and even the apt does not know it. In order to install it, you should follow my tutorial on how to install multiple PostgreSQL version.
After installing PostgreSQL 9.6, please create a role named odoo8 for the Odoo 8 to access the database using ident method.
sudo -u postgres createuser --interactive -p 5433
When being asked for role name, please input odoo8 then hit Enter.
When being asked for superuser access rights, input n for No as we assume we are on a production server. Or y for Yes if you are on your development environment.
If you select n, you will be asked for access rights to create roles and database. Depending on your requirements, the answers may varies. You may select n for all if you are installing Odoo 8 on a production server.
Here is what I’ve done
Now, we create a new database odoo8 and grant odoo8 role as the owner of the database odoo8
sudo -u postgres createdb -p 5433 --owner=odoo8
Step 6 – Run Odoo 8 and initialize the database
Switch to the odoo8 account
sudo su - odoo8 -s /bin/bash
Now, run the following command to start Odoo 8 and initialize the database odoo8 created in that last step to install Odoo 8 for the first time.
/opt/odoo/odoo8/odoo.py -u odoo8 -d odoo8 --db_port=5433
Wait for a few minutes for the database initilization to complete and open your preferred web browser and enter the address as below:
- your_ip is the ip of your machine
- 8069 is the Odoo’s default port. You can run your Odoo on another port by adding the option –xmlrpcs-port. For example: –xmlrpcs-port=9089 to access your Odoo instance with http://your_ip:9089.
What if you want to run Odoo 8 with later versions of PostgreSQL?
My Viindoo team made some modifications to our fork of Odoo to support later versions of PostgreSQL (i.e. we have tested with PostgreSQL 10 and PostgreSQL 12). Instead of cloning Odoo’s GitHub, doing Viindoo’s one:
git clone -b 8.0 https://github.com/Viindoo/odoo.git /opt/odoo/viidoo8
By the way, you may want to check out other posts of mine for:
- How to install Odoo 9 on Ubuntu 22.04 Server;
- How to install Odoo 10 on Ubuntu 22.04 Server;
- How to install Odoo 11 on Ubuntu 22.04 Server;
- How to install Odoo 12 on Ubuntu 22.04 Server;
- How to install Odoo 13 on Ubuntu 22.04 Server;
- How to install Odoo 14 on Ubuntu 22.04 Server;
- How to install Odoo 15 on Ubuntu 22.04 Server;
- How to install Odoo 16 on Ubuntu 22.04 Server;
If you are an Odoo developer you may want to check out my posts: