ERPNext Installation Details
Tags: erpnext, python, frappe, erp
Published: 2021-08-11 10:28:25

[ERPNext](https://erpnext.com) is one of free / open source ERP software available in today's market. Beside their cloud offering, there is a possibility to use ERPNext on-premise. However, installation instructions are not quite clear. I personally have to experiment with installation many times before I got ... "oh this is how things work". I hope, this is not because I am too slow. LOL. So here is my details instruction on how to make ERPNext installed properly.

## Preparation

ERPNext is developed in Python using Frappe Framework (will use `Frappe` term in this article). Both ERPNext and Frappe come from the same company with many community supporters. MariaDB is used for the DBMS, so, before going into details, here is our list of software which I prepare before ERPNext installation:

1. [Python](https://www.python.org): the programming language to implement Frappe and ERPNext on top of Frappe.
2. [MariaDB](https://mariadb.org): the DBMS, used to store and manage data. 
3. [Frappe](https://frappe.io/): software framework, based on Python, used to build ERPNext. 
4. [Bench](https://github.com/frappe/bench): a CLI program to manage multi-tenant deployments for Frappe apps. 
5. [Node.js](https://nodejs.org): JavaScript engine, used by Frappe for frontend purposes.
6. [yarn](https://yarnpkg.com/): package manager for Node.js. 
7. [Git](https://git-scm.com): version control system, used by **bench CLI**.
8. [Redis](https://redis.io/download/): personally, I prefer redis-stack, in this article I will use redis-stack 6.2.4.  

## Installation and Configuration for Infrastructure Software

### Python

I use [Miniconda](https://docs.conda.io/en/latest/miniconda.html) distribution. See this [installation instructions](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) for information on how to install Miniconda. After installation, create environment - special for this ERPNext installation:

```
$ conda create -n py310-erpnext python=3.10
$ conda activate py310-erpnext
$ python
Python 3.10.8 (main, Nov  4 2022, 13:48:29) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
$
```

All of our steps to install ERPNext will be done in this shell. If you want to open another shell, activate conda environment **py311-erpnext**, just like the command above.

### MariaDB

Get MariaDB at https://mariadb.org/download/, install using installation instructions at https://mariadb.com/kb/en/binary-packages/ and then change its configuration (usually you have to edit **my.cnf**, in most Linux distribution you can find this file in `/etc/mysql/my.cnf`):

```bash
...
[mysqld]
datadir                 = /home/bpdp/mariadbdata
default-storage-engine  = InnoDB
collation-server        = utf8mb4_unicode_ci
character_set_server    = utf8mb4
...
```
Run MariaDB server process using the instructions at https://mariadb.com/kb/en/starting-and-stopping-mariadb-automatically/. 

User *root* comes with no password, so, I choose to set root password:

```bash
mysqladmin -u root password 'root'
```

**Notes**: I use *root* as password for root just for simplicity.

Test your MariaDB installation:

```bash
$ mysql -u root -p 
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.10.2-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 
$
```

### Frappe

You may read about Frappe at https://github.com/frappe/frappe. In the meantime, this will be installed, together with ERPNext later using `bench`.

### Bench

If you want more information, you can always have a look at its source code here: https://github.com/frappe/bench. Although there are many instructions to install **bench**, the easiest is just:

```bash
$ pip install frappe-bench
Collecting frappe-bench
  Using cached frappe_bench-5.14.4-py3-none-any.whl (145 kB)
Collecting click>=7.0
  Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting gitpython~=2.1.15
  Using cached GitPython-2.1.15-py2.py3-none-any.whl (452 kB)
Collecting honcho
  Using cached honcho-1.1.0-py2.py3-none-any.whl (21 kB)
Collecting jinja2~=3.0.3
  Using cached Jinja2-3.0.3-py3-none-any.whl (133 kB)
Collecting python-crontab~=2.6.0
  Using cached python_crontab-2.6.0-py3-none-any.whl
Collecting requests
  Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting semantic-version~=2.8.2
  Using cached semantic_version-2.8.5-py2.py3-none-any.whl (15 kB)
Requirement already satisfied: setuptools>40.9.0 in /home/bpdp/software/python-dev-tools/miniconda39/envs/py311-erpnext/lib/python3.11/site-packages (from frappe-bench) (65.5.1)
Collecting gitdb2<3,>=2
  Using cached gitdb2-2.0.6-py2.py3-none-any.whl (63 kB)
Collecting MarkupSafe>=2.0
  Using cached MarkupSafe-2.1.1-cp311-cp311-linux_x86_64.whl
Collecting python-dateutil
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting charset-normalizer<3,>=2
  Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.9.24-py3-none-any.whl (161 kB)
Collecting smmap2>=2.0.0
  Using cached smmap2-3.0.1-py3-none-any.whl (1.1 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting smmap>=3.0.1
  Using cached smmap-5.0.0-py3-none-any.whl (24 kB)
Installing collected packages: honcho, urllib3, smmap, six, semantic-version, MarkupSafe, idna, click, charset-normalizer, certifi, smmap2, requests, python-dateutil, jinja2, python-crontab, gitdb2, gitpython, frappe-bench
Successfully installed MarkupSafe-2.1.1 certifi-2022.9.24 charset-normalizer-2.1.1 click-8.1.3 frappe-bench-5.14.4 gitdb2-2.0.6 gitpython-2.1.15 honcho-1.1.0 idna-3.4 jinja2-3.0.3 python-crontab-2.6.0 python-dateutil-2.8.2 requests-2.28.1 semantic-version-2.8.5 six-1.16.0 smmap-5.0.0 smmap2-3.0.1 urllib3-1.26.12
$ pip list | grep bench                                                                   
frappe-bench       5.14.4
$ bench --help 
WARN: Command not being executed in bench directory
Usage:  [OPTIONS] COMMAND [ARGS]...

Options:
  --version
  --use-feature TEXT
  -v, --verbose
  --help              Show this message and exit.

Commands:
  backup-all-sites         Backup all sites in current bench
  config                   Change bench configuration
  disable-production       Disables production environment for the bench.
  download-translations    Download latest translations
  drop
  exclude-app              Exclude app from updating
  find                     Finds benches recursively from location
  get                      Clone an app from the internet or filesystem...
  get-app                  Clone an app from the internet or filesystem...
  include-app              Include app for updating
  init                     Initialize a new bench instance in the...
  install                  Install system dependencies for setting up...
  migrate-env              Migrate Virtual Environment to desired Python...
  new-app                  Create a new Frappe application under apps folder
  pip                      For pip help use `bench pip help [COMMAND]` or...
  remote-reset-url         Reset app remote url to frappe official
  remote-set-url           Set app remote url
  remote-urls              Show apps remote url
  remove                   Completely remove app from bench and re-build...
  remove-app               Completely remove app from bench and re-build...
  renew-lets-encrypt       Sets Up latest cron and Renew Let's Encrypt...
  restart                  Restart supervisor processes or systemd units
  retry-upgrade            Retry a failed upgrade
  rm                       Completely remove app from bench and re-build...
  set-mariadb-host         Set MariaDB host for bench
  set-nginx-port           Set NGINX port for site
  set-redis-cache-host     Set Redis cache host for bench
  set-redis-queue-host     Set Redis queue host for bench
  set-redis-socketio-host  Set Redis socketio host for bench
  set-ssl-certificate      Set SSL certificate path for site
  set-ssl-key              Set SSL certificate private key path for site
  set-url-root             Set URL root for site
  setup                    Setup command group for enabling setting up a...
  src                      Prints bench source folder path, which can be...
  start                    Start Frappe development processes
  switch-to-branch         Switch all apps to specified branch, or...
  switch-to-develop        Switch frappe and erpnext to develop branch
  update                   Performs an update operation on current bench.
$
```

### Node.js

See this [installation instructions](https://nodejs.org/en/download/package-manager/). I use version 16.x.x (LTS version).

### Yarn

After Node.js installation, you should have `node` and `npm`. Install Yarn using this command:

```
$ npm install -g yarn
```

### Git

Usually all Linux distro has Git installed by default. Just in case your Linux box does not have Git or maybe you use MacOS or Windows, see [installation instructions for Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).

### Redis

Redis will be needed in `bench` directory initialization. Make sure that you have redis (or redis-stack) and `redis --version` has an output - for example:

```
$ redis-server --version
Redis server v=6.2.7 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=adcdff4a0d295794
$
```

## Initialize `bench` Directory

Our applications will reside in one **bench directory**, therefore we need to initialize it first:

```bash
$ bench init --frappe-branch version-14 myERPNext14
```

Here's the screen dump:

```bash
$ bench init --frappe-branch version-14 myERPNext14 Setting Up Environment
$ python3 -m venv env
$ /home/bpdp/kerjaan/ptjim/erpnext/myERPNext14/env/bin/python -m pip install --quiet --upgrade pip
Getting frappe
$ git clone https://github.com/frappe/frappe.git --branch version-14 --depth 1 --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 3162, done.
remote: Counting objects: 100% (3162/3162), done.
remote: Compressing objects: 100% (2836/2836), done.
remote: Total 3162 (delta 424), reused 1254 (delta 227), pack-reused 0
Receiving objects: 100% (3162/3162), 15.99 MiB | 1.76 MiB/s, done.
Resolving deltas: 100% (424/424), done.
Installing frappe
$ /home/bpdp/kerjaan/ptjim/erpnext/myERPNext14/env/bin/python -m pip install --quiet --upgrade -e /home/bpdp/kerjaan/ptjim/erpnext/myERPNext14/apps/frappe 
  DEPRECATION: zxcvbn-python is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: PyQRCode is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: docopt is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: traceback-with-variables is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: maxminddb is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: hiredis is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: maxminddb-geolite2 is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: rauth is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: premailer is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: googlemaps is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: cairocffi is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
$ yarn install
yarn install v1.22.19
warning ../../../../../../package.json: No license field
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning " > @frappe/esbuild-plugin-postcss2@0.1.3" has unmet peer dependency "less@^4.x".
warning " > @frappe/esbuild-plugin-postcss2@0.1.3" has unmet peer dependency "stylus@^0.x".
warning Workspaces can only be enabled in private projects.
[5/5] Building fresh packages...
Done in 237.62s.
Found existing apps updating states...
$ bench build
Assets for Release v14.16.0 don't exist
✔ Application Assets Linked                                                                                                                          


yarn run v1.22.19
warning ../../../../../../package.json: No license field
$ node esbuild --production --run-build-command
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
File                                                        Size

frappe/dist/js/
├─ bootstrap-4-web.bundle.22U72DEL.js                       1.73 Kb
├─ controls.bundle.XMXXTEDE.js                              1226.29 Kb
├─ data_import_tools.bundle.ZHGGYJ52.js                     106.10 Kb
├─ desk.bundle.MLU24LZA.js                                  1315.72 Kb
├─ dialog.bundle.IBOC573P.js                                52.67 Kb
├─ form.bundle.DM6ACTZY.js                                  153.74 Kb
├─ frappe-web.bundle.UEU5WTAG.js                            823.04 Kb
├─ libs.bundle.YZMCKPNH.js                                  574.13 Kb
├─ list.bundle.TT33PVXT.js                                  185.23 Kb
├─ logtypes.bundle.7STJ7YLS.js                              0.73 Kb
├─ recorder.bundle.5AOEUOFD.js                              179.54 Kb
├─ report.bundle.GFUQKB7W.js                                170.93 Kb
├─ user_profile_controller.bundle.YR6XHZRM.js               11.35 Kb
├─ video_player.bundle.UO3KNN5D.js                          120.59 Kb
├─ web_form.bundle.KZ3DGEKH.js                              1560.14 Kb
├─ print_format_builder.bundle.KP4FAW42.js                  170.39 Kb
├─ build_events.bundle.L2HAVD4K.js                          11.62 Kb
└─ kanban_board.bundle.VCVKXCPT.js                          27.42 Kb

frappe/dist/css/
├─ desk.bundle.ZJ65KRGK.css                                 542.84 Kb
├─ email.bundle.2SCQFONP.css                                4.02 Kb
├─ login.bundle.YF3JSIEM.css                                23.56 Kb
├─ print.bundle.4DZBYDHD.css                                194.76 Kb
├─ print_format.bundle.P4TGM3H5.css                         177.61 Kb
├─ report.bundle.INQWGNNN.css                               5.36 Kb
├─ web_form.bundle.ICCT62YT.css                             14.73 Kb
└─ website.bundle.DQ2V2XQ5.css                              420.08 Kb

frappe/dist/css-rtl/
├─ desk.bundle.2VE3L2MS.css                                 543.10 Kb
├─ email.bundle.5KSKAB3K.css                                4.02 Kb
├─ login.bundle.BI7G5G42.css                                23.56 Kb
├─ print.bundle.3YGOKYDF.css                                194.91 Kb
├─ print_format.bundle.N76YW3PD.css                         177.72 Kb
├─ report.bundle.S5GOBZKX.css                               5.35 Kb
├─ web_form.bundle.KPBAPSVI.css                             14.72 Kb
└─ website.bundle.MQZU7APE.css                              420.24 Kb

 DONE  Total Build Time: 12.268s

 WARN  Cannot connect to redis_cache to update assets_json
 WARN  Cannot connect to redis_cache to update assets_json
 WARN  Cannot connect to redis_cache to update assets_json
Done in 15.86s.
SUCCESS: Bench myERPNext14 initialized
$
```

At this point, we already have one bench directory, named myERPNext14.

> **NOTE**: The term **bench/Bench** usually denotes two things: **directory** and **CLI**. Starting now, we will call **bench/Bench directory** as **bench/Bench** and **bench/Bench CLI** as **bench/Bench CLI**.

In this bench, we will create our site and then get the app (ERPNext) and install our ERPNext app into our site.

## Create New Site

Set the host first:

```bash
$ cat /etc/hosts
127.0.0.1	localhost
127.0.1.1	dellvuan	dellvuan
127.0.1.1	myerpnext	myerpnext

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
$ ping myerpnext
PING myerpnext (127.0.1.1) 56(84) bytes of data.
64 bytes from dellvuan (127.0.1.1): icmp_seq=1 ttl=64 time=0.052 ms
64 bytes from dellvuan (127.0.1.1): icmp_seq=2 ttl=64 time=0.031 ms
^C
--- myerpnext ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1021ms
rtt min/avg/max/mdev = 0.031/0.041/0.052/0.010 ms
$
```

Enter the directory which we have created before using `bench init` (*myERPNext14*) and then use this command to create a new site (**myerpnext01**):

```bash
$ bench new-site --db-name myerpnextdb01 myerpnext01 
MySQL root password: 

Installing frappe...
Updating DocTypes for frappe        : [========================================] 100%
Updating country info               : [========================================] 100%
Set Administrator password: 
Re-enter Administrator password: 
Updating Dashboard for frappe
myerpnext01: SystemSettings.enable_scheduler is UNSET
*** Scheduler is disabled ***
$
```

If we do not use `--db-name` then **bench CLI** will use randomly generated name. We need to answer Administrator password. Take note of the password, we're gonna need this later.

## Get ERPNext Application

Use this command:

```bash
$ bench get-app --branch version-14 erpnext
```

Here's the screendump:

```bash
$ bench get-app --branch version-14 erpnext
Getting erpnext
$ git clone https://github.com/frappe/erpnext.git --branch version-14 --depth 1 --origin upstream
Cloning into 'erpnext'...
remote: Enumerating objects: 4909, done.
remote: Counting objects: 100% (4909/4909), done.
remote: Compressing objects: 100% (4172/4172), done.
remote: Total 4909 (delta 971), reused 2275 (delta 506), pack-reused 0
Receiving objects: 100% (4909/4909), 17.18 MiB | 1.72 MiB/s, done.
Resolving deltas: 100% (971/971), done.
Ignoring dependencies of erpnext. To install dependencies use --resolve-deps
Installing erpnext
$ /home/bpdp/kerjaan/ptjim/erpnext/myERPNext14/env/bin/python -m pip install --quiet --upgrade -e /home/bpdp/kerjaan/ptjim/erpnext/myERPNext14/apps/erpnext 
  DEPRECATION: pycountry is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: jsonobject is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: taxjar is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: plaid-python is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  DEPRECATION: gocardless-pro is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
$ yarn install
yarn install v1.22.19
warning ../../../../../../package.json: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 1.31s.
$ bench build --app erpnext
✔ Application Assets Linked                                                                                                                          


yarn run v1.22.19
warning ../../../../../../package.json: No license field
$ node esbuild --production --apps erpnext --run-build-command
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
File                                                        Size

erpnext/dist/js/
├─ bank-reconciliation-tool.bundle.M2IJU46J.js              15.49 Kb
├─ erpnext-web.bundle.SJSJGLAQ.js                           33.34 Kb
├─ erpnext.bundle.N434KUXQ.js                               171.45 Kb
├─ hierarchy-chart.bundle.7XNMCT5W.js                       197.67 Kb
├─ item-dashboard.bundle.FDBNNRVN.js                        10.01 Kb
└─ point-of-sale.bundle.6IPZTPSS.js                         92.75 Kb

erpnext/dist/css/
├─ erpnext-web.bundle.A6SQ2ID7.css                          25.63 Kb
├─ erpnext.bundle.U356GCQU.css                              45.08 Kb
└─ erpnext_email.bundle.IZ3Q7O74.css                        0.56 Kb

erpnext/dist/css-rtl/
├─ erpnext-web.bundle.V7HAL4NV.css                          25.62 Kb
├─ erpnext.bundle.VJVO6DLO.css                              45.07 Kb
└─ erpnext_email.bundle.5XL2M5KG.css                        0.56 Kb

 DONE  Total Build Time: 1.609s

 WARN  Cannot connect to redis_cache to update assets_json
 WARN  Cannot connect to redis_cache to update assets_json
 WARN  Cannot connect to redis_cache to update assets_json
Done in 5.35s.
$
```

## Install ERPNext Into the Site

Once we get ERPNext, we can install it into our site. In version 14, we need to install `payments` app first (see https://discuss.erpnext.com/t/getting-error-when-running-install-app-erpnext/92832):

```
$ bench get-app payments
Getting payments
$ git clone https://github.com/frappe/payments.git  --depth 1 --origin upstream
Cloning into 'payments'...
remote: Enumerating objects: 84, done.
remote: Counting objects: 100% (84/84), done.
remote: Compressing objects: 100% (74/74), done.
remote: Total 84 (delta 12), reused 37 (delta 4), pack-reused 0
Receiving objects: 100% (84/84), 41.23 KiB | 1.72 MiB/s, done.
Resolving deltas: 100% (12/12), done.
Ignoring dependencies of payments. To install dependencies use --resolve-deps
Installing payments
$ /home/bpdp/kerjaan/ptjim/erpnext/myERPNext14/env/bin/python -m pip install --quiet --upgrade -e /home/bpdp/kerjaan/ptjim/erpnext/myERPNext14/apps/payments 
  DEPRECATION: paytmchecksum is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
$ bench build --app payments
✔ Application Assets Linked                                                                                                                          


yarn run v1.22.19
warning ../../../../../../package.json: No license field
$ node esbuild --production --apps payments --run-build-command
File                                                        Size

 DONE  Total Build Time: 399.758ms

clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
clean: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
 WARN  Cannot connect to redis_cache to update assets_json
 WARN  Cannot connect to redis_cache to update assets_json
 WARN  Cannot connect to redis_cache to update assets_json
Done in 3.92s.
$
```

```bash
$ bench --site myerpnext01 install-app erpnext
Installing payments...
Updating DocTypes for payments      : [========================================] 100%
* Installing Payment Custom Fields in Web Form
Updating Dashboard for payments

Installing erpnext...
Updating DocTypes for erpnext       : [========================================] 100%
Updating customizations for Address
Updating customizations for Contact
Updating Dashboard for erpnext
$
```

## Setup Frappe for Production Environment

We can use **bench CLI** to setup Frappe for production environment, especially for specific user. Here, my username is **bpdp**, so we will do setup for user **bpdp**. To setup production environment using **bench CLI**, we need to use **sudo** since the command will change some system settings. Using `sudo` for `miniconda` distribution is a little bit tricky since `sudo` usually can not find command from `miniconda` because `miniconda` is installed for user. Therefore we need to use full path:

```bash
$ sudo /home/bpdp/software/python-dev-tools/miniconda39/envs/py310-erpnext/bin/bench setup production bpdp
```

At this point, our installation has fisnished successfully. Next, we will run our ERPNext app and doing some initial setup.

## Run ERPNext

To run ERPNext, use **bench CLI** below;

```bash
$ bench start
...
...
<screendump>
...
...
16:31:26 web.1            |  * Running on http://0.0.0.0:8001/ (Press CTRL+C to quit)
...
...
16:31:56 watch.1          | Rebuilding bank-reconciliation-tool.min.js
16:31:56 watch.1          | Rebuilding erpnext.css
16:31:56 watch.1          | Rebuilding marketplace.css
16:31:56 watch.1          | Rebuilding erpnext-web.css
$
```

> **NOTE**: The screendump above display the port which is accessible using browser where ERPNext serves.

## Initial Setup

Using browser, access http://myerpnext:8001/, a login screen appear:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d4vhbh2dh7fd8drl4ctm.png)

Use the password which has been created above and Administrator user.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9iofiez773ndc3yesvfe.png)

Choose your language.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eyv3n4drzxtnbbu8g1bf.png)

Choose region and fill timezone and currency.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bgd0smjqa9liqodnmhz9.png)

Create user. You may put picture or not.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qkplpri0idnjvxe08ylw.png)

Choose domain / industry where our company operate. We may choose more than one for later process.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uwpxndgtoq48yrn367bp.png)

Brand of our company. Logo for our company also optional.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nabqmycwy665dqkd591f.png)

More info about our company can be filled now. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0favui7rn0vq0mm5vz4v.png)

Wait until setup finish successfully.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h32834m928v7emvheff1.png)

Setup completed! Right now, we can start use our ERPNext. Enjoy!