Project

General

Profile

Support #607

Updated by Daniel Curtis over 9 years ago

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. 

 h2. Setting up the Environment 

 * Start by making sure everything is up to date: 
 <pre> 
 pkg update && pkg upgrade 
 portsnap fetch extract 
 </pre> 

 * Install portmaster: 
 <pre> 
 cd /usr/ports/ports-mgmt/portmaster 
 make install clean 
 pkg2ng 
 </pre> 

 * Install a some dependencies: 
 <pre> 
 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-reportlab2 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-pyparsing15 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 
 </pre> 

 * Add the OpenERP user 
 <pre> 
 pw add user -n openerpd -m -s /bin/sh -c "OpenERP" 
 </pre>  

 h2. Install Odoo 

 * Download Odoo from github: 
 <pre> 
 git clone https://www.github.com/odoo/odoo --depth 1 --branch 8.0 --single-branch . 
 </pre> 
 #* (Optional) Download the latest version of Odoo: 
 <pre> 
 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-* 
 </pre> 

 * Install using the setup script: 
 <pre> 
 python setup.py install 
 </pre> 

 * Set ownership of odoo to the openerpd user: 
 <pre> 
 chown -R openerpd:wheel /usr/local/lib/python2.7/site-packages/odoo-8.0_20150507-py2.7.egg/ 
 </pre> 
 #* *NOTE*: The path may need to be changed to fit the date of the odoo package 

 h3. Configure Odoo 

 * Create a basic odoo config file: 
 <pre> 
 vi /usr/local/etc/openerp-server.conf 
 </pre> 
 #* And add the following: 
 <pre> 
 [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_20150507-py2.7.egg/openerp/addons 
 </pre> 

 h3. Odoo rc script 

 * Create a new rc script for odoo: 
 <pre> 
 vi /usr/local/etc/rc.d/openerpd 
 </pre> 
 #* And add the following: 
 <pre> 
 #!/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. 
 # 
 # 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.pid"}" openerpd_pidfile="${openerpd_pidfile:-"$(grep pidfile /usr/local/etc/openerp-server.conf | awk -F "=" ' { print $2 } ' |sed 's/[ ]//g' )"}" 
 openerpd_logdir="${openerpd_logdir:-"/var/log/openerp-server.log"}" openerpd_logdir="${openerpd_logdir:-"$(dirname `grep logfile /usr/local/etc/openerp-server.conf | awk -F "=" ' { print $2 } ' `)"}" 
 openerpd_flags="${openerpd_flags:-"--config=${openerpd_config}"}" 
 
 # /etc/rc.subr use $pidfile (not ${name}_pidfile) 
 pidfile="${openerpd_pidfile}" 
 
 required_files="${openerpd_config}" 

 
 
 start_precmd="${name}_prestart" 
 stop_cmd="${name}_stop" 
 status_cmd="${name}_status" 
 getval_cmd="${name}_getval" 
 
 openerpd_start() openerpd_prestart() 
 { 
     su -m openerpd -c 'sh -c "${command} ${openerpd_flags}"' local d 
 
     d="$(dirname "${openerpd_pidfile}")" 
     if [ ! -d "${d}" ] 
     then 
         mkdir -p "${d}" 
     fi 
     chown "${openerpd_user}" "${d}" 
 
     d="$openerpd_logdir" 
     if [ ! -d "${d}" ] 
     then 
         mkdir -p "${d}" 
     fi 
     chown "${openerpd_user}" "${d}" 
 } 
 
 openerpd_stop() 
 { 
     # echo "Looking for (openerp-server ${openerpd_flags})" 
     openerpd_pid=$(pgrep -f "openerp-server ${openerpd_flags}") 
     # Try its best to stop the service 
     if [ -f "${openerpd_pidfile}" ] && [ "${openerpd_pidfile}" = "${openerpd_pid}" ] 
     then 
         echo "Stopping ${name}." 
         kill -15 "$(cat "${openerpd_pidfile}")" 
     else 
         if [ -n "${openerpd_pid}" ] 
         then 
             echo "Stopping ${name}." 
             kill -15 "${openerpd_pid}" 
         else 
             echo "${name} not running? (pidfile not found)" 
         fi 
     fi 
 } 
 
 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.py ${openerpd_flags}") 
     [ -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" 
 </pre> 

 * Make the script executable: 
 <pre> 
 chmod +x /usr/local/etc/rc.d/openerpd 
 </pre> 

 * Start and enable odoo at boot: 
 <pre> 
 echo 'openerpd_enable="YES"' >> /etc/rc.conf 
 service openerpd start 
 </pre> 
 #* *NOTE*: If the server does not start, try to start it manually and look for any output: 
 <pre> 
 su -m openerpd -c 'sh -c "/usr/local/bin/openerp-server --config=/usr/local/etc/openerp-server.conf"' 
 </pre> 

 * Now navigate to http://odoo.example.com:8069 to complete the installation process. 

 h2. Resources 

 * http://zewaren.net/site/?q=node/127 
 * https://github.com/odoo/odoo 
 * https://www.odoo.com/documentation/8.0/setup/install.html

Back