Installing Tryton server on FreeBSD

This article is part of a series on the Tryton framework, and complements the Maestro project on GitHub. This article describes installing the Tryton server on FreeBSD.

2014-06-30 – updated after installing Tryton server on (FreeBSD-9.2-RELEASE).

Create a virtual machine

I generally use VirtualBox on Windows, but these instructions should generally apply to any virtualizing environment on any host OS.

First, download a FreeBSD-10.0-RELEASE ISO file. The “bootonly” ISO will download the fastest, but the virtual machine must have an active internet connection for install and the install will take the longest. The “dvd1″ ISO will take longer to download, but the virtual machine will not need an active internet connection for install and the install will complete faster. Use the 64-bit “amd64″ version instead of the 32-bit “i386″ version on newer 64-bit compatible hardware.

Create a new virtual machine:

  • 512MB RAM
  • typically VT-x/AMD-V must be disabled on older systems, e.g. Lenovo ThinkPad T61 and Dell Latitude D630 laptops.
  • configure bridged network connection (accessible from any system on local network) or NAT (accessible from the host only, with appropriate port forwarding – normally port 8000 for Tryton and port 22 for ssh).

Install and update FreeBSD OS

Boot vm from boot CD/DVD and follow the standard install procedure, including creating an admin user and including it in the wheel group.

I generally use ssh keys only for remote login for security, and to avoid having to type passwords. Copy the public ssh key for the admin user to ~/.ssh, edit /etc/ssh/sshd_config to add “AllowUsers adminusername” (if I’m more interested in convenience than security I will also add “PermitRootLogin YES”), and restart sshd.

Check for and install available FreeBSD OS updates, and install the pkg packaging system port. pkg is sometimes called “pkgng” to differentiate it from the older pkg_* packaging utilities, which will be removed in the next FreeBSD release.

# freebsd-update fetch
# freebsd-update install
# pkg update   

You can check the installed packages for reported vulnerabilities (-F is required for initial use only to download a new vulnerability database).

# pkg audit -F

Install PostgreSQL RDBMS

Postgresql files will be owned by user “pgsql”, who alsos own the server process.

# pkg install postgresql93-server-9.3.4
# echo "postgresql_enable=YES" >> /etc/rc.conf
# /usr/local/etc/rc.d/postgresql initdb
# /usr/local/etc/rc.d/postgresql start

Edit /usr/local/pgsql/data/postgresql.conf and configure PostgreSQL to listen on all addresses (my vm will be on my test LAN, with no access from the internet).

listen_addresses = '*'

Edit /usr/local/pgsql/data/pg_hba.conf and add host connection permission. I’m going to allow access by all ipv4 addresses on my local LAN (your requirements may be different).

host all all md5

Add a “tryton” super-user to PostgreSQL. You must be system root to do this.

# su pgsql
$ createuser -sdrP tryton
Enter password for new role:
Enter it again:
$ exit

The “tryton” super-user password will be entered in trytond.conf (the trytond daemon configuration file) and used by Tryton to manage its PostgreSQL databases.

Restart the PostgreSQL server.

# /usr/local/etc/rc.d/postgresql restart

You should now be able to connect to the PostgreSQL server (“-W” causes psql to prompt for the “tryton” user password).

# psql --username=tryton -W --list

If you edited postgresql.conf and pg_hba.conf as indicated here, you should now also be able to connect from a remote system (e.g. using pgAdmin).

Install Tryton dependencies

Install Python v2 and the pip package manager (Tryton does not support Python v3, although it is being worked on by the Tryton project team).

# pkg install python27
# pkg install py27-pip

Install FreeBSD package dependencies.

# pkg install libxml2
# pkg install libxslt

Install the Graphviz FreeBSD package, required to display models and workflow graphs in the Tryton client.

# pkg install graphviz

Install the hgnested python package, required for Tryton development (hgnested is an extension for the mercurial DVCS, installing hgnested will also install mercurial).

# pip install hgnested

Install the Python pydot package, the Python interface to Graphviz.

# pip install pydot

Install the Python psycopg2 package, the Python interface to PostgreSQL.

# pip install psycopg2

Install Tryton

Install trytond, the Trytond server daemon python package.

# pip install trytond

Update FreeBSD periodic databases

I don’t know if installing packages triggers the periodic databases to update, but since I often don’t run a virtual machine long enough to cross day, week or month boundaries (when they update automatically), I typically manually update them after major system changes.

# periodic daily
# periodic weekly
# periodic monthly

Create a trytond system user

A “tryton” system user is created to execute the trytond daemen. The tryton user home directory (/home/tryton) created will be configured as the root of the Tryton file system for storing document attachments.

root@casper:~ # adduser
Username: tryton
Full name: trytond system user
Uid (Leave empty for default):
Login group [tryton]:
Login group is tryton. Invite tryton into other groups? []:
Login class [default]:
Shell (sh csh tcsh bash rbash nologin) [sh]:
Home directory [/home/tryton]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]: no
Username   : tryton
Password   : <disabled>
Full Name  : tryton system user
Uid        : 1002
Class      :
Groups     : tryton
Home       : /home/tryton
Home Mode  :
Shell      : /bin/sh
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (tryton) to the user database.
Add another user? (yes/no): no

Create a Tryton log directory

# mkdir /var/log/trytond
# chown -R tryton:tryton /var/log/trytond

Create a json-rpc data directory

# mkdir /var/run/trytond
# chown -R tryton:tryton /var/log/trytond

Create and edit trytond.conf

trytond.conf contains configuration parameters read by the Tryton server daemon trytond when it starts, and includes such site-specific data as:

  • computer addresses to respond to (jsonrpc).
  • username and password for the PostgreSQL “tryton” super-user.
  • Tryton “administrator” password (required to create, drop, backup or restore a database).
  • specify FreeBSD-specific directory paths

Unfortunately, the pip install for trytond currently does not copy trytond.conf to a suitable location (or any location). Download the trytond server distribution from PyPi, extract and copy trytond/etc/trytond.conf to /usr/local/etc/trytond.conf.

Edit parameters in /usr/local/etc/trytond.conf using the following as reference:

jsonrpc = *:8000,
jsondata_path = /var/run/trytond

db_type = postgresql
db_host = localhost
db_port = 5432
db_user = tryton
db_password = appleton

admin_passwd = appleton

pidfile = /var/run/trytond/
logfile = /var/log/trytond/trytond.log

data_path = /home/tryton

Install Tryton modules onto the server

In this context, installing Tryton modules means installing modules onto the server from their remote repositories. This makes them available for use in a Tryton database.

Install the following modules using pip. Some modules will be installed as dependencies of others, so do not be concerned if pip reports a module has already been installed.

# pip install trytond_company
# pip install trytond_dashboard
# pip install trytond_product
# pip install trytond_product_attribute
# pip install trytond_production
# pip install trytond_project
# pip install trytond_project_plan
# pip install trytond_purchase
# pip install trytond_sale
# pip install trytond_stock
# pip install trytond_stock_lot
# pip install trytond_stock_split

Start trytond

You can start trytond as root from the command line:

/usr/local/bin/trytond -c /usr/local/etc/trytond.conf &

However, I would prefer to create an rc.d startup script so that tryton starts automatically after booting. I’m using a basic rc.d startup script created by Christoph Larsen for the GNU Health project, which also uses the Tryton framework. It doesn’t support status, but will do for now. Copy the following code to /usr/local/etc/rc.d/trytond


# PROVIDE: trytond
# Created by: Christoph H. Larsen

. /etc/rc.subr


load_rc_config $name

: ${trytond_enable="NO"}
: ${trytond_user="tryton"}
: ${trytond_group="tryton"}



trytond_start() {
  su tryton -c "$command --config=/usr/local/etc/trytond.conf" &

trytond_stop() {
if [ -f /var/run/${name}/${name}.pid ]; then
  kill `cat /var/run/${name}/${name}.pid`

trytond_restart() {
  if [ -f /var/run/${name}/${name}.pid ]; then
  kill `cat /var/run/${name}/${name}.pid`
  sleep 1
  su tryton -c "$command --config=/usr/local/etc/trytond.conf" &

run_rc_command "$1"

Make /usr/local/etc/rc.d/trytond executable

# chmod u+x /usr/local/etc/rc.d/trytond

Add trytond_enable to /etc/rc.conf

# echo "trytond_enable=YES" >> /etc/rc.conf

Start trytond

# /usr/local/etc/rc.d/trytond start

Create and configure a new Tryton database

Download and install the Tryton desktop client for your system. Launch the Tryton client and access menu: File > Databases > New database.

Enter the Tryton server admin password (“admin_passwd” in trytond.conf) in the password field, then click Change beside the IP address and change the address to that of your server.

You must enter the password first, before changing the server address, because the Tryton client will attempt to connect to the server immediately after the server address is changed, and will report “Unable to connect” if the admin password was not already entered.

Enter the name of the database to create (e.g. “scc”) and the admin password for the database, then click Create.

Login to the new database as user “admin” and the password you entered to create the database. The Module Configuration Wizard will run automatically after login to configure the new database.

  • Add user (e.g. “Dale Scott”, login “dale”), optionally add permissions (you may need to update user permissions after installing modules, so this is optional at this point),
    • add Permissions: “Administration” (which will be the only permission group available)
    • add Rule: Read, Write, Create, Delete, Model: View Search (which will be the only rule available available)

Install Tryton modules into the database

Mark modules for install

The Tryton modules previously installed to the server will not be installed in a Tryton database.

In the Tryton client, access the menu: Administration > Modules > Modules. Mark the following modules for install (double-click in the Mark for Install column):

  • dashboard
  • product
  • product-attribute
  • production
  • project
  • project-plan
  • purchase
  • sale
  • stock
  • stock-lot
  • stock-split

Install marked modules

There are two ways to install the marked modules, you can either:

  • Select Launch Action icon in the Modules menu bar and then Perform Pending Installation/Upgrade, or
  • Execute the Perform Pending Installation/Upgrade Wizard from the main Tryton menu.

After the install/upgrade completes, the Module Configuration wizard runs and will query you to configure the installed modules.

Create a Company

A company is a type of ‘party’. To identify a party as a company in a new database you must first create a new party, then select it as the new company.

  • Name
    • Swift Construction Company
  • Addresses
    • Name: Default
    • Street: 1 Swift Way
    • Zip: 13054
    • City: Shopton
    • Country: United States
    • Subdivision: New York
  • Language
    • English

Configure Company

  • Enter Company > Currency
    • US Dollar
  • On the Company > Employees > Party view
    • select the new company (e.g. Swift Construction Company)
    • select Add

Create Chart of Accounts

  • Company: Swift Construction Company
  • Account Template: Minimal Account Chart
  • Create Default Properties
    • Default Receivable Account: Main Receivable
    • Default Payable Account: Main Payable

You will need to reload the menu in the Tryton client if it isn’t now displaying menu choices for the new modules (i.e. access menu: User > Menu Reload (Ctrl-T).

The Tryton server has been installed and you can connect to it from a Tryton client. You have also created a new Tryton database with the modules necessary to implement Maestro workflows.


5 thoughts on “Installing Tryton server on FreeBSD

  1. tray


    Did you consider using virtualenv?
    I think you have done a good job of documenting the major steps so far.

    Tryton documentation needs developing so I suggest that your works to date is of reasonable value to the project.

    Keep up the comments / blog, it helps us all.

    1. dale Post author

      Thanks Tray. I have “used” virtualenv, but only in a workshop – and I was just typing what was on the screen. It’s something I need to learn more about though. I’ve had less time lately (I’m rebuilding the production server at the office to run Tryton), but hope to finish the install and config part of the tutorial in a week or two.

  2. Mark S Hayden

    Hi Dale, did not know you were a “local” guy working with Tryton (I’m Calgary-based too)! I started using Tryton almost 2 years ago now internally as well as for a side project, and there are some possible opportunities I am looking into for a couple of additional projects. The Tryton community is mostly overseas but very helpful and knowledgeable.

    I would have to second Tray’s suggestion. Installing in a virtualenv is my preferred method of implementing Tryton, specially on the server side. It has some advantages similar to any otehr form of virtualization–two installs of different versions could run concurrently, you don’t have to worry about dependencies being broken, easy to back up ad restore or rollback a failed upgrade and so on.

    Let me know if you are interested in a local resource for collaborating on Tryton related projects!

    1. dale Post author

      Hi Mark, it’s great to know someone working with Tryton in Canada, let alone in Calgary! virtuanenv is definitely something I want to understand. I’ll email you privately about collaborating.

  3. Dale

    Update: things are not working. I updated a FreeBSD-10 vm using freebsd-update fetch/install, pkg upgrade, and then the following to update everything that had been installed using pip:

    > pip freeze –local | grep -v ‘^\-e’ | cut -d = -f 1 | xargs pip install -U

    Now the server won’t start (“trytond module not found” error out of the /usr/local/bin/trytond script. I’m seeing how a fresh install goes in Ubuntu before getting back to this.

    Update again. I had to rebuild the server from scratch, freebsd-update, then install tryton (using virtualenv no less).


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>