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 dependencies from ports 
 <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-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 
 </pre> 
 #* *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: 
 <pre> 
 cd /usr/ports/devel/py-parsing 
 make deinstall clean 
 portmaster devel/py-pyparsing15 
 </pre> 

 * (Optional) Install the dependencies using pkgng: 
 <pre> 
 pkg install py27-libxml2 py27-xlwt py27-pytz py27-mx-base py27-psycopg2 py27-chart py27-pydot py27-libxslt py27-lxml py27-xml 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-parsing py27-psycogreen py27-psycopg2 py27-psutil py27-pillow py27-passlib py27-mock py27-gevent py27-feedparser py27-decorator wkhtmltopdf 
 </pre> 

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

 h2. Install Odoo 

 * Make and switch to the /usr/local/src directory: 
 <pre> 
 mkdir /usr/local/src 
 cd /usr/local/src 
 </pre> 

 * Download the latest nightly 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> 
 python2 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* 
 </pre> 
 #* *NOTE*: The path may need to be changed to fit the odoo path. 

 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_20150510-py2.7.egg/openerp/addons/ 
 </pre> 
 #* NOTE: If using the nightly builds the addons_path may need to be changed to suit the path odoo was installed to. 

 h3. Odoo rc script 

 * First make a directory for the openerpd pid 
 <pre> 
 mkdir /var/run/openerpd 
 chown openerpd /var/run/openerpd 
 </pre> 

 * 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. 
 # 
 # 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"   
 </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. Creating a Dummy Theme 

 * Install less from NPM: 
 <pre> 
 npm install -g less less-plugin-clean-css 
 </pre> 

 * Fetch odoo.py from GitHub: 
 <pre> 
 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 
 </pre> 

 * Create a new scaffold theme: 
 <pre> 
 python2 odoo.py scaffold -t theme "New Theme" addons 
 </pre> 

 * Restart Odoo: 
 <pre> 
 service openerpd restart 
 </pre> 

 * Now go to Settings and install the new theme 
 h2. Resources 

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

Back