How to install ERPNext on FreeBSD

This article was written for ERPNext 2012.05.04 and FreeBSD 9.0. It is based on How to Install ERPNext by Sudev KK.

Pre-requisites

 * Basic FreeBSD server (Apache and MySQL will be used from a PHP web application stack if installed, but PHP is not required). See How to build a FreeBSD server, the following references may also be useful:
 * The FreeBSD Handbook by the FreeBSD Project ("The Handbook"),
 * Bulding a Server with FreeBSD 7 by Bryan Hong ("Hong"),
 * Absolute FreeBSD by Michael Lucas ("Lucas"),


 * Other requirements:
 * Python 2.6+ (3+ is not supported) (e.g. python27-2.7.2_4)
 * Apache 2+ (e.g. apache-2.2.22_5)
 * MySQL 5+ (e.g. mysql-server-5.5.16)
 * git (e.g. git-1.7.9.6)
 * gunzip (used to extract SQL file for creating database, included in FreeBSD base system)
 * python MySQLdb (e.g. py27-MySQLdb-1.2.3_1)
 * pytz (e.g. py27-pytz-2012c)
 * jinja2 (e.g. py27-Jinja2-2.6)
 * markdown2 (e.g., py27-markdown2-1.4.0)
 * dateutil (e.g. py27-dateutil-1.5)

Install Procedure

 * Change to the directory where ERPNext will be installed (the directory will need to be accessible to the Apache server)


 * 1) cd /usr/local/www/


 * Clone the master ERPNext Github repository into the erpnext/ directory


 * 1) git clone git://github.com/webnotes/erpnext.git


 * Change to the erpnext directory and clone the wnframework Github repository into the lib/ directory


 * 1) cd erpnext/
 * 2) git clone git://github.com/webnotes/wnframework.git lib


 * Create the logs/ directory and an empty error log file


 * 1) mkdir logs/
 * 2) touch ./logs/error_log.txt


 * Create and edit the configuration parameter file (see example, and note full pathnames are required)


 * 1) cd ./lib/py/webnotes/
 * 2) cp defs_template.py defs.py
 * 3) vi defs.py


 * Extract the database install sql file


 * 1) cd /usr/local/www/erpnext/
 * 2) gunzip ./data/master.sql.gz


 * Install the ERPNext database
 * ./wnf.py --install {mysql_root_password} {new_db_name} data/master.sql
 * ./wnf.py -d {new_db_name} --sync_with_gateway 0 (This step will get deprecated very soon)
 * ./wnf.py -d {new_db_name} -l (Runs the latest patches on the database)


 * 1) ./wnf.py --install mysqlrootpassword erpnext data/master.sql
 * 2) ./wnf.py -d erpnext --sync_with_gateway 0
 * 3) ./wnf.py -d erpnext -l


 * Create the erpnext_files directory and set the owner to the Apache user


 * 1) mkdir /usr/local/www/erpnext_files
 * 2) chown -R www:www /usr/local/www/erpnext_files


 * Create erpnext.conf Apache configuration file for ERPNext (see example) and restart Apache


 * 1) vi /usr/local/etc/apache22/Includes/erpnext.conf
 * 2) /usr/local/etc/rc.d/apache22 restart


 * Access ERPNext at URL http://www.server.dom/erpnext using a web browser, and login as user "Administrator" with password "admin"

Minimum Parameter Requirements in defs.py
These are minimum settings required to get you started, and paths should be accessible by the Apache server.

default_db_name = '{new_db_name}' db_password = '{mysql_root_password}' files_path = '{full path to a folder where attachments should be saved}' modules_path = '{full path to erpnext}/erpnext/' log_file_name = '{full path to erpnext}/logs/error_log.txt'

Example erpnext.conf Apache Configuration File
 ServerName * DocumentRoot {full path to erpnext folder}/ AddHandler cgi-script .cgi .xml Options -Indexes +FollowSymLinks +ExecCGI RewriteEngine on   RewriteRule \.py - [F] ## uncomment below lines if required #Order allow,deny #Allow from all DirectoryIndex index.html index.cgi 