Project

General

Profile

Support #607

Install Odoo 8 on FreeBSD

Added by Daniel Curtis over 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Accounting Server
Target version:
Start date:
04/28/2015
Due date:
% Done:

100%

Estimated time:
3.00 h
Spent time:

Description

This is a guide for install OpenERP 8, Odoo, on FreeBSD 9. The Odoo installer supports FreeBSD, so all that needs to be done is install a few dependencies and run the installer.

Setting up the Environment

  • Start by making sure everything is up to date:
    pkg update && pkg upgrade
    portsnap fetch extract
    
  • Install portmaster:
    cd /usr/ports/ports-mgmt/portmaster
    make install clean
    pkg2ng
    
  • Install dependencies from ports
    portmaster textproc/py-libxml2 textproc/py-xlwt devel/py-pytz lang/py-mx-base databases/py-psycopg2 graphics/py-chart graphics/py-pydot textproc/py-libxslt devel/py-lxml textproc/py-xml devel/py-yaml textproc/py-mako devel/py-dateutil print/py-reportlab www/py-werkzeug deskutils/py-vobject finance/py-vatnumber devel/py-unittest2 devel/py-simplejson www/py-requests textproc/py-qrcode devel/py-usb security/py-openid net/py-ldap2 comms/py-serial print/py-pdf devel/py-parsing databases/py-psycogreen databases/py-psycopg2 sysutils/py-psutil graphics/py-pillow security/py-passlib devel/py-mock devel/py-gevent textproc/py-feedparser devel/py-decorator converters/wkhtmltopdf x11-fonts/webfonts
    
    • NOTE: I came across a problem with a pyparsing version preventing the setup.py script to work properly. I found that I needed to uninstall devel/py-pyparsing and replace it with devel/py-pyparsing15:
      cd /usr/ports/devel/py-parsing
      make deinstall clean
      portmaster devel/py-pyparsing15
      
  • (Optional) Install the dependencies using pkgng:
    pkg install py27-libxml2 py27-xlwt py27-pytz py27-mx-base py27-psycopg2 py27-chart py27-pydot py27-libxslt py27-lxml py27-yaml py27-mako py27-dateutil py27-reportlab py27-werkzeug py27-vobject py27-vatnumber py27-unittest2 py27-simplejson py27-requests py27-qrcode py27-usb py27-openid py27-ldap py27-serial py27-pdf py27-pyparsing py27-psycogreen py27-psycopg2 py27-psutil py27-pillow py27-passlib py27-mock py27-gevent py27-feedparser py27-decorator wkhtmltopdf
    
  • Add the OpenERP user
    pw add user -n openerpd -m -s /bin/sh -c "OpenERP" 
    

Install Odoo

  • Make and switch to the /usr/local/src directory:
    mkdir /usr/local/src
    cd /usr/local/src
    
  • Download the latest nightly version of Odoo:
    fetch 'https://nightly.odoo.com/8.0/nightly/src/odoo_8.0.latest.tar.gz'
    tar xzf odoo_8.0-latest.tar.gz
    cd odoo-8.0-*
    
  • Install using the setup script:
    python2 setup.py install
    
  • Set ownership of odoo to the openerpd user:
    chown -R openerpd:wheel /usr/local/lib/python2.7/site-packages/odoo-8.0*
    
    • NOTE: The path may need to be changed to fit the odoo path.

Configure Odoo

  • Create a basic odoo config file:
    vi /usr/local/etc/openerp-server.conf
    
    • And add the following:
      [options]
      ; This is the password that allows database operations:
      ; admin_passwd = admin
      db_host = pg.example.com
      db_port = 5432
      db_user = odoouser
      db_password = odoodb
      addons_path = /usr/local/lib/python2.7/site-packages/odoo-8.0_20150510-py2.7.egg/openerp/addons/
      
    • NOTE: If using the nightly builds the addons_path may need to be changed to suit the path odoo was installed to.

Odoo rc script

  • First make a directory for the openerpd pid
    mkdir /var/run/openerpd
    chown openerpd /var/run/openerpd
    
  • Create a new rc script for odoo:
    vi /usr/local/etc/rc.d/openerpd
    
    • And add the following:
      #!/bin/sh
      #
      # PROVIDE: openerpd
      # REQUIRE: postgresql LOGIN
      #
      # Add the following lines to /etc/rc.conf to enable openerp-server
      #
      #
      # openerpd_enable (bool): Set to "NO" by default,
      #                         Set it to "YES" to enable openerp-server
      #
      # openerpd_config (str):  The path to the openerp-server configuration file
      #                         (defaults to /usr/local/etc/openerp-server.conf)
      #
      # openerpd_flags (str):   Extra arguments to be used when invoking
      #                         the openerp-server daemon.
      #
      # openerpd_addons (str):  The path to the openerpd addons.
      #
      # Patch submitted by (c) Franck Porcher, Ph.D, to fix some issues regarding
      # pidfile, log files, and discrepencies with the main configuration file.
      
      . /etc/rc.subr
      
      name=openerpd
      command=/usr/local/bin/openerp-server
      rcvar=openerpd_enable
      
      load_rc_config $name
      
      openerpd_enable="${openerpd_enable-"NO"}" 
      openerpd_config="${openerpd_config-"/usr/local/etc/openerp-server.conf"}" 
      openerpd_user="${openerpd_user-"openerpd"}" 
      openerpd_pidfile="${openerpd_pidfile:-"/var/run/openerpd/openerpd.pid"}" 
      openerpd_logdir="${openerpd_logdir:-"/var/log/openerpd.log"}" 
      openerpd_flags="${openerpd_flags:-"--config=${openerpd_config} --pidfile=${openerpd_pidfile} --logfile=${openerpd_logdir} "}" 
      
      # /etc/rc.subr use $pidfile (not ${name}_pidfile)
      pidfile="${openerpd_pidfile}" 
      
      required_files="${openerpd_config}" 
      
      start_cmd="su - ${openerpd_user} -c '${command} ${openerpd_flags}' &" 
      stop_cmd="${name}_stop" 
      status_cmd="${name}_status" 
      getval_cmd="${name}_getval" 
      
      openerpd_stop()
      {
          openerpd_pid=$(pgrep -f "openerp-server")
      
          echo "Stopping ${name}." 
          kill -s TERM "$(cat "${openerpd_pidfile}")" 
      
          echo "Stopping ${name}." 
          kill -s TERM "${openerpd_pid}" 
      }
      
      openerpd_status()
      {
          # Try its best to find the service's status
          if [ -f "${openerpd_pidfile}" ]
          then
              openerpd_pid="$(cat "${openerpd_pidfile}")" 
          fi
      
          if [ -z "${openerpd_pid}" ]
          then
          openerpd_pid=$(pgrep -f "openerp-server")
          [ -n "${openerpd_pid}" ] && echo "${openerpd_pid}" > "${openerpd_pidfile}" 
          fi
      
          if [ -n "${openerpd_pid}" ]
          then
              echo "${name} running with pid: $openerpd_pid" 
          else
              echo "${name} not running? (pid not found)" 
          fi
      }
      
      command_args=" >/dev/null 2>&1 &" 
      
      load_rc_config $name
      run_rc_command "$1"  
      
  • Make the script executable:
    chmod +x /usr/local/etc/rc.d/openerpd
    
  • Start and enable odoo at boot:
    echo 'openerpd_enable="YES"' >> /etc/rc.conf
    service openerpd start
    
    • NOTE: If the server does not start, try to start it manually and look for any output:
      su -m openerpd -c 'sh -c "/usr/local/bin/openerp-server --config=/usr/local/etc/openerp-server.conf"'
      

(Optional) Install Odoo from GitHub

  • Add the OpenERP user
    pw add user -n openerpd -m -s /bin/sh -c "OpenERP" 
    
  • Remove openldap-client and py27-ldap:
    pkg remove openldap-client py27-ldap
    
  • Reinstall py27-ldap from ports, enabling [X] SASL
    portmaster net/py-ldap
    
    • Enable [X] GSSAPI in the openldap-client port.
  • Install pip:
    pkg install py27-pip
    
  • Make and switch to the /usr/local/src directory:
    mkdir /usr/local/src
    cd /usr/local/src
    
  • Download Odoo from GitHub:
    git clone -b 8.0 https://www.github.com/odoo/odoo
    cd odoo
    
  • Install the odoo dependencies using pip:
    pip install -r requirements.txt
    
  • Now install odoo:
    python2 setup.py install
  • Next copy the addons from the git repo to the install directory:
    cp -r /usr/local/src/odoo/addons/* /usr/local/lib/python2.7/site-packages/odoo-8.0-py2.7.egg/openerp/addons/
    
  • Set ownership of odoo to the openerpd user:
    chown -R openerpd:wheel /usr/local/lib/python2.7/site-packages/odoo-8.0*
    
    • NOTE: The path may need to be changed to fit the odoo path.

Configure Odoo

  • Create a basic odoo config file:
    vi /usr/local/etc/openerp-server.conf
    
    • And add the following:
      [options]
      ; This is the password that allows database operations:
      ; admin_passwd = admin
      db_host = pg.example.com
      db_port = 5432
      db_user = odoouser
      db_password = odoodb
      addons_path = /usr/local/lib/python2.7/site-packages/odoo-8.0-py2.7.egg/openerp/addons/
      
    • NOTE: If using the nightly builds the addons_path may need to be changed to suit the path odoo was installed to.

Odoo rc script

  • First make a directory for the openerpd pid
    mkdir /var/run/openerpd
    chown openerpd /var/run/openerpd
    
  • Create a new rc script for odoo:
    vi /usr/local/etc/rc.d/openerpd
    
    • And add the following:
      #!/bin/sh
      #
      # PROVIDE: openerpd
      # REQUIRE: postgresql LOGIN
      #
      # Add the following lines to /etc/rc.conf to enable openerp-server
      #
      #
      # openerpd_enable (bool): Set to "NO" by default,
      #                         Set it to "YES" to enable openerp-server
      #
      # openerpd_config (str):  The path to the openerp-server configuration file
      #                         (defaults to /usr/local/etc/openerp-server.conf)
      #
      # openerpd_flags (str):   Extra arguments to be used when invoking
      #                         the openerp-server daemon.
      #
      # openerpd_addons (str):  The path to the openerpd addons.
      #
      # Patch submitted by (c) Franck Porcher, Ph.D, to fix some issues regarding
      # pidfile, log files, and discrepencies with the main configuration file.
      
      . /etc/rc.subr
      
      name=openerpd
      command=/usr/local/bin/openerp-server
      rcvar=openerpd_enable
      
      load_rc_config $name
      
      openerpd_enable="${openerpd_enable-"NO"}" 
      openerpd_config="${openerpd_config-"/usr/local/etc/openerp-server.conf"}" 
      openerpd_user="${openerpd_user-"openerpd"}" 
      openerpd_pidfile="${openerpd_pidfile:-"/var/run/openerpd/openerpd.pid"}" 
      openerpd_logdir="${openerpd_logdir:-"/var/log/openerpd.log"}" 
      openerpd_flags="${openerpd_flags:-"--config=${openerpd_config} --pidfile=${openerpd_pidfile} --logfile=${openerpd_logdir} "}" 
      
      # /etc/rc.subr use $pidfile (not ${name}_pidfile)
      pidfile="${openerpd_pidfile}" 
      
      required_files="${openerpd_config}" 
      
      start_cmd="su - ${openerpd_user} -c '${command} ${openerpd_flags}' &" 
      stop_cmd="${name}_stop" 
      status_cmd="${name}_status" 
      getval_cmd="${name}_getval" 
      
      openerpd_stop()
      {
          openerpd_pid=$(pgrep -f "openerp-server")
      
          echo "Stopping ${name}." 
          kill -s TERM "$(cat "${openerpd_pidfile}")" 
      
          echo "Stopping ${name}." 
          kill -s TERM "${openerpd_pid}" 
      }
      
      openerpd_status()
      {
          # Try its best to find the service's status
          if [ -f "${openerpd_pidfile}" ]
          then
              openerpd_pid="$(cat "${openerpd_pidfile}")" 
          fi
      
          if [ -z "${openerpd_pid}" ]
          then
          openerpd_pid=$(pgrep -f "openerp-server")
          [ -n "${openerpd_pid}" ] && echo "${openerpd_pid}" > "${openerpd_pidfile}" 
          fi
      
          if [ -n "${openerpd_pid}" ]
          then
              echo "${name} running with pid: $openerpd_pid" 
          else
              echo "${name} not running? (pid not found)" 
          fi
      }
      
      command_args=" >/dev/null 2>&1 &" 
      
      load_rc_config $name
      run_rc_command "$1"  
      
  • Make the script executable:
    chmod +x /usr/local/etc/rc.d/openerpd
    
  • Start and enable odoo at boot:
    echo 'openerpd_enable="YES"' >> /etc/rc.conf
    service openerpd start
    
    • NOTE: If the server does not start, try to start it manually and look for any output:
      su -m openerpd -c 'sh -c "/usr/local/bin/openerp-server --config=/usr/local/etc/openerp-server.conf"'
      

Creating a Dummy Theme

  • Install less from NPM:
    npm install -g less less-plugin-clean-css
    
  • Fetch odoo.py from GitHub:
    cd /usr/local/lib/python2.7/site-packages/odoo-8.0_20150510-py2.7.egg/openerp/
    wget -O odoo.py https://raw.githubusercontent.com/odoo/odoo/8.0/odoo.py
    
  • Create a new scaffold theme:
    python2 odoo.py scaffold -t theme "New Theme" addons
    
  • Restart Odoo:
    service openerpd restart
    
  • Now go to Settings and install the new theme
    h2. Resources
#1

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
  • Status changed from New to In Progress
#2

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
  • % Done changed from 0 to 40
#3

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
  • % Done changed from 40 to 50
#4

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#5

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
  • % Done changed from 50 to 60
#6

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
  • % Done changed from 60 to 70
#7

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#8

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
  • % Done changed from 70 to 80
#9

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#10

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
  • % Done changed from 80 to 90
#11

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#12

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#13

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#14

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#15

Updated by Daniel Curtis over 9 years ago

  • Estimated time changed from 5.00 h to 3.00 h
#16

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#17

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#18

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#19

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#20

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
  • % Done changed from 90 to 100
#21

Updated by Daniel Curtis over 9 years ago

  • Status changed from In Progress to Resolved
#22

Updated by Daniel Curtis over 9 years ago

  • Status changed from Resolved to Closed
#23

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#24

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#25

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#26

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#27

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#28

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#29

Updated by Daniel Curtis over 9 years ago

  • Description updated (diff)
#30

Updated by Daniel Curtis almost 9 years ago

  • Subject changed from Install Odoo on FreeBSD to Install Odoo 8 on FreeBSD
#31

Updated by Daniel Curtis almost 9 years ago

  • Description updated (diff)

Also available in: Atom PDF