Easy install setup guide for erpnext installation on Ubuntu 20.04 LTS. With some modification of course

@idlethread

I would suggest you not to delete the /tmp/ .bench/ folder.

Just change the required files and rerun the sudo python3 install.py --production --user Your_USERNAME --mariadb-version 10.5 --verbose

This should get you going.

OK, but the playbook is doing something very wrong if it is able to create /tmp/.bench with a value that is not reflected anywhere obvious in the code.

Sounds like a bug, doesn’t it?

I’d like to create a CI loop around this script and I can’t

@idlethread

need to look that into more detail to confirm if it is a bug.

My aim at the moment was to make ERPnext work on ubuntu20.04.

If you make it through let me know.

It then crashed against at nodejs version. Fixed by changing version in tmp/.bench/playbooks/roles/nodejs/defaults/main.yml to 12.

Then it crashed while setting up dns_caching:

TASK [dns_caching : Add dnsmasq to network config] ***************************************************************************************
task path: /tmp/.bench/playbooks/roles/dns_caching/tasks/main.yml:11                                                                      
<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 /root/.ansible/tmp/ansible-tmp-1592588322.8201768-161253966731486 `" && echo a
nsible-tmp-1592588322.8201768-161253966731486="` echo /root/.ansible/tmp/ansible-tmp-1592588322.8201768-161253966731486 `" ) && sleep 0'  
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/files/lineinfile.py                                              
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-366140hf6wllb/tmpss07g_ck TO /root/.ansible/tmp/ansible-tmp-1592588322.8201768-1612539667
31486/AnsiballZ_lineinfile.py                                                                                                             
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1592588322.8201768-161253966731486/ /root/.ansible/tmp/ansible-tmp-1
592588322.8201768-161253966731486/AnsiballZ_lineinfile.py && sleep 0'                                                                     
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1592588322.8201768-161253966731486/AnsiballZ_lineinfile.py &&
 sleep 0'                                                                                                                                 
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1592588322.8201768-161253966731486/ > /dev/null 2>&1 && sleep 0'     
ERROR! The requested handler 'restart network manager' was not found in either the main handlers list nor in the listening handlers list  
Traceback (most recent call last):                                                                                                        
  File "install.py", line 465, in <module>                                                                                                
    install_bench(args)                                                                                                                   
  File "install.py", line 261, in install_bench                                                                                           
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)                                                                            
  File "install.py", line 385, in run_playbook                                                                                            
    success = subprocess.check_call(args, cwd=playbooks_folder, stdout=log_stream, stderr=sys.stderr)                                     
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call                                                                        
    raise CalledProcessError(retcode, cmd)                                                                                                
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-vvvv', '-e', '@/tmp/extra_vars.json', '--become'
, '--become-user=pcbkingdom']' returned non-zero exit status 1. 

Just re-ran the installer at which point it crashed at wkhtmltox.

TASK [wkhtmltopdf : Install wkhtmltox deb] ***********************************************************************************************
task path: /tmp/.bench/playbooks/roles/wkhtmltopdf/tasks/main.yml:90
<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 /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526” && echo ansible-tmp-1592588604.6127613-269544128595526=“echo /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526” ) && sleep 0’
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/packaging/os/apt.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-41550f8c7tcde/tmp7l06r0u8 TO /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526/AnsiballZ_apt.py
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526/ /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526/AnsiballZ_apt.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526/AnsiballZ_apt.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526/ > /dev/null 2>&1 && sleep 0’
The full traceback is:
File “/tmp/ansible_apt_payload_pgoqtn87/main.py”, line 718, in install_deb
pkg = apt.debfile.DebPackage(deb_file)
File “/usr/lib/python3/dist-packages/apt/debfile.py”, line 77, in init
self.open(filename)
File “/usr/lib/python3/dist-packages/apt/debfile.py”, line 87, in open
self._debfile = apt_inst.DebFile(self.filename)

fatal: [localhost]: FAILED! => {
“changed”: false,
“invocation”: {
“module_args”: {
“allow_unauthenticated”: false,
“autoclean”: false,
“autoremove”: false,
“cache_valid_time”: 0,
“deb”: “/tmp/wkhtmltox.deb”,
“default_release”: null,
“dpkg_options”: “force-confdef,force-confold”,
“force”: false,
“force_apt_get”: false,
“install_recommends”: null,
“only_upgrade”: false,
“package”: null,
“policy_rc_d”: null,
“purge”: false,
“state”: “present”,
“update_cache”: null,
“upgrade”: null
}
},
“msg”: “Unable to install package: E:Could not open file /tmp/wkhtmltox.deb - open (2: No such file or directory)”
}

Fixed that by copying the snippet for wkhtmltox again to /tmp/.bench/playbooks/roles/wkhtmltopdf/tasks/main.yml.

And then it finished! \o/

:smiley:

Since I was bothered with why /tmp/.bench was ignoring my local changes I dug further. Turns out, install.py has a clone_bench_repo that clones bench from the official website unless you use the --repo-url and --bench-branch options to point it to your own tree.

So now, I’m able to run w/o any errors by pushing the changes to my own git tree and the pointing --repo-url to it.

@idlethread

It was my bad… did not mentioned you to use my repo via --repo-url. The idea was to merge this changes with master branches so that everybody can use it. Hope the small issues will be resolved and soon it will be part of master branch.

cheers

Yesterday I revised my own installer scripts to deal with a few issues pointed out to me by those who gave them a try. The scripts are focused exclusively on 18.04 and 20.04. They’re just bash scripts; no Python or Ansible.

Original (locked???) post: An alternative installer for Ubuntu 20.04 LTS

The source code: Install ERPNext on Ubuntu Bionic 18.04 LTS and Focal 20.04 LTS · GitHub

My goal with those scripts was to create a sort of “didactic” installer … does the job but makes it clear what is going on.

I have opened a new thread to discuss them if you want to try a different type of installer

::==> An alternative installer for Ubuntu 20.04 LTS and Ubuntu 18.04 LTS

2 Likes

Hi Nikunj,
I tried the way with your modified “install.py” file here, but unfortunately I am facing this error, can you help how to proceed.
Note: I changed libssl from 1.0 to 1.1, for both i get the error.

Rerun sudo python3 install.py --production --user Your_USERNAME --mariadb-version 10.5 --verbose
after solving each issue you face. All the issue and their solution is mentioned below.

Thank you for the reply.
I noted that I was changing libssl1.0-dev to libssl1.1-dev. When I removed -dev from libssl1.1-dev it proceeded.

I followed the script, but at the end got bellow error, any help would be appreciated.

1 Like

@omid

Please share full logs, screen shot is not showing everything.

Here is the full log:

TASK [bench : Create a new site] ***************************************************************************************************************************************
task path: /tmp/.bench/playbooks/roles/bench/tasks/setup_erpnext.yml:17
<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-1593006061.8039832-103643141580621 `" && echo ansible-tmp-1593006061.8039832-103643141580621="` echo /var/tmp/ansible-tmp-1593006061.8039832-103643141580621 `" ) && sleep 0'
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/commands/command.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-27947_b6w9h1y/tmpaol5rhje TO /var/tmp/ansible-tmp-1593006061.8039832-103643141580621/AnsiballZ_command.py
<127.0.0.1> EXEC /bin/sh -c 'setfacl -m u:erpnext:r-x /var/tmp/ansible-tmp-1593006061.8039832-103643141580621/ /var/tmp/ansible-tmp-1593006061.8039832-103643141580621/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n  -u erpnext /bin/sh -c '"'"'echo BECOME-SUCCESS-gyqcwcympvgbhcjhqlapbqxelflvmyxr ; /usr/bin/python3 /var/tmp/ansible-tmp-1593006061.8039832-103643141580621/AnsiballZ_command.py'"'"' && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1593006061.8039832-103643141580621/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "changed": true,
    "cmd": [
        "bench",
        "new-site",
        "site1.local",
        "--admin-password",
        "admin",
        "--mariadb-root-password",
        "toor"
    ],
    "delta": "0:00:02.469270",
    "end": "2020-06-24 18:11:04.483878",
    "invocation": {
        "module_args": {
            "_raw_params": "bench new-site site1.local --admin-password 'admin' --mariadb-root-password 'toor'",
            "_uses_shell": false,
            "argv": null,
            "chdir": "/home/erpnext/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": "2020-06-24 18:11:02.014608",
    "stderr": "Traceback (most recent call last):\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py\", line 68, in get_app_commands\n    app_command_module = importlib.import_module(app + '.commands')\n  File \"/home/erpnext/frappe-bench/env/lib/python3.8/importlib/__init__.py\", line 127, in import_module\n    return _bootstrap._gcd_import(name[level:], package, level)\n  File \"<frozen importlib._bootstrap>\", line 1014, in _gcd_import\n  File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load\n  File \"<frozen importlib._bootstrap>\", line 961, in _find_and_load_unlocked\n  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n  File \"<frozen importlib._bootstrap>\", line 1014, in _gcd_import\n  File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load\n  File \"<frozen importlib._bootstrap>\", line 973, in _find_and_load_unlocked\nModuleNotFoundError: No module named 'erpnext'\nTraceback (most recent call last):\n  File \"/usr/lib/python3.8/runpy.py\", line 193, in _run_module_as_main\n    return _run_code(code, main_globals, None,\n  File \"/usr/lib/python3.8/runpy.py\", line 86, in _run_code\n    exec(code, run_globals)\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py\", line 99, in <module>\n    main()\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py\", line 18, in main\n    click.Group(commands=commands)(prog_name='bench')\n  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 764, in __call__\n    return self.main(*args, **kwargs)\n  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 717, in main\n    rv = self.invoke(ctx)\n  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 1137, in invoke\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\n  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 1137, in invoke\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\n  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 956, in invoke\n    return ctx.invoke(self.callback, **ctx.params)\n  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 555, in invoke\n    return callback(*args, **kwargs)\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py\", line 43, in new_site\n    frappe.init(site=site, new_site=True)\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py\", line 174, in init\n    setup_module_map()\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py\", line 998, in setup_module_map\n    for module in get_module_list(app):\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py\", line 868, in get_module_list\n    return get_file_items(os.path.join(os.path.dirname(get_module(app_name).__file__), \"modules.txt\"))\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py\", line 826, in get_module\n    return importlib.import_module(modulename)\n  File \"/home/erpnext/frappe-bench/env/lib/python3.8/importlib/__init__.py\", line 127, in import_module\n    return _bootstrap._gcd_import(name[level:], package, level)\n  File \"<frozen importlib._bootstrap>\", line 1014, in _gcd_import\n  File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load\n  File \"<frozen importlib._bootstrap>\", line 973, in _find_and_load_unlocked\nModuleNotFoundError: No module named 'erpnext'",
    "stderr_lines": [
        "Traceback (most recent call last):",
        "  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py\", line 68, in get_app_commands",
        "    app_command_module = importlib.import_module(app + '.commands')",
        "  File \"/home/erpnext/frappe-bench/env/lib/python3.8/importlib/__init__.py\", line 127, in import_module",
        "    return _bootstrap._gcd_import(name[level:], package, level)",
        "  File \"<frozen importlib._bootstrap>\", line 1014, in _gcd_import",
        "  File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load",
        "  File \"<frozen importlib._bootstrap>\", line 961, in _find_and_load_unlocked",
        "  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed",
        "  File \"<frozen importlib._bootstrap>\", line 1014, in _gcd_import",
        "  File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load",
        "  File \"<frozen importlib._bootstrap>\", line 973, in _find_and_load_unlocked",
        "ModuleNotFoundError: No module named 'erpnext'",
        "Traceback (most recent call last):",
        "  File \"/usr/lib/python3.8/runpy.py\", line 193, in _run_module_as_main",
        "    return _run_code(code, main_globals, None,",
        "  File \"/usr/lib/python3.8/runpy.py\", line 86, in _run_code",
        "    exec(code, run_globals)",
        "  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py\", line 99, in <module>",
        "    main()",
        "  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py\", line 18, in main",
        "    click.Group(commands=commands)(prog_name='bench')",
        "  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 764, in __call__",
        "    return self.main(*args, **kwargs)",
        "  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 717, in main",
        "    rv = self.invoke(ctx)",
        "  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 1137, in invoke",
        "    return _process_result(sub_ctx.command.invoke(sub_ctx))",
        "  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 1137, in invoke",
        "    return _process_result(sub_ctx.command.invoke(sub_ctx))",
        "  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 956, in invoke",
        "    return ctx.invoke(self.callback, **ctx.params)",
        "  File \"/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/click/core.py\", line 555, in invoke",
        "    return callback(*args, **kwargs)",
        "  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py\", line 43, in new_site",
        "    frappe.init(site=site, new_site=True)",
        "  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py\", line 174, in init",
        "    setup_module_map()",
        "  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py\", line 998, in setup_module_map",
        "    for module in get_module_list(app):",
        "  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py\", line 868, in get_module_list",
        "    return get_file_items(os.path.join(os.path.dirname(get_module(app_name).__file__), \"modules.txt\"))",
        "  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py\", line 826, in get_module",
        "    return importlib.import_module(modulename)",
        "  File \"/home/erpnext/frappe-bench/env/lib/python3.8/importlib/__init__.py\", line 127, in import_module",
        "    return _bootstrap._gcd_import(name[level:], package, level)",
        "  File \"<frozen importlib._bootstrap>\", line 1014, in _gcd_import",
        "  File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load",
        "  File \"<frozen importlib._bootstrap>\", line 973, in _find_and_load_unlocked",
        "ModuleNotFoundError: No module named 'erpnext'"
    ],
    "stdout": "",
    "stdout_lines": []
}

PLAY RECAP *************************************************************************************************************************************************************
localhost                  : ok=77   changed=28   unreachable=0    failed=1    skipped=61   rescued=0    ignored=0   

Traceback (most recent call last):
  File "install.py", line 632, in <module>
    install_bench(args)
  File "install.py", line 293, in install_bench
    run_playbook("site.yml", sudo=True, extra_vars=extra_vars)
  File "install.py", line 439, in run_playbook
    success = subprocess.check_call(
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-vvvv', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=erpnext']' returned non-zero exit status 2.

@omid

Is it possible to have remote connection to see more in details.

What command are you using for installation ? did you create a new user with sudo rights before ? Are you using the same user for installation ?

Yes, we can give you the remote with AnyDesk, or any other software if you prefer - if you can.

We created the user with sudo rights. we are not using that user for installation, we are doing it with root user.
The installation command is same as you mentioned in your post above, our created user is erpnext and the command is as follows:
sudo python3 install.py --production --user erpnext --mariadb-version 10.5 --verbose

@omid

Teamviewer13 ?

for the access… send me private message with the connection details.

Hello @Nikunj_Patel,
I am getting the same error log as @omid got.
Can you please look into my installation screen.
I can share you with my TeamViewer access.

Hi ,
I have some problem

When I change : On line 100 : Change current_dist = platform.dist() to current_dist = [“Ubuntu”, “20.04”]

@Phan_Minh_Duc

Use the following install.py

https://drive.google.com/file/d/1N1_NWyqVFVsCQ6kVZUKwCIghRLbRd4Dz/view?usp=sharing

3 Likes

Thank for you answer.
i download file install.py from your link, and i run step : sudo python3 install.py --production --user phanminhduc --mariadb-version 10.5 --verbose

@Phan_Minh_Duc

It is normal.

Just type

export LC_ALL=C.UTF-8

And press enter…