How to install Odoo 14 in a iocage jail

Koalitech

Cadet
Joined
Oct 5, 2020
Messages
3
Hello to all the community. First of all, this is my first post in these forums and knowing it will not be perfect, I humbly ask for some patience and understanding. Said that...

This post is based and mixed from this other post (https://www.ixsystems.com/community/threads/install-odoo-iocage-jail-business-management.63671/), and the Linux installation manual of Odoo itself, with some adaptations of my own. I'll try to write it simply and concise.

Odoo is a business management software. An ERP + CRM + some other tools to make your daily company management less of a hassle. It can do a lot of things (e-commerce, Point-Of-Sale interface and use, accountabilty, bills (sales and purchases), website design,...). Also it's modular, so you don't have to mess with every tool every time, you just enable those modules you want and done.

This guide will help you get a running instance of the source code, not a compiled and installed software. Odoo themselves explain this:

"The source “installation” is really about not installing Odoo, and running it directly from source instead.

This can be more convenient for module developers as the Odoo source is more easily accessible than using packaged installation (for information or to build this documentation and have it available offline)."


This guide is not a production ready stronghold, but a starting point. Some parts will be faulty, but overall functionality is working. I have not found any issues so far, but LDAP may be faulty, I haven't tested that yet. That said, grab a snack and lets get cracking:

Installing Odoo 14 in FreeNAS 12.0-RC1 / TrueNAS Core 12.0-RC1:

Create the iocage jail:


In order for it to be user friendly and easy, I've done that with FreeNAS/TrueNAS Core web interface.
-> Select "Add" from the Jails menu and set:

Name and FreeBSD Release
--> Jail Name : <whatever_makes_you_feel_good>
--> Jail Type : Basejail (I've selected that to be a bit more safe when the upgrades come)
--> Release : 12.1 *

* note : it is REQUIRED to have Internet access to fetch the release, somehow I've not noticed this detail explained anywhere where I've look so far.

Networking
--> VNET: Selected.
--> IPv4 Interface: vnet0
--> IPv4 Address: <whichever_is_on_your_network_segment>
--> IPv4 Netmask: 24 (Although it could differ based on your network settings)
--> IPv4 Default Router: <your_gateway>

Confirm and Submit.
That should get you a useful and ready to work jail.


Getting a clone of the Git repo:

On the Linux installation manual of Odoo, it says you should be installing it on /opt, although that folder is not existent on FreeBSD's jails. And since you can install it anywhere anyway...

Code:
 mkdir odoo14
 cd odoo14


To make a folder in which clone the source code and run it. And since git is not installed by default:

Code:
 pkg install git 


Then let's clone the contents of the git repo:

Code:
 git clone https://github.com/odoo/odoo.git 


This will get us a clone of the latest code there is on the platform, which, at the date of publishing this guide, is Odoo14, we can switch branches later if we want and older version with git swich command.


Installing software dependencies:

Next we will need to install all dependencies required to run the code (although as said before, there is something missing related to LDAP authentication):

Code:
 pkg install nano python37 libxslt curl bash wget libsass libxml2 py37-pip py37-pillow npm node gcc wkhtmltopdf py37-ldap postgresql12-client-12.3 postgresql12-server-12.3  



Getting the DB up and running:

Next we ready the database engine and change its configuration to listen to all IPs. You can change that * to whichever IP your Odoo instance is if you have a DB server on another machine you're willing to use for this.

Code:
sysrc postgresql_enable="YES"

service postgresql initdb
service postgresql start

nano /var/db/postgres/data12/postgresql.conf     # Now we need to find the line with "listen_addresses", uncomment and change to listen_addresses = '*'

service postgresql restart

su postgres -c "createuser root";
su postgres -c createdb odoo -O root"; 


I've tried to change those names (root and odoo), but somehow those are referenced on the executable and won't work without them. Maybe later I will dive deeper on that detail to find why is that.[/CODE]

If everything is right your db server should be up and running by this point.


More software dependices (Python edition):

Next we'll install all python dependencies:

Code:
 pip install pypdf2 werkzeug reportlab
pip install -r requirements.txt 


Now let's create the user and db for odoo to work on:


Running the Odoo source instance:


And finally, if there hasn't been any error beyond that LDAP known issue, with

Code:
 python3.7 odoo-bin --addons-path=addons -d odoo -i base 


we should have our Odoo 14 instance getting ready to launch and use. Note that the last "-i base" is only there for the first start, since it needs to ready the database structure itself. Subsequent starts should only need to be:

Code:
 python3.7 odoo-bin --addons-path=addons -d odoo -i base 


Our instance of Odoo 14 should be up and running in the designated IP we gave to our jail, on port 8069 by default, but this can be changed later on Odoo Settings.
Also, unlike the instances where we use compiled code, there is an admin (or root) user already created and set up. You can access with:

email / user : admin
password : admin


PS: Sorry if there is some grammar / syntax mess, English is not my mother tongue. If anyone know where it is recommended to post this in Spanish, I could do that too.
 
Top