[docs] completed structure

This commit is contained in:
Rushabh Mehta 2013-06-21 17:55:43 +05:30
parent dfa9db86ba
commit a8f9aa0254
6 changed files with 460 additions and 0 deletions

View File

@ -0,0 +1,25 @@
---
{
"_label": "ERPNext Pre-requisites for Debian systems (Unbuntu)"
}
---
#### If not root user
`sudo su`
#### Installing Pre-Requisites
cd ~
apt-get install python python-setuptools python-mysqldb apache2 mysql-server libmysqlclient-dev git memcached -y
easy_install pip
pip install pytz python-dateutil jinja2 markdown2 termcolor python-memcached requests chardet dropbox google-api-python-client pygeoip
a2enmod rewrite
service apache2 start
service mysql start
memcached -d -l 127.0.0.1 -p 11211 -m 64 -u www-data
> ```memcached -d -l 127.0.0.1 -p 11211 -m [64 or more mb of ram] -u apache ```
#### Other useful programs
apt-get install ntp vim screen htop -y
service ntpd start

141
docs/docs.dev.install.md Normal file
View File

@ -0,0 +1,141 @@
---
{
"_label": "How to Install ERPNext",
"_toc": [
"docs.dev.install.red_hat",
"docs.dev.install.debian"
]
}
---
> These are instructions that will help you to install ERPNext on your Unix like system (Linux / Ubuntu / MacOS) using the Terminal. If you are looking at easier ways to evaluate ERPNext, [see this page](docs.user.intro.try.html).
1. You will need some linux background to be able to install this on your system.
1. These are high-level instructions and by no means cover every installation issue.
### Pre-requisites:
* any unix based os
* python 2.6+ (python 3+ not supported)
* apache
* mysql 5+
* git
* python libraries:
* python MySQLdb
* pytz
* jinja2
* markdown2
* dateutil
* termcolor
* python-memcached
* requests
* chardet
* pygeoip
* dropbox
* google-api-python-client
* memcached
## Fresh Installation
### Steps: [using terminal]
#### Get the Install Script
Download the standard install script and install. This script will:
- Create `app` and `lib` folders.
- Clone the code repositories for `wnframework` and `erpnext` from GitHub. It is important to clone the repositories from GitHub rather than just downloading the code, because this will help you in upgrading the system.
- Create the database.
- Create a default `erpnext.conf` Apache configuration file for ERPnext.
- Create the standard wnframework configuration file `conf.py`
- Build the `public` folder from which the ERPNext client application will be served via Apache and CGI.
**Instructions**
1. ensure mysql service is running
1. create a folder where you want to install erpnext
1. go to the new folder
1. `wget https://github.com/webnotes/erpnext/blob/master/install_erpnext.py`
1. `python install_erpnext.py`
#### Setup Apache
1. check your apache/httpd user and group. Most often it is either `apache` or `_www`. This can be found in its conf file.
1. run `chown -R apache:apache *` or `chown -R _www:_www *`. This will make the erpnext folder accessible to apache webserver.
1. create erpnext.conf file in erpnext folder and paste a modified version of apache configuration file as shown in the example below. (You will need to change the values in square brackets)
* For debian systems, `sudo ln -s [PATH TO ERPNEXT INSTALLATION]/erpnext.conf /etc/apache2/sites-enabled/erpnext.conf`
* For redhat systems, `sudo ln -s [PATH TO ERPNEXT INSTALLATION]/erpnext.conf /etc/httpd/conf.d/erpnext.conf`
1. restart apache service
1. if firewall exists, run
```
iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
service iptables save
```
### Setup Schueduler
1. setup cron using `crontab -e` and enter the following and then save it:
```
*/3 * * * * cd [PATH TO ERPNEXT INSTALLATION] && python lib/wnf.py --run_scheduler >> /var/log/erpnext-sch.log 2>&1
0 */6 * * * cd [PATH TO ERPNEXT INSTALLATION] && python lib/wnf.py --backup >> /var/log/erpnext-backup.log 2>&1
```
### Start
1. go to erpnext folder and run `lib/wnf.py --domain localhost:8080`
1. start your browser and go to http://localhost:8080
1. login as user: Administrator and password: admin
> If you are installing on your server for deployment, remember to change Administrator's password!
### What to write in apache configuration file?
Listen 8080
NameVirtualHost *:8080
<VirtualHost *:8080>
ServerName localhost
DocumentRoot [PATH TO ERPNEXT INSTALLATION]/public/
AddHandler cgi-script .cgi .xml .py
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
<Directory [PATH TO ERPNEXT INSTALLATION]/public/>
# directory specific options
Options -Indexes +FollowSymLinks +ExecCGI
# directory's index file
DirectoryIndex web.py
AllowOverride all
Order Allow,Deny
Allow from all
# rewrite rule
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([^/]+)$ /web.py?page=$1 [QSA,L]
</Directory>
</VirtualHost>
## Upgrade / run latest patches
1. Backup your database!
1. go to Setup > Update This Application [under Update Manager]
1. click on 'Get Latest Updates'
#### If you cannot see this option (Update This Application), you will need to run a manual update once
1. go your erpnext folder i.e. `cd /var/www/erpnext`
1. run `lib/wnf.py --update origin master`
1. run `chown -R apache:apache *` or `chown -R _www:_www *`. This will make the erpnext folder accessible to apache webserver.
1. once done, you can use Setup > Update This Application, henceforth.
---
> Looking for a one click installer? Help us build one.

View File

@ -0,0 +1,59 @@
---
{
"_label": "ERPNext Pre-requisites for Red Hat systems (CentOS, Fedora)"
}
---
#### If not root user
`sudo su`
#### Installing Pre-Requisites
cd ~
yum update python -y
yum install python-setuptools MySQL-python httpd mysql mysql-server mysql-devel git memcached ntp vim -y
easy_install pip
pip install pytz python-dateutil jinja2 markdown2 termcolor python-memcached requests chardet dropbox google-api-python-client pygeoip
service httpd start
service mysqld start
service ntpd start
mysqladmin -u root password [NEW PASSWORD]
#### memcached
1. `vim /etc/sysconfig/memcached`
1. change user to the apache user, change the cache size if desired (depending on available memory), save the file
1. `service memcached start`
#### set services to run when machine starts
chkconfig --level 2345 mysql on
chkconfig --level 2345 httpd on
chkconfig --level 2345 memcached on
chkconfig --level 2345 ntpd on
#### Other useful programs
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -i http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
yum install htop screen -y
--
#### CPanel Users
If you are using CPanel, you are likely to face perl dependency issues when installing git. To install git in this case, follow this procedure:
1. `vim /etc/yum.conf`, remove perl* from exclude list and save the file
1. `yum install git -y`
1. `vim /etc/yum.conf`, add perl* back to exclude list and save the file
> source: [http://forums.cpanel.net/f5/upcp-errors-due-dependeny-problems-centos-6-3-not-upgraded-centos-6-4-a-332102.html](http://forums.cpanel.net/f5/upcp-errors-due-dependeny-problems-centos-6-3-not-upgraded-centos-6-4-a-332102.html)
CPanel users should follow these steps to set the apache configuration for ERPNext:
1. `vim /etc/httpd/conf/includes/post_virtualhost_2.conf`
1. add the line `Include [PATH TO ERPNEXT CONF FILE]` (example: /var/www/erpnext.conf) and save the file
1. `vim [PATH TO ERPNEXT CONF FILE]`, set the apache configuration for ERPNext and save it
1. `service httpd restart`
*The mysql root password may be found at* `/root/.my.cnf`

View File

@ -0,0 +1,26 @@
---
{
"_label": "Open Source"
}
---
What Open Source means is that there is no license on the software. The source code is open for anyone to understand, extend or improve and it is free!
A non-software business might think why does Open Source matter, because they will pay some service provider to help them manage their ERP. The way it matters is that:
1. You can choose to change your service provider anytime.
1. You can host the application anywhere, including your own server so you have complete ownership and privacy of the data.
1. There will always be a community to support you incase you need help and you are not dependant on only your service provider.
1. The product is critiqued and used by a wide range of people who have reported hundreds of issues and suggestions to make the product better and this will always continue.
---
### Alternatives
There are many Open Source ERPs you can consider. Popular among them are:
1. OpenERP
1. OpenBravo
1. Apache OfBiz
1. xTuple
1. Compiere (and forks)

View File

@ -0,0 +1,39 @@
---
{
"_label":"Getting Started with ERPNext"
}
---
There are many ways to get started with ERPNext.
### 1. See the Demo
If you just want to check out the user interface and **feel** the application, just see the demo at:
- [https://demo.erpnext.com](https://demo.erpnext.com)
### 2. Get a Free 30 day Trial at ERPNext.com
If you like the feel and want to setup your own company, you can try a 30 day free trial (on credit card details required) at ERPNext.com
ERPNext.com is managed by the organization (Web Notes) that publishes ERPNext and you can do a trial run with your own account by [signing up on the website](https://erpnext.com/pricing-and-signup).
You can also decide to host your application at ERPNext.com by buying the hosting plans. This way you also support the organization that has developed and keeps improving ERPNext. You also get one-to-one functional (usage) support with the hosting plans.
### 3. Download a Virtual Machine
To avoid the trouble of installing an instance, ERPNext is available as a Virtual Image (a full loaded operating system with ERPNext installed). You can use this on **any** platform including Microsoft Windows.
[Click here to see instructions on how to use the Virtual Image](docs.download.html)
### 4. Install ERPNext on your Unix/Linux/Mac machine
ERPNext reasonably easy to install on a Unix like operating system and requires:
1. MySQL database
1. Apache Web Server
1. Python
1. Memcached
to be installed.
[More instructions on this page](docs.dev.install.html).

170
install_erpnext.py Normal file
View File

@ -0,0 +1,170 @@
#!/usr/bin/python
from __future__ import unicode_literals
import os, commands, sys
def install():
# get required details
root_pwd = get_root_password()
db_name, db_pwd = get_new_db_details()
# install path
install_path = os.getcwd()
setup_folders(install_path)
setup_conf(install_path, db_name, db_pwd)
# setup paths
sys.path.append('.')
sys.path.append('lib')
sys.path.append('app')
setup_db(install_path, root_pwd, db_name)
apply_patches(install_path)
show_remaining_steps()
def setup_folders(path):
execute_in_shell("git clone git://github.com/webnotes/wnframework.git lib", verbose=1)
execute_in_shell("git clone git://github.com/webnotes/erpnext.git app", verbose=1)
public = os.path.join(path, "public")
os.mkdir(public)
os.mkdir(os.path.join(public, "files"))
os.mkdir(os.path.join(public, "backups"))
os.mkdir(os.path.join(path, "logs"))
def setup_conf(path, db_name, db_pwd):
# read template conf file
with open(os.path.join(path, 'lib', 'conf', 'conf.py'), 'r') as template:
content = template.read()
# manipulate content
import re
# set new_dbname, new_dbpassword, files_path, backup_path, log_file_name
content = re.sub("db_name.*", "db_name = '%s'" % db_name, content)
content = re.sub("db_password.*", "db_password = '%s'" % db_pwd, content)
# write conf file
with open(os.path.join(path, 'conf.py'), 'w') as new_conf:
new_conf.write(content)
def setup_db(path, root_pwd, db_name):
source = os.path.join(path, 'app', "master.sql")
execute_in_shell("gunzip -c %s.gz > %s" % (source, source), verbose=1)
from webnotes.install_lib.install import Installer
inst = Installer('root', root_pwd)
inst.import_from_db(db_name, source_path=source, verbose = 1)
execute_in_shell("rm %s" % source)
def apply_patches(path):
# need to build before patches, once, so that all-web.js and all-web.css exists
execute_in_shell("./lib/wnf.py -b", verbose=1)
execute_in_shell("./lib/wnf.py --patch_sync_build", verbose=1)
# set filemode false
execute_in_shell("cd app && git config core.filemode false", verbose=1)
execute_in_shell("cd lib && git config core.filemode false", verbose=1)
def get_root_password():
# ask for root mysql password
import getpass
root_pwd = None
while not root_pwd:
root_pwd = getpass.getpass("MySQL Root user's Password: ")
test_root_connection(root_pwd)
return root_pwd
def test_root_connection(root_pwd):
err, out = execute_in_shell("mysql -u root -p%s -e 'exit'" % \
root_pwd.replace('$', '\$').replace(' ', '\ '))
if "access denied" in out.lower():
raise Exception("Incorrect MySQL Root user's password")
def get_new_db_details():
return get_input("New ERPNext Database Name: "), \
get_input("New ERPNext Database's Password: ")
def get_input(msg):
val = None
while not val:
val = raw_input(msg)
return val
def show_remaining_steps():
steps_remaining = """
Notes:
------
sample apache conf file
#-----------------------------------------------------------
SetEnv PYTHON_EGG_CACHE /var/www
# you can change 99 to any other port
Listen 99
NameVirtualHost *:99
<VirtualHost *:99>
ServerName localhost
DocumentRoot {path to erpnext's folder}/public
AddHandler cgi-script .cgi .xml .py
<Directory {path to erpnext's folder}/public/>
# directory specific options
Options -Indexes +FollowSymLinks +ExecCGI
# directory's index file
DirectoryIndex web.py
# rewrite rule
RewriteEngine on
# condition 1:
# ignore login-page.html, app.html, blank.html, unsupported.html
RewriteCond %{REQUEST_URI} ^((?!app\.html|blank\.html|unsupported\.html).)*$
# condition 2: if there are no slashes
# and file is .html or does not containt a .
RewriteCond %{REQUEST_URI} ^(?!.+/)((.+\.html)|([^.]+))$
# rewrite if both of the above conditions are true
RewriteRule ^(.+)$ web.py?page=$1 [NC,L]
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
#-----------------------------------------------------------
To Do:
* Configure apache/http conf file to point to public folder
* chown recursively all files in your folder to apache user
* login using: user="Administrator" and password="admin"
"""
print steps_remaining
def execute_in_shell(cmd, verbose=0):
# using Popen instead of os.system - as recommended by python docs
from subprocess import Popen, PIPE
p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
# get err and output
err, out = p.stderr.read(), p.stdout.read()
if verbose:
if err: print err
if out: print out
return err, out
if __name__=="__main__":
install()