Try ERPNext Buy Support Partners Foundation

[Tutorial] How To install ERPNext V12 on windows 10 home / Pro WSL ubuntu 18.04LTS

APPLIES TO
ERPNext V12, Frappe 12 or later
Applies to windows home 10 build 18362 or higher, windows Pro, WSL ubuntu 18.04 LTS

GOAL
Install ERPNext V12 on windows home 10 WSL ubuntu 18.04 LTS.

SOLUTION
1- check your windwos 10 build number, should be >= 18362
win +R, cmd, ver

2 - install ubuntu 18.04 LTS WSL on windows10, follow steps under this page https://www.notebookcheck.net/How-to-run-Linux-binaries-natively-in-Windows-10.282676.0.html

2- execute below command using your unix user (in my case I have created nofal user)

  • nofal@LAPTOP-5F23F7J8:~$ sudo apt-get update
  • nofal@LAPTOP-5F23F7J8:~$ sudo apt-get upgrade
  • frappe@LAPTOP-5F23F7J8:~/frappe-bench$ lsb_release -a – should get like below result
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 18.04.3 LTS
    Release: 18.04
    Codename: bionic
  • Reboot WSL
    Just open a cmd window as adminstrator and run these commands to restart it.
    net stop LxssManager
    net start LxssManager
    restart windows
    Launch ubuntu as non root user:
  • sudo mkdir -p /run/dbus
  • sudo service dbus start
  • sudo apt-get install python3-setuptools python3-minimal redis-server build-essential
  • sudo adduser frappe – can be any name mycase I have used frappe as a user
  • sudo usermod -aG sudo frappe
  • sudo su frappe
  • cd ~
  • sudo wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
  • sudo -H python3 install.py --production --site frappe.local --user frappe

This will install the ERPNEXT.

  • cd frappe-bench
  • bench update

connect using url http://localhost

Important Info:
Windows home 10 or windows Pro 10 build 18362 or higher is important,

Note that I failed many time installing ERPNext, each time I restart from an WSL ubuntu fresh (under apps & features, select ubuntu, advanced options, reset)
After windows restart, you need to start below services manually:

frappe@LAPTOP-5F23F7J8:~/frappe-bench$ sudo service dbus start
[sudo] password for frappe:

  • Starting system message bus dbus

frappe@LAPTOP-5F23F7J8:~/frappe-bench$ sudo service supervisor start

frappe@LAPTOP-5F23F7J8:~/frappe-bench$ sudo service mysql start

  • Starting MariaDB database server mysqld [ OK ]
    frappe@LAPTOP-5F23F7J8:~/frappe-bench$ sudo service nginx start
  • Starting nginx nginx [ OK ]
    frappe@LAPTOP-5F23F7J8:~/frappe-bench$ sudo service redis-server start
    Starting redis-server: redis-server.

to check supervisor status:

frappe@LAPTOP-5F23F7J8:~/frappe-bench$ sudo supervisorctl status
frappe-bench-redis:frappe-bench-redis-cache RUNNING pid 73, uptime 4:40:13
frappe-bench-redis:frappe-bench-redis-queue RUNNING pid 72, uptime 4:40:13
frappe-bench-redis:frappe-bench-redis-socketio RUNNING pid 74, uptime 4:40:13
frappe-bench-web:frappe-bench-frappe-web RUNNING pid 2984, uptime 2:00:18
frappe-bench-web:frappe-bench-node-socketio RUNNING pid 2986, uptime 2:00:18
frappe-bench-workers:frappe-bench-frappe-default-worker-0 RUNNING pid 2961, uptime 2:00:19
frappe-bench-workers:frappe-bench-frappe-long-worker-0 RUNNING pid 2962, uptime 2:00:19
frappe-bench-workers:frappe-bench-frappe-schedule RUNNING pid 2960, uptime 2:00:19
frappe-bench-workers:frappe-bench-frappe-short-worker-0 RUNNING pid 2963, uptime 2:00:19

to check all service status:

frappe@LAPTOP-5F23F7J8:~/frappe-bench$ service --status-all

[-] means not started
[+] means started

to start specific service as root or not:

frappe@LAPTOP-5F23F7J8:~/frappe-bench$ sudo service nginx start

to check

frappe@LAPTOP-5F23F7J8:~/frappe-bench$ sudo service nginx status

  • nginx is running

REFERENCES

ERPNext On Windows 10 :

How to run Linux binaries natively in Windows 10:

KEYWORDS
windows 10, WSL, ubuntu 18.04LTS, ERPNext V12

6 Likes

my os ver

I am afraid that your os is not supported, try upgrade?

2 Likes

ok i m trying to update my os thanks for your support nmani

1 Like

Yes it should work, most important thing is the windows build, check yours, read first part of my tutorial

It’s tough but doable, follow steps and update me, please open new thread for your issues faced.

Hi,

i have followed your tutorial. now my ERPNext up and running.

but i can’t access it from other PC in same network.

server ip address: 192.168.2.122

tried to connect from ip adress: 192.168.2.174

Hi,
I am sorry no idea, may be you will get some help from other community members.

Currently I am using instance locally in the same machine only.

BTW, I am interested to learn solution, so please update me how you solved once done.

thx
Nofal

i have found the solution, i got no problem when install it on WSL 1. i can access from any other PC connected to same network. but, when installed on WSL 2, can’t access it from other PC.

solution was here

go to this comment here

1 Like

Hi guys,

I face some error when I install the ERPNext to default site

Please advise me how do I solve it, thanks!!!

TASK [bench : Install ERPNext to default site] *************************************************************************
task path: /tmp/.bench/playbooks/roles/bench/tasks/setup_erpnext.yml:23
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c ‘echo ~root && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /var/tmp/ansible-tmp-1575452135.2029614-247542400556600” && echo ansible-tmp-1575452135.2029614-247542400556600="echo /var/tmp/ansible-tmp-1575452135.2029614-247542400556600" ) && sleep 0’
Using module file /usr/local/lib/python3.6/dist-packages/ansible/modules/commands/command.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-6080skpb89w_/tmpajyvef7o TO /var/tmp/ansible-tmp-1575452135.2029614-247542400556600/AnsiballZ_command.py
<127.0.0.1> EXEC /bin/sh -c ‘setfacl -m u:erpolive:r-x /var/tmp/ansible-tmp-1575452135.2029614-247542400556600/ /var/tmp/ansible-tmp-1575452135.2029614-247542400556600/AnsiballZ_command.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /var/tmp/ansible-tmp-1575452135.2029614-247542400556600/ /var/tmp/ansible-tmp-1575452135.2029614-247542400556600/AnsiballZ_command.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘chown erpolive /var/tmp/ansible-tmp-1575452135.2029614-247542400556600/ /var/tmp/ansible-tmp-1575452135.2029614-247542400556600/AnsiballZ_command.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘sudo -H -S -n -u erpolive /bin/sh -c ‘"’"‘echo BECOME-SUCCESS-sisiiybrhhittzadbknmtyanfbmudfaa ; /usr/bin/python3 /var/tmp/ansible-tmp-1575452135.2029614-247542400556600/AnsiballZ_command.py’"’"’ && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /var/tmp/ansible-tmp-1575452135.2029614-247542400556600/ > /dev/null 2>&1 && sleep 0’
fatal: [localhost]: FAILED! => {
“changed”: true,
“cmd”: [
“bench”,
“–site”,
“erpolive.local”,
“install-app”,
“erpnext”
],
“delta”: “0:00:03.273924”,
“end”: “2019-12-04 17:35:39.306340”,
“invocation”: {
“module_args”: {
“_raw_params”: “bench --site erpolive.local install-app erpnext”,
“_uses_shell”: false,
“argv”: null,
“chdir”: “/home/erpolive/frappe-bench”,
“creates”: null,
“executable”: null,
“removes”: null,
“stdin”: null,
“stdin_add_newline”: true,
“strip_empty_ends”: true,
“warn”: true
}
},
“msg”: “non-zero return code”,
“rc”: 1,
“start”: “2019-12-04 17:35:36.032416”,
“stderr”: “Traceback (most recent call last):\n File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 583, in connect\n **kwargs)\n File “/usr/lib/python3.6/socket.py”, line 724, in create_connection\n raise err\n File “/usr/lib/python3.6/socket.py”, line 713, in create_connection\n sock.connect(sa)\nOSError: [Errno 22] Invalid argument\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main\n “main”, mod_spec)\n File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code\n exec(code, run_globals)\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in \n main()\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main\n click.Group(commands=commands)(prog_name=‘bench’)\n File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call\n return self.main(*args, **kwargs)\n File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main\n rv = self.invoke(ctx)\n File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke\n return _process_result(sub_ctx.command.invoke(sub_ctx))\n File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke\n return _process_result(sub_ctx.command.invoke(sub_ctx))\n File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke\n return ctx.invoke(self.callback, **ctx.params)\n File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke\n return callback(*args, **kwargs)\n File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func\n return f(get_current_context(), *args, **kwargs)\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func\n ret = f(frappe._dict(ctx.obj), *args, **kwargs)\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/commands/site.py”, line 173, in install_app\n _install_app(app, verbose=context.verbose)\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/installer.py”, line 50, in install_app\n frappe.clear_cache()\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/init.py”, line 570, in clear_cache\n frappe.cache_manager.clear_user_cache()\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/cache_manager.py”, line 42, in clear_user_cache\n clear_global_cache()\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/cache_manager.py”, line 48, in clear_global_cache\n clear_website_cache()\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/website/render.py”, line 301, in clear_cache\n for method in frappe.get_hooks(“website_clear_cache”):\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/init.py”, line 946, in get_hooks\n hooks = _dict(cache().get_value(“app_hooks”, load_app_hooks))\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 79, in get_value\n val = generator()\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/init.py”, line 920, in load_app_hooks\n for app in [app_name] if app_name else get_installed_apps(sort=True):\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/init.py”, line 884, in get_installed_apps\n installed = json.loads(db.get_global(“installed_apps”) or “[]”)\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/database.py”, line 702, in get_global\n return self.get_default(key, user)\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/database.py”, line 706, in get_default\n d = self.get_defaults(key, parent)\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/database.py”, line 724, in get_defaults\n defaults = frappe.defaults.get_defaults(parent)\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/defaults.py”, line 77, in get_defaults\n globald = get_defaults_for()\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/defaults.py”, line 204, in get_defaults_for\n where parent = %s order by creation”"", (parent,), as_dict=1)\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/database.py”, line 122, in sql\n self.connect()\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/database.py”, line 75, in connect\n self._conn = self.get_connection()\n File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 90, in get_connection\n local_infile = frappe.conf.local_infile)\n File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/pymysql/init.py”, line 94, in Connect\n return Connection(*args, **kwargs)\n File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 325, in init\n self.connect()\n File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 630, in connect\n raise exc\npymysql.err.OperationalError: (2003, “Can’t connect to MySQL server on ‘localhost’ ([Errno 22] Invalid argument)”)",
“stderr_lines”: [
“Traceback (most recent call last):”,
" File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 583, in connect",
" **kwargs)",
" File “/usr/lib/python3.6/socket.py”, line 724, in create_connection",
" raise err",
" File “/usr/lib/python3.6/socket.py”, line 713, in create_connection",
" sock.connect(sa)",
“OSError: [Errno 22] Invalid argument”,
“”,
“During handling of the above exception, another exception occurred:”,
“”,
“Traceback (most recent call last):”,
" File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main",
" “main”, mod_spec)",
" File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code",
" exec(code, run_globals)",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in “,
" main()”,
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main",
" click.Group(commands=commands)(prog_name=‘bench’)",
" File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call",
" return self.main(*args, **kwargs)",
" File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main",
" rv = self.invoke(ctx)",
" File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke",
" return _process_result(sub_ctx.command.invoke(sub_ctx))",
" File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke",
" return _process_result(sub_ctx.command.invoke(sub_ctx))",
" File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke",
" return ctx.invoke(self.callback, **ctx.params)",
" File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke",
" return callback(*args, **kwargs)",
" File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func",
" return f(get_current_context(), *args, **kwargs)",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func",
" ret = f(frappe._dict(ctx.obj), *args, **kwargs)",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/commands/site.py”, line 173, in install_app",
" _install_app(app, verbose=context.verbose)",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/installer.py”, line 50, in install_app",
" frappe.clear_cache()",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/init.py”, line 570, in clear_cache",
" frappe.cache_manager.clear_user_cache()",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/cache_manager.py”, line 42, in clear_user_cache",
" clear_global_cache()",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/cache_manager.py”, line 48, in clear_global_cache",
" clear_website_cache()",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/website/render.py”, line 301, in clear_cache",
" for method in frappe.get_hooks(“website_clear_cache”):",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/init.py”, line 946, in get_hooks",
" hooks = _dict(cache().get_value(“app_hooks”, load_app_hooks))",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 79, in get_value",
" val = generator()",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/init.py”, line 920, in load_app_hooks",
" for app in [app_name] if app_name else get_installed_apps(sort=True):",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/init.py”, line 884, in get_installed_apps",
" installed = json.loads(db.get_global(“installed_apps”) or “[]”)",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/database.py”, line 702, in get_global",
" return self.get_default(key, user)",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/database.py”, line 706, in get_default",
" d = self.get_defaults(key, parent)",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/database.py”, line 724, in get_defaults",
" defaults = frappe.defaults.get_defaults(parent)",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/defaults.py”, line 77, in get_defaults",
" globald = get_defaults_for()",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/defaults.py”, line 204, in get_defaults_for",
" where parent = %s order by creation""", (parent,), as_dict=1)",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/database.py”, line 122, in sql",
" self.connect()",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/database.py”, line 75, in connect",
" self._conn = self.get_connection()",
" File “/home/erpolive/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 90, in get_connection",
" local_infile = frappe.conf.local_infile)",
" File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/pymysql/init.py”, line 94, in Connect",
" return Connection(*args, **kwargs)",
" File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 325, in init",
" self.connect()",
" File “/home/erpolive/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 630, in connect",
" raise exc",
“pymysql.err.OperationalError: (2003, “Can’t connect to MySQL server on ‘localhost’ ([Errno 22] Invalid argument)”)”
],
“stdout”: “”,
“stdout_lines”: []
}

PLAY RECAP *************************************************************************************************************
localhost : ok=80 changed=49 unreachable=0 failed=1 skipped=52 rescued=0 ignored=0