RChadwick's picture

UPDATE: TurnKey Odoo has been released

After lots of research, I thought that Odoo ERP would be a perfect fit for my needs. However, figuring out how to install it on TKL was a real pain. So, I'm hoping to save someone else the same pain.

Disclaimer: I am NOT a Linux Guru. This might not be perfect, or even right, but I found it works for me.

 

root @ server: ~ # apt-get install postgresql

root @ server: ~ # cd ..

root @ server: ~ # su postgres

postgres @ server: ~ $ psql -U postgres

psql (9.0.3)

Type "help" for help.

postgres = # update pg_database set datallowconn = TRUE where datname = 'template0';

UPDATE 1

postgres = # \c template0

You are now connected to database "template0".

template0 = # update pg_database set datistemplate = FALSE where datname = 'template1';

UPDATE 1

template0 = # drop database template1;

DROP DATABASE

template0 = # create database template1 with template = template0 encoding = 'UTF8';

CREATE DATABASE

template0 = # update pg_database set datistemplate = TRUE where datname = 'template1';

UPDATE 1

template0 = # \c template1

You are now connected to database "template1".

template1 = # update pg_database set datallowconn = FALSE where datname = 'template0';

UPDATE 1

Ctrl + Z

postgres @ server: ~ $ exit    (Repeat if it doesn't exit)

root @ server: ~ #

root @ server: ~ # wget -O - https://nightly.odoo.com/odoo.key | apt-key add -

root @ server: ~ # echo "deb http://nightly.odoo.com/8.0/nightly/deb/ ./" >> /etc/apt/sources.list

root @ server: ~ # apt-get update && apt-get install odoo

Also, you'll probably have to run this line:

root @ server: ~ # apt-get update && apt-get install odoo --fix-missing
 

This will automatically install all dependencies, install Odoo itself as a daemon and automatically start it. You can now access it at port 8069

 

Forum: 
Tags: 
Jeremy Davis's picture

Out of interest; was this done on Core? Or LAMP? Or something else?

Perhaps it might be best done on LAPP (which includes PostgreSQL already) ...? Although it looks like the bit installing PgSQL is probably the most straightforward bit! :)

Jeremy Davis's picture

FWIW from your post I had a quick look at this today. I've had a bit of a play and it looks like I might be able to cobble together a complete standalone appliance...

I'm not sure about installing it side-by-side with WordPress (or using the LAMP base in general) but it installs pretty nicely on the LAPP appliance (which has PostgreSQL already installed and configured). Here's what got it working for me:

wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
echo "deb http://nightly.odoo.com/8.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list
apt-get update && apt-get install -y odoo sudo

sudo su - postgres -c "createuser -s odoo"
service postgresql restart

From my reading of the Deb install it seems that there is one dependency (wkhtmltopdf - which allows exporting of reports to PDF) that can't be automatically resolved and needs to be manually installed:

#adjust these as suits your setup. They work as is for 64bit v13.0 TKL
ARCH=amd64
REL=wheezy
VER=0.12.2.1

wget http://downloads.sourceforge.net/project/wkhtmltopdf/${VER}/wkhtmltox-${VER}_linux-${REL}-${ARCH}.deb
deb -i --force-depends wkhtmltox-*.deb

apt-get -y -f install

If you want you can also set up an Apache proxy (so you don't need to use port 8069). This also forces it to only work via https (so more secure). Note though that if you do this then it will break your WordPress site so for you I wouldn't recommend it!:

#set the domain name of your appliance here first!
DOMAIN_NAME="www.example.com"

cat > /etc/apache2/sites-available/odoo.conf <<EOF
NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	Redirect permanent / https://$DOMAIN_NAME/
</VirtualHost>

<VirtualHost *:443>
	SSLProxyEngine on
        SSLEngine on
        SSLCertificateFile /etc/ssl/certs/cert.pem
        ServerAdmin webmaster@localhost
	RequestHeader set "X-Forwarded-Proto" "https"
	SetEnv proxy-nokeepalive 1
        	ProxyPass / http://127.0.0.1:8069/
        	ProxyPassReverse / http://127.0.0.1:8069/
	ProxyErrorOverride off
	SetEnv proxy-nokeepalive 1
</VirtualHost>
EOF

a2dissite default
a2ensite odoo

a2enmod proxy_http headers rewrite

service apache2 reload

If you do that then you should also adjust some setting for Odoo:

cat >> /etc/odoo/openerp-server.conf <<EOF
proxy_mode = True
xmlrpc_interface = 127.0.0.1
EOF

service odoo restart
Jeremy Davis's picture

It is probably a good idea to reset the "super user" 'admin' password (by default it's just 'admin'). That can be done in the config file: /etc/odoo/openerp-server.conf

There may be other things that I think of... If I do I'll try to add them here.

[update] This info is probably only relevant for someone who wanted to build a TKL Odoo appliance but the 'install' which is normally done in a web browser can be achieved easily via curl;. However because of the Apache config (detailed above) using 'https://localhost' won't work. You'll need to interact with the Odoo server directly (via default port 8069). In my testing I just set up a localhost Apache site but later realised that was unnecessary.

The Odoo server takes JSON format data so to setup a DB with the default admin password, a DB called 'turnkey' and a DB admin password of 'tunrkey' this should work:

DATA='{"jsonrpc":"2.0","method":"call","params":{"fields":\
{"name":"super_admin_pwd","value":"admin"},\
{"name":"db_name","value":"turnkey"},\
{"name":"db_lang","value":"en_US"},\
{"name":"create_admin_pwd","value":"turnkey"},\
{"name":"create_confirm_pwd","value":"turnkey"}]}}'

URL="https://127.0.0.1:8069/web/database/create"

curl -X POST -H "Content-Type: application/json" -d $DATA $URL

Despite how easy it is to install using the .deb, the Odoo docs state that installation of the pre-packaged version "may be difficult to keep up-to-date." (source). So perhaps for a TKL Odoo appliance it may be better for users if we installed from from source (i.e. from GitHub as mentioned here)? FWIW here is a recent tutorial that covers that and appears to be pretty good (it's actually for Ubuntu 14.04 but should be close...). Ultimately I'm not sure...

Jeremy Davis's picture

In theory you can setup an Apache proxy alongside Wordpress. Probably the easiest way to do that would be to use a subdomain for Odoo. For example; use www.example.com for WordPress and odoo.example.com for Odoo. IMO that would be the way to go as then WP and Odoo are essentially separate sites (although still residing on the same server).

You could also have Odoo running in a subdirectory e.g. www.example.com/odoo but that will be a trickier config if you still intend to host WordPress in your webroot (i.e www.example.com); not so much if you are happy with WP in a sub dir too (e.g. www.example.com/wordpress or www.example.com/blog). Obviously that would then require some sort of landing page in your webroot (www.example.com).

Sorry if I scared you or made you think that it wasn't possible to have them operate side-by-side (i.e. proxying Apache and keeping your current WP site). I just didn't want you (or someone else) to blindly follow my instructions and break your (working) website!

Jeremy Davis's picture

Until yesterday I had never seen Odoo in action (although had heard about OpenERP previously) and I must admit that it looks very cool.

As a Odoo user would you recommend that some apps be installed by default? I.e. if there was a TurnKey Odoo appliance should it have some apps already installed or just be a blank canvas (like it is when you manually install it)? If so which ones and why? I'd be really interested in your opinion.

L. Arnold's picture

I am chiming in. At a minimum, the whole standard Odoo shoyud be in the build including the standard Addons. Community addons should be optional and configurable after the install. Likely don't need them except there are a few very valuable ones I would love to have at least installable by default. Generally the admin installs/enables modules but if the pulls were done right the packages are already on the machine. Risk with Odoo is that they have changed pull pull Locations (like Tkl even) so this would best be something that can br configurable if they change again.

Jeremy Davis's picture

But when I installed Odoo it seemed like there was nothing installed. So what are these so-called 'standard' Addons?
Jeremy Davis's picture

As to your final point re install scripts for servers; yes there would be advantages to going in that direction. But there are also potential issues... The way that we currently do it means that we are installing to a known system with a sane, usable and probably most importantly known default. It means that we can control the base environment (and even then we still have the odd bug slip through).

If we provided install scripts then we would have no control over the system that it is being installed to so the potential for issues beyond our control are greatly increased (and the potential points of friction are almost infinite). We already have plenty of support issues to take care of. My strong suspicion is that providing a 'base' appliance and then install scripts for installing other functionality would massively increase our support overhead. As a small team; every time I post here; means that there is something else that I'm not doing... Don't get me wrong I enjoy the interactions I have in the forums, it's just that I have lots of other stuff to do too! :)

Another issue with that direction is that these theoretical install scripts would need to be more intelligent (than the current install logic) and therefore complex (and therefore more likely to have bugs and harder to debug). E.g. Are the correct version of dependencies for the software being installed satisfied? If not will installing them cause issues with other software already installed? What if there is a conflict between software (and it's dependencies) installed already and what we are trying to install (and it's dependencies)? Does software being installed (and it's dependencies) make already installed software (and it's dependencies) redundant or should they still run side-by-side?

And there are a myriad of potential issues and/or questions relating to config too that would need to be resolved or decided. Even if we excluded vastly different appliances and focused on LAMP based appliances (so that they all have a common base and less likelihood for conflicting software and dependencies), there are still config questions that need to be resolved. Like in your instance with Odoo alongside WordPress; should we configure by default for subdomains or subdirectories? Whichever way we go, which will have precedence? I.e. do we want WordPress on blog.example.com or www.example.com? Or do we want them both as subdomains/subdirectories and a landing page? You can guarantee that which ever way we make it default to then there will people who want it set up different and IMO there is no real sane default (all choices are arbitrary). If we made the install scripts allow users to choose, then again we add complexity and therefore greater opportunity for issues to creep in...

FWIW this isn't just theoretical; Bitnami (probably TKL's main competitor) have install scripts like you suggest. If you have a look at their support forums they are chock full of people having issues and/or questions like I am discussing here. Plus they also still have the same sort of issues we have (as they also provide pre-built appliances like we do). I've never really used Bitnami so I'm not saying what they do is bad; just that IMO it's not a good path for us to go down... In fairness they also have install scripts for Windows so they have a broader market. Also they have a much bigger budget for marketing etc so have many more users... Still IMO my point stands.

Having said (ranted!? :D ) all that, ultimately we would love to provide some way to easily combine appliances and run them on a single server (physical or VPS). We just don't think that install scripts that install to a monolithic base appliance is the way to do it. For those running on hardware the obvious answer IMO is to use a hypervisor for each separate server (personally I use and love ProxmoxVE). For those that don't mind a bit of tweaking then our LXC appliance is probably a good way to go (somewhat like a TKL only hypervisor where different appliances run as containers within the host appliance). Both of these have redundancy but personally I prefer it that way. If one server crashes or needs maintenance then it doesn't affect the others (e.g. in your case a DDOS attack on your WP site won't also bring down you Odoo server). We have other ideas for how we might make this work nicely and be more newb friendly but unfortunately have not yet had the time or resources to investigate how we might successfully do that... It's on our radar though! :)

Jeremy Davis's picture

I appreciate your input. It sounds like a vanilla install is probably the way to go at this point then.

I agree that it looks like a Odoo appliance would be a good addition to the TurnKey library although TBH unless someone builds it soon it probably won't make it into the next release. I think that in theory with the info I discovered (and shared above) that building an appliance should be relatively easy; however the devil is in the detail and it's often that last mile that is the hardest...

If you have any further ideas and/or feedback re your experiences with Odoo etc I'd love to hear them...

And as for scripted installs and multi-purpose appliances; we'll continue to ponder the pros and cons and consider how best to do it. Hopefully at some point come up with something that is workable...

Jeremy Davis's picture

Your input and experience is really appreciated! :) Let's hope myself (or someone else) has the time to build this prior to the next release (so it makes it into the library)!
L. Arnold's picture

I have installed 2 previous versions of OpenErp on the Postgres appliance as well as the current V 8 Odoo (they changed the name from 7 to 8). Working for a path to a complete appliance, but I have found already that my installs are migratable whithin TKL via Tklbam (Went feom 32 to 64 bit). Task now is exploring on LAPP (thanks for the major head start Jeremy!) or with NGINX to get SSL. Real task is to integrate into Tkldev. Odoo migrated to Github. It seems to me thaytv 8 will be the stable reference as they will have new license and enviro for v 9.

Should have hooks to OCA Community extensions in Github and general extra extensions as well. As I envisionvit iy would be an addon directory interface somewhat akin to Apache's multi host and  ssl setup but for the simple Odoo enviro config.  Just need to address various directories and pull environments.

Happy to dive in with a team approach on This one. You guys game?  Carlos is working on some TKLPatches for Odoo as well.  I would expect he is interested in a full Tkl App that would install where needed and provide migration capability.

(concern with installing on the Wordpress appliance is that it requires MySQL and Postgresql.  Seems like a lot of overhead.  Why not just have 2 appliances running and working together?  I have done this with OpenERP and Magento and Joomla).   Relatively easy to get apps working together.  I do understand about overhead so expect that is driving it.  Can Wordpress run on Postgresql so just one Database is running?)

L. Arnold's picture

JEREMY you wrote re one critical aspect to the Install - the whole capability to generate quotes and invoices depends upon this.

#adjust these as suits your setup. They work as is for 64bit v13.0 TKL
ARCH=amd64
REL=wheezy
VER=0.12.2.1

wget http://downloads.sourceforge.net/project/wkhtmltopdf/${VER}/wkhtmltox-${VER}_linux-${REL}-${ARCH}.deb
deb -i --force-depends wkhtmltox-*.deb

apt-get -y -f install

I found I could not install without first installing xfonts-base (precursor/dependency)

apt-get install xfonts-base

wget http://sourceforge.net/projects/wkhtmltopdf/files/0.12.2.1/wkhtmltox-0.1...

dpkg -i wkhtmltox-0.12.2.1_linux-wheezy-amd64.deb

apt-get -f install

Did work for me from there though.  If you someone has issues, add the xfonts-base.  And fix it w/ the -f install command pretty much no matter what.  I was quite amazed how the process was somewhat self-mending when dependencies were not working. 

Jeremy Davis's picture

Using the '--force-depends' switch makes dpkg ignore the fact that it has missing dependencies(which is generally a bad idea - but in this case I had already tested it), then the 'apt-get -f install' fixes the dependency issues (if it can - which again I had already confirmed that it could)...
Jeremy Davis's picture

Unfortunately it seems that I didn't actually document all my notes while I was playing...

IIRC there is a (couple?) of Odoo settings that need tweaking to stop 8069 being publicly available. You can bind Odoo to localhost - so Apache can proxy it but it's not available publicly. Actually while writing this email I came across a comment here that may be of use?

TBH I don't recall exactly now (I don't use Odoo I was just playing) but I think that there was a setting that related to proxying the authentication too. Maybe that is why you are getting validation errors? I don't think that I even tested installing a module though so that's pure speculation. I would suggest that you look into the Odoo config file and go through all the possible settings. Maybe something will present itself? IIRC there was documentation about all the possible config setting in the online Odoo docs?

Also there is a TKL community member (L. Arnold) who is working on building a TurnKey Linux Odoo appliance (to hopefully add to our library of pre-installed, pre-configured appliances for the v14.0 release). As a Odoo user perhaps you might have some constructive input?

L. Arnold's picture

Happy to send a ISO install or talk about installing from GitHub with TKLDEV.

I could post the ISO if that were easiest.  Took a long time moving fully to SSL but got it done.

Basically you have to specify that the connection channels only come from local host (numbered that is)

Just posted today in fact:

On Test system edited Odoo Config files (ie openerp-server.conf) with the following and it blocked 8069 in http mode. Will add to the app and test on next go round.

(had no values before)

xmlrpc_interface = 127.0.0.1
netrpc_interface = 127.0.0.1

Hopefully solves it, but would be great if you could test the ISO or Git Install.

Jeremy Davis's picture

If you want to upload your ISO to SourceForge you can. We have a 'Community Downloads' SF project (I started it years ago when I first started contributing to TKL). Only catch is that you need a SF user account (no big deal though, they're free).

If/when you have an SF account please email me (jeremy AT turnkeylinux.org) and let me know what it is and I'll add you to the group! :)

L. Arnold's picture

I've got a SF account look for mail from (me)@nomadic.net.  My odoo is running in same domain now.  Working a bit on the web site but something shows.  Will try online shop/forums/chat etc as I move forward.

Want to make some documentation for running the system somehow in the build.  I notice a whole bunch of Odoo-docs load in the build, but need to find the keys to access them effectively.

Jeremy Davis's picture

It doesn't look like it will take an email address as a username...
L. Arnold's picture

SF is landisa

If Odoo I need to know where you are?

Jeremy Davis's picture

So then I could add you to the "TKL Community" SF page.
L. Arnold's picture

Will work on open Logins.  Forgot about that part just now.

Should be open for New Signups now.  (General Settings in Odoo)

L. Arnold's picture

Now I just need to work on content.... 

Wasn't too bad putting in the SSL

USING TLS 1.2

Rapid SSL 256

Cert pulled from OpenSSL variety.  There were some other choices available also but I need to do a reissue to see what they were.  Pretty easy to do reissues.

Jeremy Davis's picture

And it's looking pretty good! :) Great work on the Odoo integration!
Jeremy Davis's picture

I have only played with Odoo as per this thread. So sorry I'm not much help...

Landis has been working on a v14.0 TurnKey appliance which looks like it's progressing really well. Perhaps you could help him testing that out an d see how it compares to what you are experiencing now...?

Jeremy Davis's picture

Thanks for posting back too.
L. Arnold's picture

wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_lin...

dpkg -i wkhtmltox-0.12.2.1_linux-jessie-amd64.deb

 

Prob should put some good  VER REL and ARCH code in there.

L. Arnold's picture

Tryiing with a GEN call as well

GEN=0.12  which is a GENERATIONAL folder holding all the 0.12 releases releases

L. Arnold's picture

Working on the Proper Mod.  How does this look?  (trying to not Link it)

LOOKS like it built after several tries.  

ARCH=amd64
  REL=jessie
  GEN=0.12
  VER=0.12.2.1

wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb
wget http://download.gna.org/wkhtmltopdf/${GEN}/${VER}/wkhtmltox-${VER}_linux-${REL}-${ARCH}.deb

 

* wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb
* wget http://download.gna.org/wkhtmltopdf/${GEN}/${VER}/wkhtmltox-${VER}_linux-${REL}-${ARCH}.deb
L. Arnold's picture

As several of us have likely built Odoo Appliances I want to report my understanding on  how to migrate to the TKL Odoo App

1:  If you have not added any "external modules" to the build then it is simply a matter of Backing Up your database in the Odoo Database Manager.  Then you should be able to Restore that Database in the Odoo App Database Manager and away you Go.

Caveat here is that this is assuming nothing has changed in the base Odoo Database Structure.

If it has, it will likely be best to Do an "Update" command to your Database.  Doing this is "a bit" complicated.  It wouild be nice if the Odoo Database was "updated" automatically when the Restore Command is used.  It wouild seem that it should be.  (Does anyone know the answer to that?)

2:  If you have used any "external modules" you will need to be sure you rebuild the Directory and Git (or other) structures to be sure those Modules are also loaded to the new Odoo Appliance.  It is also important that you add the correct Addons Call in your openerp-server.conf  File.  In the new TKL Odoo App you will find this file iln /etc/odoo

3:  There are 3 different ways to start, stop and restart the Odoo Service on the new TKL Odoo App.  The main thing to remember is that you want to stick to one method for "start - stop".  The "Update" command can only be used with the traditional Odoo Call (will document shortly).  This means you would "Stop" using the Debian Service Stop Call (as it is started by default),  Start with the Odoo Call *using the -u and -d  (update and database) calls.  Stop again with the Odoo Call.  Then, at that point either Start again with the TKL Service call or simply issue a Reboot command.

I will fill this info in abit once I refresh my memory here.  Will also get it into the Documentation.

ISO's are ready.  Hub not quite yet.  http://www.turnkeylinux.org/odoo

Mansi Trivedi's picture

Hey, Thanks for sharing this it is helpful

Add new comment