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-pyparsing 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> #* *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> * Add the OpenERP user <pre> pw add user -n openerpd -m -s /bin/sh -c "OpenERP" </pre> h2. Install Odoo * Switch to the /usr/src directory: <pre> cd /usr/src </pre> * Download Odoo from github: <pre> git clone https://www.github.com/odoo/odoo --depth 1 --branch 8.0 --single-branch cd odoo </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> 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* /usr/local/lib/python2.7/site-packages/odoo-8.0-py2.7.egg/ </pre> #* *NOTE*: The path may need to be changed to fit the date of the odoo path. 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_20150510-py2.7.egg/openerp/addons/ /usr/local/lib/python2.7/site-packages/odoo-8.0-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 mkdir /var/run/openerpd chown openerpd /var/run/openerpd * 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_pidfile="${openerpd_pidfile:-"/var/run/openerpd.pid"}" openerpd_logdir="${openerpd_logdir:-"/var/log/openerpd.log"}" openerpd_addons="${openerpd_addons:-"/usr/local/lib/python2.7/site-packages/odoo-8.0_20150510-py2.7.egg/openerp/addons"}" openerpd_addons="${openerpd_addons:-"/usr/local/lib/python2.7/site-packages/odoo -8.0-py2.7.egg/openerp/addons"}" openerpd_flags="${openerpd_flags:-"--config=${openerpd_config} --pidfile=${openerpd_pidfile} --addons-path=${openerpd_addons} --logfile=${openerpd_logdir} "}" # /etc/rc.subr use $pidfile (not ${name}_pidfile) pidfile="${openerpd_pidfile}" required_files="${openerpd_config}" start_cmd="su - start_cmd="/usr/sbin/daemon -u ${openerpd_user} -c '${command} ${openerpd_flags}' &" -p ${pidfile} ${command} ${openerpd_flags}" stop_cmd="${name}_stop" status_cmd="${name}_status" getval_cmd="${name}_getval" 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