Installing Tryton server on FreeBSD

This article is part of a series on the Tryton framework, to complement the Maestro project on GitHub. This article describes installing trytond, the Tryton server daemon, on FreeBSD.

Create a new server

I will be building a virtual server using VirtualBox on Windows 7, and later transfer the virtual server to a physical server using dump/restore, but these instructions generally apply to any installation.

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:

  • 1G RAM (host should have at least 4G)
  • may need to disable VT-x/AMD-V 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 TCP port 8000 for Tryton, 22 for ssh and 5432 for PostgreSQL).

Install 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 trytond dependencies

Install the Python 2.7 package manager “pip” (Tryton does not support Python v3, although it is being worked on by the Tryton project team). Pkg will install Python and any other dependencies required by pip, pip will be used to install Tryton Python package dependencies.

# pkg install py27-pip

Install FreeBSD package dependencies.

# pkg install libxml2
# pkg install libxslt
# pkg install py27-ldap2

py27-ldap2 is required for eventual user login authentication using an LDAP server.

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

# pkg install graphviz

Install the python virtualenv and virtualenvwrapper utilities using pip. virtualenv is a tool to create isolated Python environments. Its most basic use case is to easily create and tear down a trytond install without affecting other applications on the server. The more advanced use case is to support multiple versions of python, trytond and trytond modules for development and testing, without undesirable interactions with other server software.

# pip install virtualenv
# pip install virtualenvwrapper

I won’t be using virtualenv initially, but want it available for future use.

Some good virtualenv references I found:


Install the python hgnested package using pip. hgnested is a Mercurial DVCS add-on required for Tryton development, and will install mercurial as a dependency.

# 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 trytond

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 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 the default trytond.conf file in the package to a suitable location (or rather, to 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

Create tryton rc script

An rc.d script will be created to manage starting and stopping trytond, and to start trytond after booting. I’m using a basic rc.d startup script created by Christoph Larsen for the GNU Health project, and added support for status reporting. Copy the following code to /usr/local/etc/rc.d/trytond


# PROVIDE: trytond
# Originally 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

Install trytond and Tryton modules

trytond is the Trytond server daemon. I’ll use pip to install the latest release version of trytond.

# pip install trytond

In this context, installing Tryton modules means to install a module’s code onto the server from its source repository, which makes it available to 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

I will eventually configure Tryton to authenticate users using an OpenLDAP server, and will install the necessary Tryton LDAP modules now.

# pip install trytond_ldap_connection
# pip install trytond_ldap_authentication

Start trytond

Start trytond using the rc script:

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

Once started, you can check if trytond is running with the status option:

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

or stop the server if needed:

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

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.


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


7 thoughts on “Installing Tryton server on FreeBSD

  1. Hi,

    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. 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. 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. 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. 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).

  4. I’m curious about Tryton installation on Linux. I gather they’d be slightly different than for FreeBSD. Do any of the previous posters have information on that? I will also check Dale’s email.


Leave a Reply

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