In this tutorial I will install Tryton. Tryton is open source business software of the type popularly known as ERP (Enterprise Resource Plannning). ERP is often considered accounting or finance software, but this is only one function.
The real value of ERP software is achieved when it is used to share information and manage business processes within an organization as a whole, including engineering product development and product lifecycle management (PLM), supply chain, purchasing, and inventory control, manufacturing and material requirements planning (MRP), sales planning and customer relationship management (CRM).
Tryton follows a three-tier architecture model consisting of:
- The Presentation Tier
- tryton, the Tryton desktop client for Windows, Mac OS or Linux.
- sao, the Tryton web client (also known as the Tryton web site).
- The Application Tier
- trytond, the Tryton server daemon.
- The Data Tier
- SQLite, for development testing, or
- PostgreSQL, for production use.
Install FreeBSD 13
Install FreeBSD 13 using suitable media and perform typical initial configuration. Create an initial admin user in the install wizard and include them in the wheel group.
After booting into the new system and logging in as the admin user, copy a public ssh key for the admin user to ~/.ssh/authorized_keys and disable ssh password authentication in /etc/ssh/sshd_config for security.
% su - # vi /etc/ssh/sshd_config ... # Change to no to disable PAM authentication ChallengeResponseAuthentication no ... # service sshd restart
Update FreeBSD and package manager database for third-party software (when FreeBSD is first installed pkg is a shim, when run it will first install the current version of pkg).
# freebsd-update fetch # freebsd-update install # pkg update
Install sudo for more convenient system administration instead of having to “su” to root.
# pkg install sudo
Configure sudo to allow the admin user (and all other members of the wheel group) to allow use without needing to enter a password for convenience (reasonable on a small system).
# visudo ... ## Uncomment to allow members of group wheel to execute any command # %wheel ALL=(ALL) ALL ## Same thing without a password %wheel ALL=(ALL) NOPASSWD: ALL
Install tmux. tmux is a terminal multiplexer, which can also be used to detach processes from their controlling terminals, allowing remote sessions to remain active.
# sudo pkg install tmux
Install Python 3
From version 5.0, Tryton has used Python 3. Since Python is not included in the FreeBSD base system, it must be installed seperately.
Install the python3 package, which currently installs Python 3.8.
% sudo pkg install python3
Install py38-pip, the corresponding version of the Python package manager. pip will be used to install trytond and trytond modules from PyPI (the Python Package Index).
% sudo pkg install py38-pip
Install system dependencies
trytond requires libxml2, an XML C parser and toolkit, and libsxlt, an XSLT C library. Graphviz is a package of open-source tools for drawing graphs required by sao, the Tryton web client, which will be installed later in a seperate post.
% sudo pkg install libxml2 % sudo pkg install libxslt % sudo pkg install graphviz
bash (the Bourne Again SHell) is required to use Python’s built-in venv module, which will be used to create a virtual environment for executing trytond.
% sudo pkg install bash
Install SQLite
Tryton uses the SQLite database management system for development testing, and PostgreSQL for production operation. SQLite has few dependencies and is less complicated to use than PostgreSQL, and will be installed here for initial bring-up testing. PostgreSQL will be installed later for production use.
Install the Python SQLite package.
% sudo pkg install py38-sqlite3
Install trytond
For production use, best practices would indicate a dedicated user should be created for executing trytond, and the users’ home directory used to install trytond and for storing document attachments. However, for simplicity a normal user and home directory will be used.
Create a directory for installing trytond in.
% sudo mkdir -p ~/work/trytond
Create a virtual environment for executing trytond.
% cd ~/work/trytond % bash $ python3 -m venv env $ source env/bin/activate (env) [~/work/trytond]$
Install trytond using pip.
(env) [~/work/trytond]$ pip install trytond
Install the trytond-product module which will provide the basic functionality needed to create products (part numbers or sku’s).
(env) [~/work/trytond]$ pip install trytond-product
trytond modules can have dependencies, which will also installed when a module is installed. To see all the trytond modules which have been installed, use pip to list installed modules and grep for trydond.
(env) [~/work/trytond]$ pip list | grep trytond trytond 6.2.3 trytond-company 6.2.0 trytond-country 6.2.0 trytond-currency 6.2.0 trytond-party 6.2.0 trytond-product 6.2.0 (env) [~/work/trytond]$
You can search PiPY for Tryton Framework modules. Refine the search with “trytond” in the search field and sort the results by last updated to list core modules at the top.
trytond reads a trytond.conf configuration file to set operating conditions. trytond has built-in defaults which will configure using a local SQLite database and allow client access from the local system. I will use SQLite for initial bring-up testing, but will use a remote client for access.
By default, trytond will only listen to the local system for connections. To allow connecting from a remote system, create ~/work/trytond/trytond.conf with the following content:
[web] listen=0.0.0.0:8000
By default, trytond will use an SQLite database which is convenient for developers. Also by default, trytond will expect the database to be found in ~/db/.
Create an empty SQLite database file,
% mkdir ~/db % touch ~/db/test_db.sqlite
and then initialize the database using trytond-admin. tryton-admin will prompt for a password for the initial admin user which it will enter in the database. The password will be used later to login using the Tryton client as user admin.
(env) dale@starlord:~/work/trytond$ env/bin/trytond-admin -c ./trytond.conf -d test_db --all "admin" email for "test_db": dale@dalescott.net "admin" password for "test_db": "admin" password confirmation: (env) dale@starlord:~/work/trytond$
Start trytond
Start tmux, which will allow trytond to be started and remain running if the ssh connection or login is broken, and all the shell actity while the connection was broken can still be seen after re-connecting.
(env) dale@starlord:~/work/trytond$ tmux
trytond listens on port 8000, ensure the port is open and or forwarded if you are using a virtual machine.
Start trytond.
(env) dale@starlord:~/work/trytond$ env/bin/trytond -c ./trytond.conf -d test_db 25690 34374492160 [2022-01-19 20:16:19,365] WARNING werkzeug * Running on all addresses. WARNING: This is a development server. Do not use it in a production deployment. 25690 34374492160 [2022-01-19 20:16:19,366] INFO werkzeug * Running on http://10.0.2.15:8000/ (Press CTRL+C to quit)
Connect using Tryton Desktop Client
Download the latest version of the desktop client from the Tryton project website. The latest version of the client must be used in this case because the latest version of trytond is was installed. The first two digits of the tryton version must be the same as the first two digits of the trytond version. In other words, if trytond is version 6.2.x then the tryton client must be version 6.2.x.
On a Windows system, download and install the latest version of the Windows desktop client, and run as typical. On a Linux system, download the source code for the latest version of tryton appropriate for the system, extract to a convenient location and execute …/bin/tryton.
After the Tryton desktop client starts,
click the Manage button to create a new profile to access the newly installed Tryton site. First click the “+” button to create a new profile, enter a name for the profile (the name is arbitrary) and then the host URL. The client will access the database and populate the drop down with available database names. In this case, test_db will be the only database available.
Select Close to return to the Login screen. If you didn’t enter the “admin” user in the profile, enter it now and select Connect. When prompted for the admin user password, enter the password provided to trytond-admin when the database was initialized.
After logging in, a wizard will lead you you through the interactive configuration, including activating the desired modules, define a company and adding users, which will be covered in a separate post.
Tryton Client Options
The Tryton client has several command switches that may be useful if debugging Tryton operation or developing Tryton modules.
tryton -d {-v} {-l [DEBUG | INFO | WARNING | ERROR | CRITICAL]}
-d development mode (disable client-side caching)
-v verbose
-l log level
Up and running on NomadBSD – 140R-20231121 (UFS). Seems ‘freebsd-update fetch’ – ‘freebsd-update install’ is a bad idea with Nomad – lucky I checked.
A lot of packages are already there – like tmux 3.3a, Python 3.9.18, libxml2, libxslt, graphviz & bash.
So – what I did:
sudo pkg install py39-pip
sudo pkg install py39-sqlite3
sudo python3 -m venv env
source env/bin/activate
sudo pip install trytond
# pip upgrade
sudo pip install –upgrade pip
sudo pip install trytond-product
etc..
Good to know – ‘deactivate’ gets you out of (env).
Got client running on Manjaro – though didn’t get any config wizard when first connected.
Seems strange having an ERP running on a memory stick 😉
Was keen to try this because at work – if we decide on Tryton – would be good to run on FreeBSD
‘Work’ is a charity that is keen to get away from a proprietary database ($$$). Have tried out Dolibarr and Odoo. We retail & so POS module is important. Dolibarr (TakePOS) is great while we found Odoo’s POS underwhelming. Also – got the impression that Odoo may be drifting away from FOSS. We’d go with Dolibarr if it was more easily configurable. ERPNext ticks all the boxes – if only it was an easy install. Very complex & I’m struggling. Don’t want to leave this charity with an ERP that even their outsourced IT support can’t understand and maintain.
Glad to hear you’re progressing with your trials (also intesting to hear comments on NomadBSD).
I’m curious how you handle POS with Tryton. The Tryton project provides the sale-point module (which I expect is an opinionated complete POS although I haven’t tried it), and the web-shop interface module with connectors to Shopify and Vue web stores (which I also haven’t tried). For other POS the expectation iiuc is that you would use the web-shop module and write your own connector. There also may be community-provided POS solutions available but I’m not familiar with any.
I haven’t gotten the impression that Odoo is drifting further away from FOSS since pivoting from the TinyERP business model to OpenERP (when Tryton was forked), before the name was changed to Odoo. The FOSS community version seems very much a part of the Odoo eco-system, although many enterprises will need at least some of the features only available in the proprietary license paid version. Also fwiw, Odoo do not seem to support upgrading the community version (only supporting upgrades for hosted paying clients). To me, this shows the community version is intended only as a short-term solution on the path to a paid proprietary license, and ERPNext seems to be adopting a similar strategy.
However Tryton has well-planned upgrades from one major/minor “series” to the next, which for me is a hard requirement.
Cheers,
Dale
Will be keen to try this with NomadBSD. Will let you know how I get on.
Have installed Tryton before on Kubuntu. I’m trying to make a comparison between Tryton and ERPNext for work. I wish installation instructions were this good for ERPNext …
Curious – where’s Nginx?
Glad you found the tutorial useful. It doesn’t include external systems because Werkzeug is already included as a dependency and is entirely satisfactory for testing and limited production. However, configuring a _robust_ production server is a different story, and should take into account the IT environment, usage (e.g. number of simultaneous users and static files), and the knowledge/skills of the sysadmin.
For a more representative production-orientated perspective, I recommend Edbo’s excellent tutorials Deploying Tryton with a Python virtual environment and Install Sao in a production environment.
Also, fwiw, technically I favor Tryton over Odoo, but you will be largely on your own to train your users, which means learning Tryton well enough yourself so you can train others (you might be able to contract some basic training from one of the project developers). Odoo has put considerable effort into simplifying the user experience, so if your users are novices wrt ERP and minimum training is your primary requirement, then Odoo might be the better choice. I’m in the process of writing Working with Tryton, a book on basic Tryton use, but unfortunately it won’t be ready until Spring 2024.
Please do let me know how you get along.
Cheers,
Dale
Many thanks, Dale.
Best, RF
Hi D.
Will this tutorial be valid for Ubuntu 22 (Kinetic Kudu). Thanks.
Best, RF
Hi RF, the concept will be the same for installing system dependencies, but package names and package manager commands will be slightly different (e.g. using apt instead of pkg). Installing trytond and Python dependencies, trytond and Tryton modules into the Python venv using pip wll probably be identical.
If you run into trouble, just ask for help on the Tryton forum.
Best wishes!
Dale