Support #549
Setting Up Trytond on FreeBSD
Status:
Suspended
Priority:
Normal
Assignee:
Category:
Accounting Server
Target version:
Description
This is a simple guide on setting up a Trytond server on FreeBSD 9.2.
- Update packages and ports tree:
pkg update && pkg upgrade portsnap fetch extract
Install MariaDB server¶
- Start by installing the mariadb-server and mariadb-client packages:
pkg install mariadb55-{server,client}
Configure MariaDB server¶
- Copy a base MariaDB configuration to use
cp /usr/local/share/mysql/my-small.cnf /var/db/mysql/my.cnf
- Tuning: Copy one of the default config files and change the max packet size:
vi /var/db/mysql/my.cnf
- and modify
max_allowed_packet
to 32Mmax_allowed_packet = 32M
- and modify
- Enable and start MariaDB
echo 'mysql_enable="YES"' >> /etc/rc.conf service mysql-server start
- Prepare Database for use by running the secure installation. Choose a root password and answer yes to all questions.
mysql_secure_installation
Create MariaDB Databases and Users¶
- Login to MariaDB and create appropriate databases and users.
mysql -u root -p
- and run the following SQL queries to create the trytond database and user:
CREATE DATABASE trytond CHARACTER SET utf8; CREATE USER 'trytond'@'127.0.0.1' IDENTIFIED BY 'SecretSecretPassword'; GRANT ALL PRIVILEGES ON trytond.* TO 'trytond'@'127.0.0.1'; flush privileges;
- and run the following SQL queries to create the trytond database and user:
Create Trytond Database Scheme¶
- Log into mysql and switch the trytond database:
mysql -u root -p USE trytond;
- And add the following:
CREATE TABLE ir_configuration ( id BIGINT AUTO_INCREMENT NOT NULL, language VARCHAR(255), PRIMARY KEY(id) ) ENGINE=InnoDB; CREATE TABLE ir_model ( id BIGINT AUTO_INCREMENT NOT NULL, model VARCHAR(255) NOT NULL, name VARCHAR(255), info TEXT, module VARCHAR(255), PRIMARY KEY(id) ) ENGINE=InnoDB; CREATE TABLE ir_model_field ( id BIGINT AUTO_INCREMENT NOT NULL, model BIGINT, name VARCHAR(255) NOT NULL, relation VARCHAR(255), field_description VARCHAR(255), ttype VARCHAR(255), help VARCHAR(255), module VARCHAR(255), PRIMARY KEY(id), CONSTRAINT ir_model_field_model_fkey FOREIGN KEY (model) REFERENCES ir_model (id) ON DELETE CASCADE ) ENGINE=InnoDB; CREATE TABLE ir_ui_view ( id BIGINT AUTO_INCREMENT NOT NULL, model VARCHAR(255) NOT NULL, type VARCHAR(255), data TEXT NOT NULL, field_childs VARCHAR(255), priority BIGINT NOT NULL default 0, PRIMARY KEY(id) ) ENGINE=InnoDB; CREATE TABLE ir_ui_menu ( id BIGINT AUTO_INCREMENT NOT NULL, parent BIGINT, name VARCHAR(255) NOT NULL, icon VARCHAR(255), PRIMARY KEY (id), CONSTRAINT ir_ui_menu_parent_fkey FOREIGN KEY (parent) REFERENCES ir_ui_menu (id) ON DELETE SET NULL ) ENGINE=InnoDB; CREATE TABLE ir_translation ( id BIGINT AUTO_INCREMENT NOT NULL, lang VARCHAR(255), src TEXT, src_md5 VARCHAR(32) NOT NULL, name VARCHAR(255) NOT NULL, res_id BIGINT, value TEXT, type VARCHAR(255), module VARCHAR(255), fuzzy BOOLEAN NOT NULL, PRIMARY KEY(id) ) ENGINE=InnoDB; CREATE TABLE ir_lang ( id BIGINT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, code TEXT NOT NULL, translatable BOOLEAN NOT NULL, active BOOLEAN NOT NULL, direction VARCHAR(255) NOT NULL, PRIMARY KEY(id) ) ENGINE=InnoDB; CREATE TABLE res_user ( id BIGINT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, active BOOLEAN NOT NULL, login VARCHAR(255) NOT NULL, password VARCHAR(40), PRIMARY KEY(id) ) ENGINE=InnoDB; ALTER TABLE res_user ADD CONSTRAINT res_user_login_uniq UNIQUE (login); INSERT INTO res_user (id, login, password, name, active) VALUES (0, 'root', NULL, 'Root', False); UPDATE res_user set id = 0; ALTER TABLE res_user AUTO_INCREMENT = 1; CREATE TABLE res_group ( id BIGINT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id) ) ENGINE=InnoDB; CREATE TABLE `res_user-res_group` ( `user` BIGINT NOT NULL, `group` BIGINT NOT NULL, CONSTRAINT `res_user-res_group_user_fkey` FOREIGN KEY (`user`) REFERENCES res_user (id) ON DELETE CASCADE, CONSTRAINT `res_user-res_group_group_fkey` FOREIGN KEY (`group`) REFERENCES res_group (id) ON DELETE CASCADE ) ENGINE=InnoDB; CREATE TABLE ir_module_module ( id BIGINT AUTO_INCREMENT NOT NULL, create_uid BIGINT, create_date TIMESTAMP NOT NULL, write_date TIMESTAMP NULL, write_uid BIGINT, name VARCHAR(255) NOT NULL, state VARCHAR(255), PRIMARY KEY(id), CONSTRAINT ir_module_module_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES res_user (id) ON DELETE SET NULL, CONSTRAINT ir_module_module_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES res_user (id) ON DELETE SET NULL ) ENGINE=InnoDB; ALTER TABLE ir_module_module ADD CONSTRAINT name_uniq UNIQUE (name); CREATE TABLE ir_module_module_dependency ( id BIGINT AUTO_INCREMENT NOT NULL, create_uid BIGINT, create_date TIMESTAMP NOT NULL, write_date TIMESTAMP NULL, write_uid BIGINT, name VARCHAR(255), module BIGINT, PRIMARY KEY(id), CONSTRAINT ir_module_module_dependency_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES res_user (id) ON DELETE SET NULL, CONSTRAINT ir_module_module_dependency_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES res_user (id) ON DELETE SET NULL, CONSTRAINT ir_module_module_dependency_module_fkey FOREIGN KEY (module) REFERENCES ir_module_module (id) ON DELETE CASCADE ) ENGINE=InnoDB;
- And add the following:
Install Trytond¶
- Install Trytond
pkg install trytond28
- Install Tryton modules:
pkg install trytond28_account trytond28_account_asset trytond28_account_be trytond28_account_invoice trytond28_account_invoice_history trytond28_account_invoice_line_standalone trytond28_account_product trytond28_account_statement trytond28_account_stock_anglo_saxon trytond28_account_stock_continental trytond28_analytic_account trytond28_analytic_invoice trytond28_analytic_purchase trytond28_analytic_sale trytond28_calendar trytond28_calendar_classification trytond28_calendar_scheduling trytond28_calendar_todo trytond28_carrier trytond28_carrier_percentage trytond28_carrier_weight trytond28_company trytond28_company_work_time trytond28_country trytond28_currency trytond28_dashboard trytond28_google_maps trytond28_ldap_authentication trytond28_ldap_connection trytond28_party trytond28_party_siret trytond28_party_vcarddav trytond28_product trytond28_product_attribute trytond28_product_cost_fifo trytond28_product_cost_history trytond28_product_measurements trytond28_product_price_list trytond28_production trytond28_project trytond28_project_invoice trytond28_project_plan trytond28_project_revenue trytond28_purchase trytond28_purchase_invoice_line_standalone trytond28_purchase_shipment_cost trytond28_sale trytond28_sale_opportunity trytond28_sale_price_list trytond28_sale_shipment_cost trytond28_sale_supply trytond28_sale_supply_drop_shipment trytond28_stock trytond28_stock_forecast trytond28_stock_inventory_location trytond28_stock_location_sequence trytond28_stock_lot trytond28_stock_product_location trytond28_stock_split trytond28_stock_supply trytond28_stock_supply_day trytond28_stock_supply_forecast trytond28_stock_supply_production trytond28_timesheet
- Install py27-MySQLdb from ports:
cd /usr/ports/databases/py-MySQLdb make install clean
NOTE: This package must be installed from ports or else the mariadb55-client package will be overwritten by the mysql55-client package.
Configure Trytond¶
- Edit the Trytond configuration file
vi /usr/local/etc/trytond.conf
- Add/Modify the following:
jsonrpc = trytond.exmaple.com:8000 db_type = mysql db_host = 127.0.0.1 db_port = 3306 db_user = trytond db_password = SuperSecretPassword admin_passwd = SecretPassword
- Add/Modify the following:
- Enable Trytond to start at boot:
echo 'trytond_enable="YES"' >> /etc/rc.conf
- Start Trytond:
service trytond start