Support #722
Install Odoo 9 on FreeBSD
Status:
Closed
Priority:
Normal
Assignee:
Category:
Accounting Server
Target version:
Description
This is a guide on how I installed Odoo 9 on FreeBSD 10.
Prepare the Environment¶
- Make sure the system is up to date:
pkg update && pkg upgrade
- Add the Odoo user
pw add user -n odoo -m -s /bin/sh -c "Odoo"
- Install the dependencies using pkgng:
pkg install py27-Jinja2 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-python-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 py27-docutils wkhtmltopdf node npm openldap-sasl-client
- Install less nodejs package:
npm install -g less less-plugin-clean-css
Install PostgreSQL 9.4¶
- Install PostgreSQL:
pkg install postgresql94-{server,client}
- Enable PostgreSQL at boot:
echo 'postgresql_enable="YES"' >> /etc/rc.conf
- Initialize the database:
service postgresql initdb
- Start PostgreSQL:
service postgresql start
- Edit the postgres config file:
vi /usr/local/pgsql/data/postgresql.conf
- And modify the following:
listen_addresses = '*'
- And modify the following:
- Edit the pg_hba config file:
vi /usr/local/etc/pgsql/data/pg_hba.conf
- And modify the following:
# TYPE DATABASE USER CIDR-ADDRESS METHOD only # Local connections local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust # IPv4 connections: host all all 192.168.10.0/24 md5
- And modify the following:
- Restart postgresql:
service postgresql restart
Create a new user and database¶
- Switch to the pgsql user and enter into the psql prompt:
su pgsql psql -d template1
- Create the odoouser user and odoodb database:
CREATE USER odoouser WITH PASSWORD 'SuperSecretPassword'; ALTER USER odoouser CREATEDB; CREATE DATABASE odoodb OWNER odoouser ENCODING 'UTF8'; GRANT ALL PRIVILEGES ON DATABASE "odoodb" to odoouser;
- Create the odoouser user and odoodb database:
- Exit from the postgres user
\q exit
- Test the connection on a remote host:
psql -h pg.example.com -U odoouser -W odoodb
Install Odoo 9¶
- Switch to the Odoo user folder:
cd /usr/local/www
- Clone the latest Odoo 9 code from GitHub:
git clone https://www.github.com/odoo/odoo --depth 1 --branch 9.0 --single-branch chown -R odoo:odoo odoo
- Install any missing dependencies:
cd odoo env CPPFLAGS="-I /usr/local/include -I /usr/local/include/sasl" pip install -r requirements.txt
- Create a folder for custom addons:
mkdir -p /usr/local/www/odoo/custom/addons chown -R odoo:odoo /usr/local/www/odoo/custom
- Create the odoo log folder:
touch /var/log/odoo-server.log chmod 644 /var/log/odoo-server.log chown -R odoo:wheel /var/log/odoo-server.log
- Create the odoo pid folder:
mkdir /var/run/odoo chown odoo /var/run/odoo
- Create the Odoo config:
vi /usr/local/etc/odoo.conf
- And Modify the following parameters:
[options] ; This is the password that allows database operations: ; admin_passwd = admin db_host = localhost db_port = 5432 database = odoodb db_user = odoouser db_password = SuperSecretPassword addons_path = /usr/local/www/odoo/addons,/usr/local/www/odoo/custom/addons logfile = /var/log/odoo-server.log log_level = error
- And Modify the following parameters:
- Make the odoo config owner the odoo user:
chown odoo /usr/local/etc/odoo.conf
- Edit the openerp-server script:
vi /usr/local/www/odoo/openerp-server
- And change the env from python to python2, and set the default encoding to utf8
#!/usr/bin/env python2 import openerp import sys reload(sys) sys.setdefaultencoding('utf8') if __name__ == "__main__": openerp.cli.main()
- And change the env from python to python2, and set the default encoding to utf8
- Now test run the Odoo server:
su - odoo cd odoo ./openerp-server --config=/usr/local/etc/odoo.conf
- Open a web browser and go to http://odoo.example.com:8069 and go to manage databases.
- Set a new master password, the default master password is admin
- Next click Create database; enter the master password, new database name, and the admin password.
- Go back to http://odoo.example.com:8069 and log in, the default username is admin and password is admin
Odoo Init Script¶
- Create a new rc script for odoo:
vi /usr/local/etc/rc.d/odoo
- And add the following:
#!/bin/sh # # PROVIDE: odoo # REQUIRE: postgresql LOGIN # # Add the following lines to /etc/rc.conf to enable odoo server # # # odoo_enable (bool): Set to "NO" by default, # Set it to "YES" to enable odoo server # # odoo_config (str): The path to the odoo server configuration file # (defaults to /usr/local/etc/odoo.conf) . /etc/rc.subr name=odoo command=/usr/local/www/odoo/openerp-server rcvar=odoo_enable load_rc_config $name odoo_enable="${odoo_enable-"NO"}" odoo_config="${odoo_config-"/usr/local/etc/odoo.conf"}" odoo_user="${odoo_user-"odoo"}" odoo_pidfile="${odoo_pidfile:-"/var/run/odoo/odoo.pid"}" odoo_flags="${odoo:-"--config=${odoo_config} --pidfile=${odoo_pidfile} "}" # /etc/rc.subr use $pidfile (not ${name}_pidfile) pidfile="${odoo_pidfile}" required_files="${odoo_config}" start_cmd="su - ${odoo_user} -c '${command} ${odoo_flags}' &" stop_cmd="${name}_stop" status_cmd="${name}_status" getval_cmd="${name}_getval" odoo_stop() { odoo_pid=$(pgrep -f "openerp-server") echo "Stopping ${name}." kill -s TERM "$(cat "${odoo_pidfile}")" echo "Stopping ${name}." kill -s TERM "${openerpd_pid}" } odoo_status() { # Try its best to find the service's status if [ -f "${odoo_pidfile}" ] then odoo_pid="$(cat "${odoo_pidfile}")" fi if [ -z "${odoo_pid}" ] then odoo_pid=$(pgrep -f "openerp-server") [ -n "${odoo_pid}" ] && echo "${odoo_pid}" > "${odoo_pidfile}" fi if [ -n "${odoo_pid}" ] then echo "${name} running with pid: $odoo_pid" else echo "${name} not running? (pid not found)" fi } command_args=" >/dev/null 2>&1 &" load_rc_config $name run_rc_command "$1"
- And add the following:
- Make the script executable:
chmod +x /usr/local/etc/rc.d/odoo
- Start and enable odoo at boot:
echo 'odoo_enable="YES"' >> /etc/rc.conf service odoo start
Resources¶
Updated by Daniel Curtis almost 9 years ago
- Description updated (diff)
- Status changed from New to In Progress
- % Done changed from 0 to 30
- Estimated time set to 2.00 h
Updated by Daniel Curtis almost 9 years ago
- Description updated (diff)
- % Done changed from 30 to 50
Updated by Daniel Curtis almost 9 years ago
- Description updated (diff)
- % Done changed from 50 to 70
Updated by Daniel Curtis almost 9 years ago
- Description updated (diff)
- Status changed from In Progress to Resolved
- % Done changed from 70 to 100