How to install Tryton ERP on Ubuntu 18.10


#1
  1. Install pip3

apt instapp python3-pip

If got error with pip3 install run de following command:

sudo python -m pip uninstall pip && sudo apt install python-pip --reinstall
sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall
  1. Install Tryton dependency package via pip3
pip3 install Werkzeug wrapt lxml relatorio Genshi python-dateutil polib python-sql passlib psycopg2 pydot sphinx python-Levenshtein bcrypt html2text
  1. Install Tryton

sudo adduser --system --quiet --shell=/bin/bash --gecos ‘trytond’ --group trytond

sudo adduser trytond sudo

pip install trytond
pip install tryton
pip install trytond_module_name

  1. Install SAO

git clone https://github.com/tryton/sao.git

apt install npm

npm install --production

sudo npm install -g grunt-cli

grunt

npm install -g bower

sudo bower install --allow-root

mkdir /etc/tryton

vi /etc/tryton/trytond.conf

[web]
listen=0.0.0.0:8000
root = /home/XXX/sao
hostname = XXX.gimitec.com

[database]
# uri = database://username:password@host:port/
uri=postgresql://tryton:PASSWORD@127.0.0.1:5432/tryton
path = /home/xxx/
[jsonrpc]
# Settings for the JSON-RPC network interface
data=/home/xxx/sao[web]
listen=0.0.0.0:8000
root = /home/yoda/sao
hostname = xxx.gimitec.com

trytond-admin -c /etc/tryton/trytond.conf -d DATABASE NAME --all

Start Trytond server ( for test)

trytond -c /etc/tryton/trytond.conf

http://docs.tryton.org/projects/server/en/latest/topics/setup_database.html

  1. Install Tryton module:

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

  1. Start trytond at boot
    https://www.apt-browse.org/browse/ubuntu/trusty/universe/all/tryton-server/3.0.2-1/file/etc/init.d/tryton-server
    or
    http://debian.tryton.org/gitweb/?p=packages/tryton-server.git;a=blob_plain;f=debian/tryton-server.init;hb=HEAD

vi /etc/init.d/trytond

add below line to trytond file

#!/bin/sh
### BEGIN INIT INFO
# Provides: trytond
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Enterprise Business Applications
# Description: Business Applications
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
DAEMON=/usr/local/bin/trytond
NAME=trytond
DESC=trytond
# Specify the user name (Default: trytond).
USER=trytond
# Specify an alternate config file
CONFIGFILE="/etc/tryton/trytond.conf"
# pidfile
PIDFILE=/var/run/${NAME}.pid
# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"
[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}
case "${1}" in
start)
echo -n "Starting ${DESC}: "
start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER --background --make-pidfile --exec $DAEMON -- $DAEMON_OPTS
echo "${NAME}."
;;
stop)
echo -n "Stopping ${DESC}: "
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
echo "${NAME}."
;;
restart|force-reload)
echo -n "Restarting ${DESC}: "
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
sleep 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER --background --make-pidfile --exec $DAEMON -- $DAEMON_OPTS
echo "${NAME}."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0


update-rc.d tryton defaults


#2

The way is

sudo pip3 install trytond --upgrade

sudo pip3 install tryton --upgrade

or in short

sudo pip install [package_name] -U

sudo will ask to enter your root password to confirm the action.

If you do not have a root password (if you are not the admin) you should probably work with virtualenv and then you should drop the sudo :

pip install [package_name] --upgrade

#3
pip3 install trytond_account trytond_account_payment_sepa trytond_account_product trytond_sale_price_list trytond_account_dunning trytond_currency trytond_purchase_request trytond_sale trytond_sale_supply trytond_stock_supply trytond_account_invoice trytond_account_statement trytond_sale_subscription trytond_stock trytond_production_work_timesheet trytond_stock_package_shipping_ups trytond_stock_package_shipping_dpd trytond_production_work trytond-production-outsourcing trytond_stock_package_shipping trytond_production_routing trytond_carrier_weight trytond_carrier_percentage trytond_account_tax_rule_country trytond_stock_supply_production trytond_stock_supply_forecast  trytond_stock_location_move trytond_stock_consignment trytond_sale_supply_drop_shipment trytond_sale_stock_quantity trytond_sale_shipment_cost trytond-sale-promotion-coupon trytond_sale_advance_payment trytond_analytic_sale trytond_analytic_purchase trytond-sale-subscription-asset trytond_sale_promotion trytond_sale_extra trytond_purchase_requisition trytond-purchase-request-quotation trytond_project_invoice trytond_product_price_list_dates trytond_commission_waiting trytond_analytic_invoice trytond_account_payment_sepa_cfonb trytond_stock_supply_day trytond_sale_shipment_tolerance trytond_sale_shipment_grouping trytond_sale_payment trytond_sale_opportunity trytond_sale_invoice_grouping trytond_sale_credit_limit trytond_sale_complaint trytond_purchase_shipment_cost trytond_purchase_invoice_line_standalone trytond_project_revenue trytond_commission trytond_account_asset trytond_purchase trytond_account_stock_landed_cost_weight trytond_account_stock_anglo_saxon trytond-account-statement-ofx trytond_account_statement_coda trytond-account-statement-aeb43 trytond_account_payment_stripe trytond_account_payment_clearing trytond-account-fr-chorus trytond_account_be trytond_stock_shipment_measurements trytond_stock_product_location trytond-stock-lot-unit trytond_stock_lot_sled trytond_project_plan trytond_production_split trytond-edocument-uncefact trytond-account-tax-cash trytond_account_stock_landed_cost trytond_account_payment trytond_account_invoice_stock trytond_account_invoice_line_standalone trytond_account_invoice_history trytond_account_invoice_correction trytond_account_fr trytond_account_eu trytond_account_dunning_fee trytond_account_dunning_email trytond_account_deposit trytond_timesheet_cost trytond_stock_split trytond_stock_package trytond_stock_lot trytond_stock_location_sequence trytond_stock_inventory_location trytond_stock_forecast trytond_project trytond_production trytond-product-price-list-parent trytond_product_cost_fifo trytond_product_classification_taxonomic trytond_account_stock_continental trytond_account_dunning_letter trytond_account_credit_limit trytond_timesheet trytond_product_price_list trytond_product_measurements trytond_product_cost_history trytond_product_classification trytond_product_attribute trytond-edocument-unece trytond_customs trytond_carrier trytond_analytic_account trytond_product trytond_notification_email trytond_company_work_time trytond_web_user trytond_party_siret trytond_party_relationship trytond_google_maps trytond_company trytond_bank trytond_party trytond_ldap_authentication trytond_dashboard trytond_country trytond_authentication_sms trytond-gis --upgrade

trytond-admin -c <config file> -d <database name> --update-modules-list


#4

apt install nginx

apt start nginx

apt enable nginx

vi /etc/nginx/conf.d/trytond.conf

#
# this is the nginx config for trytond
#

upstream trytond {
    server localhost:8000;
}


server {

    # replace 'localhost' with your fqdn if you want to use trytond from remote
    server_name XXX.gimitec.com;

    root /home/XXX/sao;

    access_log /var/log/nginx/trytond.access.log;
    error_log  /var/log/nginx/trytond.error.log;

    client_max_body_size 500M;

    location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico) {
        expires max;
    }    

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header CLIENT_IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 300;
        proxy_pass http://trytond;

        gzip on;
        gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
        gzip_proxied any;
    }

}


nginx -t

systemctl restart nginx

Install certbot

Install
On Ubuntu systems, the Certbot team maintains a PPA. You can add it to your list of repositories and install Certbot by running the following commands.

$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository universe
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
$ sudo apt-get install python-certbot-nginx 
Certbot's DNS plugins are also available for your system which can be used to automate obtaining a wildcard certificate from Let's Encrypt's ACMEv2 server. To use one of these plugins, you must have configured DNS for the domain you want to obtain a certificate for with a DNS provider that Certbot has a plugin for. A list of these plugins and more information about using them can be found here. To install one of these plugins, run the installation command above but replace python-certbot-nginx with the name of the DNS plugin you want to install.

Get Started
Certbot has an Nginx plugin, which is supported on many platforms, and automates certificate installation.

$ sudo certbot --nginx
Running this command will get a certificate for you and have Certbot edit your Nginx configuration automatically to serve it. If you're feeling more conservative and would like to make the changes to your Nginx configuration by hand, you can use the certonly subcommand:

$ sudo certbot --nginx certonly


#5
sudo apt-get autoremove
sudo apt-get --purge remove && sudo apt-get autoclean
sudo apt-get -f install
sudo apt-get update
sudo apt-get upgrade && sudo apt-get dist-upgrade
sudo dpkg-reconfigure -a
sudo dpkg --configure -a