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 (since there are no customizations needed to be done to the dependencies, it is safe to install them from pkg): <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-ldap2 py27-serial py27-pdf py27-pyparsing15 py27-psycogreen py27-psycopg2 py27-psutil py27-pillow py27-passlib py27-mock py27-gevent py27-feedparser py27-decorator </pre> #* (Optional) 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 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> #* *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_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_logdir="${openerpd_logdir:-"/var/log/openerpd.log"}" openerpd_flags="${openerpd_flags:-"--config=${openerpd_config} --logfile=${openerpd_logdir}"}" # /etc/rc.subr use $pidfile (not ${name}_pidfile) pidfile="${openerpd_pidfile}" required_files="${openerpd_config}" start_cmd="/usr/sbin/daemon -u ${openerpd_user} -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