websnail.net

Well-Known Member
Mar 24, 2002
45
4
308
As this has cropped up a couple of times with little in the way of concrete information I figured I'd share my roller coaster ride with this. We have Cloudlinux on our Cpanel server but that shouldn't detract from the process too much.

Intentions:
- Install Odoo 14.0 community edition on Cpanel/Cloudlinux Centos 6

First up.. RPM/Yum installation of odoo showed a myriad of dependencies that aren't supported by the repos I have setup and (showing my ignorance here) I'm not convinced I want to use a different repos if it may compromise my setup so I abandoned this.

So we move to install using WSGI which has so far gone as follows:
  1. Cloudlinux doesn't have Python selector enabled by default (or at least mine didn't) so:
    1. WHM > LVE Manager
    2. Enable Python and install the 3.8.1 (alt) version of Python
      .
  2. Make sure the Cpanel feature manager has Python selector enabled
    .
  3. Create your postgresql database and user that you intend to use with odoo and assign the user to that database.
    .
  4. Odoo requires access to a number of executables (which CageFS will block)so you will need to:
    1. cat /etc/cagefs/custom.proxy.commands
    2. Add the following lines:
    3. Code:
      PG_CONFIG=/opt/alt/postgresql11/usr/bin/pg_config
      DEVTOOLS7_GCC=/opt/rh/devtoolset-7/root/usr/bin/gcc
      DEVTOOLS7_GPP=/opt/rh/devtoolset-7/root/usr/bin/g++
      .
    4. Save the edited file
      Ref: Enable cpapi2 in CageFS
      .
  5. Enable compiler access:
    1. WHM > Compiler access
    2. Enable compiler access
      .
  6. In shell:
    1. yum install devtoolset-7-gcc*
    2. cagefsctl --force-update
    3. cagefsctl -M
    4. sudo -su foo (into your account shell)
    5. copy the source link for your python app virtual environment
    6. paste the source link into shell and run
    7. git clone odoo/odoo --depth 1 --branch 14.0 ./odoo
    8. pip3 install -r [path/]requirements.txt
      .
      At this point you should have managed to install the various prerequisites to get odoo to install...
  7. So, on to installing odoo itself... In shell:
    1. cd [path/]
    2. pip3 install ./
      .
  8. With the db and user login for your postgresql db you now initialise the odoo database
    1. python odoo-bin --init --addons-path=addons --db_host=localhost --db_user=DBUSER --db_password="DBPASS" -d DBNAME --stop-after-init

Updated: And this is where we hit a brick wall.. Odoo version 14.x requires postgreSQL version 10 or above and Cpanel doesn't support anything higher than that supported by the OS which for my Centos 6 is 8.4.20 so we're hitting a new issue.

It's likely that installing the newer version will need to be unsupported and difficult but this thread seems to offer hope:

Until another day...


The main headaches/hurdles are getting the required libs and functionality in place before Odoo can be installed but once we've resolved that this guide:
... should provide the final touches.

I'll update once I have more.
 
Last edited:

websnail.net

Well-Known Member
Mar 24, 2002
45
4
308
Ok... so, installing the new PostgreSQL version to version 10 or above is doable but tbh I'm not entirely sure how I managed it (with version 12).
This is a rough recollection of events:

I combined most of the information provided in this post:
... with an edit of the
/usr/local/cpanel/scripts/installpostgres
...script

Specifically I edited the lines:

Code:
    my @cent_pkgs = ( "postgresql",    "postgresql-devel",    "postgresql-libs",    "postgresql-server" );
.. and replaced it with..
Code:
#    my @cent_pkgs = ( "postgresql",    "postgresql-devel",    "postgresql-libs",    "postgresql-server" );
    my @cent_pkgs = ( "postgresql12", "postgresql12-devel", "postgresql12-libs", "postgresql12-server" );
I then (I think) ran the script and it installed postgresql12 successfully even though it wasn't reporting success.

My guess is that the process restored the pg_hba.conf default that WHM requires to monitor the postresql server.

Whether it's required or not I'm unsure but I then ran:
  • cagefsctl --force-update
  • cagefsctl -M
Most of the links mentioned in the how-to-upgrade-postgresql-9-2-to-postgresql-9-6 post had to be repeated a few times so I'm not 100% sure when it should be done but I do know I tried multiple times (remember to update the "10" refs to your postgresql version though).

I remember needing to mv /var/lib/pgsql/data directory to /var/lib/pgsql/data-bak (with the postgresql service stopped) so that the ln -sfn 10/data; command would work
Should note that our databases were empty so likely you won't want to be doing this or will need to carry out additional steps.

Now the remaining problem appears to be that psycopg2 is trying to connect via: /var/run/postgresql/.s.PGSQL.5432 instead of /tmp/.s.PGSQL.5432 but that appers to be resolvable as per:

Apologies for the lack of proper record for this but literally 12 hours working through this issue left me a bit tired so I was a bit remiss. Hopefully there's enough there to help though.
 
  • Like
Reactions: cPRex

websnail.net

Well-Known Member
Mar 24, 2002
45
4
308
Final few clues on fixing the connection to postgreSQL.
ref: Can't connect the postgreSQL with psycopg2

Set unix_socket_directories in postgresql.conf to /var/run/postgresql, /tmp, and restart PostgreSQL.
... to ensure that there's a socket connection for psycopg2 to connect to.

Edit: /var/lib/pgsql.12/data/pg_hba.conf
Add:
Code:
local   all             all                                     md5
This will allow your database user to connect to the database.

Edit: /etc/cagefs/cagefs.mp
Add:
Code:
/var/run/postgresql

Also need to correct step 4 in the OP.

Edit: /etc/cagefs/custom.proxy.commands
Code:
PG_CONFIG=/usr/bin/pg_config
DEVTOOLS7_GCC=/opt/rh/devtoolset-7/root/usr/bin/gcc
DEVTOOLS7_GPP=/opt/rh/devtoolset-7/root/usr/bin/g++
Still not got the app to actually work! but most of the technical hurdles are resolved.