Skip to content

Install ERPNext Version 5 on Debian

davemc50 edited this page Oct 9, 2016 · 14 revisions

Forum link

Install pre-requisites

https://github.com/frappe/bench#manual-install

Install mariadb
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo su -
cat <<EOF >> /etc/apt/sources.list
# MariaDB 5.5 repository list
deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/debian wheezy main
deb-src http://ftp.osuosl.org/pub/mariadb/repo/5.5/debian wheezy main
EOF
exit
Other requirements
sudo aptitude update
sudo aptitude upgrade
sudo aptitude install python2.7 mariadb-server libmariadbclient-dev python-mysqldb redis-server memcached git build-essential python-pip python-dev libldap2-dev libsasl2-dev wkhtmltopdf libjpeg-dev npm

npm -g install npm
Install bench
sudo mkdir /opt/erpnext5
sudo chown <YOURNAME> /opt/erpnext5
cd /opt/erpnext5/
# NO sudo in this command:
git clone https://github.com/frappe/bench bench-repo
sudo pip install -e bench-repo

Install ERPNext

https://github.com/frappe/bench#setting-up-erpnext

[BROKEN LINK]
cd /opt/erpnext5
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
sudo python ez_setup.py
needed for python setup.py egg_info
sudo pip -q install https://github.com/frappe/MySQLdb1/archive/MySQLdb-1.2.5-patched.tar.gz
Locale

Python gets upset if it can't chatter to the terminal & file system in UTF-8. Setup your locale with UTF8 correctly.

https://perlgeek.de/en/article/set-up-a-clean-utf8-environment

Make a new bench

NOTE: On Debian systems the original "/usr/bin/node" executable has been renamed to "/usr/bin/nodejs". Create an alternative to provide both variants.

sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10

bench requires python's MarkupSafe

sudo easy_install MarkupSafe

Now you may continue installing ERPNExt:

bench init frappe-bench
cd frappe-bench
Add ERPNext to your bench apps
bench get-app erpnext https://github.com/frappe/erpnext
Add /etc/mysql/conf.d/erpnext.cnf

This may be different for you, so follow what is suggested to you

[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4
restart mysql
sudo service mysql restart
Create a new site
bench new-site erp.example.com
bench --site erp.example.com install-app erpnext                       # Install ERPNext for the site
Allow remote access

By default this setup allows access only on localhost:8000. To allow remote access (i.e., setting up a headless machine) you need to edit frappe-bench/config/supervisor.conf and modify

command=/home/erpnext/frappe-bench/env/bin/gunicorn -b 127.0.0.1:8000 -w 2 -t 120 frappe.app:application

with

command=/home/erpnext/frappe-bench/env/bin/gunicorn -b x.x.x.x:8000 -w 2 -t 120 frappe.app:application

being x.x.x.x your preferred netmask, or 0.0.0.0 for unrestricted access. Of course, you can also adjust the port to your needs.

Deployment

https://github.com/frappe/bench#production-deployment

Install supervisor
sudo aptitude install supervisor
bench setup supervisor
sudo ln -s `pwd`/config/supervisor.conf /etc/supervisor/conf.d/frappe.conf
Install Ngnix
sudo aptitude install nginx
bench setup nginx
sudo ln -s `pwd`/config/nginx.conf /etc/nginx/conf.d/frappe.conf
may need to restart supervisor
sudo service supervisor restart
check if supervisor is running:
supervisorctl status
restart nginx if required
sudo service nginx restart

Multi-tenant

https://github.com/frappe/bench/wiki/Multitenant-Setup

bench new-site erp2.example.com
bench config dns_multitenant on
bench setup nginx
# see the config in config/nginx.conf
sudo service nginx reload