Hi ppl,
this howto is about installing Odoo 10, a CRM and ERP suite.
EDIT - 11.1.2018
- added optional HTTPS with nginx - thanks to @dnutan and @Clinton_McDonald
- added AD user configuration - thanks to @iglqut
EDIT - 16.12.2017
- changed db template because postgresql doesn’t accept UTF8 without template anymore - thanks to @danb35
- optimized yum install by installing just 2 packages - thanks to @danb35
EDIT - 8.12.2017
- added quick copy/paste install
- added application button
EDIT - 6.12.2017
- yum install nethserver-postgresql instead of postgresql-server - thanks to @dnutan
- yum install pyparsing - Failed dependencies: pyparsing is needed by odoo-10.0.post20171205-1.noarch
Quick copy/paste install without HTTPS
If you just want odoo to go then copy/paste the following to a text editor, change the SECRET password and copy/paste to your terminal and you are ready.
For a step by step howto go to next step, recommended to know what you do
yum -y install nethserver-postgresql http://nightly.odoocdn.com/10.0/nightly/rpm/odoo_10.0.latest.noarch.rpm
systemctl enable --now postgresql
su - postgres
psql
CREATE ROLE odoo WITH LOGIN password 'SECRET';
CREATE DATABASE odoo ENCODING 'UTF8' OWNER odoo TEMPLATE template0;
\q
exit
config set fw_odoo service status enabled TCPPort 8069 access green
signal-event firewall-adjust
cat > /etc/odoo/odoo.conf << EOL
[options]
; This is the password that allows database operations:
;admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = odoo
db_password = SECRET
addons_path = /usr/lib/python2.7/site-packages/odoo/addons
EOL
systemctl enable odoo
systemctl start odoo
cat > /usr/share/nethesis/NethServer/Module/Dashboard/Applications/Odoo.php << EOL
<?php
namespace NethServer\Module\Dashboard\Applications;
class Odoo extends \Nethgui\Module\AbstractModule implements \NethServer\Module\Dashboard\Interfaces\ApplicationInterface
{
public function getName()
{
return "Odoo";
}
public function getInfo()
{
\$host = explode(':',\$_SERVER['HTTP_HOST']);
return array(
'url' => "http://".\$host[0].":8069",
);
}
}
EOL
Installing odoo and dependencies
yum -y install nethserver-postgresql http://nightly.odoocdn.com/10.0/nightly/rpm/odoo_10.0.latest.noarch.rpm
systemctl enable --now postgresql
Database
You may use phppgadmin or command line to create a role with password, database and rights on the database:
su - postgres
psql
CREATE ROLE odoo WITH LOGIN password 'SECRET';
CREATE DATABASE odoo ENCODING 'UTF8' OWNER odoo TEMPLATE template0;
\q
exit
Firewall
Add network service for odoo with TCP Port 8069 on green interface:
config set fw_odoo service status enabled TCPPort 8069 access green
signal-event firewall-adjust
Configuration
Edit /etc/odoo/odoo.conf and enter Odoo postgresql db user credentials:
[options]
; This is the password that allows database operations:
;admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = odoo
db_password = SECRET
addons_path = /usr/lib/python2.7/site-packages/odoo/addons
I needed to install a specific version of psutil because I had following error in /var/log/messages, but maybe just because my system is a heavy penetrated test system, thanks to @dnutan…
Normally you do not have to do this:
Sep 11 18:57:21 server odoo: ImportError: version conflict: '/usr/lib64/python2.7/site-packages/psutil/_psutil_linux.so' C extension module was built for another version of psutil (different than 2.2.1)
If you really have this kind of error just install psutil 2.2.1 via pip:
pip install psutil==2.2.1
Enabling service and login
systemctl enable odoo
systemctl start odoo
Application Button
Create the file /usr/share/nethesis/NethServer/Module/Dashboard/Applications/Odoo.php:
cat > /usr/share/nethesis/NethServer/Module/Dashboard/Applications/Odoo.php << EOL
<?php
namespace NethServer\Module\Dashboard\Applications;
class Odoo extends \Nethgui\Module\AbstractModule implements \NethServer\Module\Dashboard\Interfaces\ApplicationInterface
{
public function getName()
{
return "Odoo";
}
public function getInfo()
{
\$host = explode(':',\$_SERVER['HTTP_HOST']);
return array(
'url' => "http://".\$host[0].":8069",
);
}
}
EOL
HTTPS - optional - may make some applications unavailable
Warning! This is only recommended if you really need HTTPS as odoo will work but other apps won’t!
I could only setup HTTPS with nginx and moving apache ports to 81 and 10443 which may lead to some applications not working anymore.
# Stop httpd
systemctl stop httpd
# change port from 80 to 81
sed -i 's/^ /Listen 80/Listen 81' /etc/httpd/conf/httpd.conf
# change port from 443 to 10443
sed -i 's/^ /Listen 443 https/Listen 10443 https' /etc/httpd/conf.d/ssl.conf
# Install nginx
yum -y install nginx
# deactivate default server on port 80
sed -i '38,57 s/^ /# /' /etc/nginx/nginx.conf
Enable proxy mode in /etc/odoo/odoo.conf and use the following /etc/nginx/conf.d/odoo.conf for nginx as described here: https://www.odoo.com/documentation/10.0/setup/deploy.html#id7
Edit /etc/nginx/conf.d/odoo.conf and change the used certificate to
ssl_certificate /etc/pki/tls/certs/localhost.crt;
ssl_certificate_key /etc/pki/tls/private/localhost.key;
# start and enable services
systemctl restart odoo
systemctl start httpd
systemctl enable nginx
systemctl restart nginx
Browse to your odoo site
Browse to http://YOURNETHSERVER:8069 or, if you enabled HTTPS, to https://YOURNETHSERVER
This screen is only shown, if you have no database, so odoo provides creating one.
Uncheck demo data when you want to have an empty odoo. I checked it, because it’s better for evaluating.
Enter creds for the admin user and click “Create Database”…
If you don’t see this screen, the login is admin/admin, thanks again to @dnutan
Welcome to paradise!
AD config
This works only if you have at least nethserver-sssd 1.3.5-1 installed.
Install the LDAP module via Apps menu
Setup the LDAP module via Settings/General Settings and add LDAP Parameters:
You may just enter the ldap binddn / password from your account settings in Nethgui:
The LDAP base can be found in “Domain Accounts” in Nethgui, usually something like “dc=AD,dc=DOMAIN,dc=LOCAL”
It is recommended to create a template user in odoo, set rights and roles, don’t set a password and use this user as template user so newly created odoo users out of NS AD users will use this template.
I am excitedly awaiting your feedback!
Sources:
http://www.nevprobusinesssolutions.com/active-directoryad-authentication-odoo/
https://www.odoo.com/documentation/10.0/setup/install.html