[Superceded/OLD:2019-11-15] ERPNext manual install on Debian Buster 10.x

[Superceded/OLD:2019-11-15] ERPNext manual install on Debian Buster 10.x

this version MAY contain errors

– it has been superseded by this more up to date post and is really only here as a reference/historical post.

I have tested this sequence several times on Debian Buster 10 – it works consistently. Like the previous article, it is based on various documents and notes that I have picked up on the ERPNext forums. I have left my little scraps of notes in comment lines. The syntax is ZSH/BASH compliant if you want to copy/paste it.

I run it line by line instead of as a script so that I get properly warned if anything is wrong along the way.


The pre-prep (Yes, I know you can’t prepare before you prepare)

Before we start on the OS & ERPNext pieces, let’s create a base machine using VirtualBox (although you could just as easily run this on a PC of suitable spec).
I created a VM as follows:
VMname=DebERP, debian 64bit, 2GB RAM, 8GB vHDD, Network in bridge mode (I assume it gets a DHCP address on/from your LAN)

Start with a basic netinstall
– nonGUI install,
– set your closest mirror to speed things up a bit,
– auto partitioned to [~2GB:swap,~6GB(remainder):/]
– initially I had a 4GB vHDD, partitioned as… manual:(3+1), AND manual:(3.5+.5) – ran out of space on both – resized to 16GB autoPartition
– I resized again from 8-16GB. In the upgrade from v11(default) to v11(latest), and then the v12 upgrade, I ran out of space again – hence the increase.
ONLY SSH server, and standard utilities selected – NO gui! [retrieving 140 files…]
– IF you do add a GUI here, then you should check this note

The IP address of the machine (in my case) is 192.168.1.249, and I like to match the port to the IP, so in the end it will be running on http://192.168.1.249:8249 – but that’s just personal preference, and is not essential.
At the end of it, you’ll get a production version of ERPNext (v11 stable at the time of this update) running on a minimalist non-GUI Debian Buster v10 – with an option to upgrade ERPNext to v12 right at the end. [PS: v12 is REALLY nice]


The preparation process for Debian (Buster)

Within/during the install, I set the users as follows (please do NOT use these values – they are not safe)!

  • root/rootpassword
  • erpnext001/erpnextpassword – with sudo permissions
  • MySQL(root):mysqlpwd

Once this completes, and has rebooted, you can login as root, and run the install steps below.
I normally modify the SSH port from the default of 22, to another non-standard values (eg. 22022) which gives a glimmer of extra protection from script kiddies (but not from real hackers, who would find the port anyway). I don’t allow direct root login via SSH except with PKI infrastructure. This is achieved by editing the SSH config file

I personally prefer to SSH into the VM instead of using the TTY – specifically using terminator (OR you can use PuTTY) since it allows copy on select & right-click paste+go, which makes life really easy


If you didn’t create your ERPNext user at install time, then you can do it like so…


Next, we’ll add the erpnext001 user to the sudoers list – the doubly safe way.


A note: in Debian Buster, the behaviour of su/sudo is different to previous versions. Using su erpnext001/su (for root), doesn’t convert the ENV/variables quite the same as before.
MUCH better to use su -l erpnext001 and/or su - (for root).


The actual setup/install process for ERPNext

login as root

I have seen a few occasions where frappe upgraded to v12.x.x, but erpnext only went to v11.x.x(latest) – something like this…
erpnext 11.1.46
frappe 12.0.14

This also relates to ~/frappe-bench/apps/erpnext/.git/config – it seems the default quotes around the FETCH command cause a mismatch. In this case, if you remove them, it seems to work OK.

erpnext 12.1.4
frappe 12.0.14


The resulting VM can be downloaded from here.
I can offer absolutely no guarantees about whether it will work for you – it does work 100% for me if thatโ€™s any consolation. It has everything normally required to get your system working. Please CHANGE all the relevant passwords and ports to suit your own needs as the current ones are public knowledge from the article!

It is at the point where you usually do your GUI setup and contains only the default installation info – 0% customised/configured.


18 thoughts on “[Superceded/OLD:2019-11-15] ERPNext manual install on Debian Buster 10.x

  1. the version-11 works fine.

    just wanted to try the latest, so after bench version, 11.x.x, and can access http://192.168.1.8:8249
    I tried running the upgrade for 12.x.x:

    results:
    ——————————————————————-
    [code]
    erpnext@erp:~/frappe-bench$ bench switch-to-branch version-12 frappe erpnext –upgrade
    WARN: bench is installed in editable mode!

    This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

    INFO: Fetching upstream unshallow for frappe
    $ git remote set-branches upstream ‘*’
    $ git fetch –all –unshallow –quiet
    Switching for frappe
    $ git checkout -f version-12
    Checking out files: 100% (1363/1363), done.
    Branch ‘version-12’ set up to track remote branch ‘version-12’ from ‘upstream’.
    Switched to a new branch ‘version-12’
    INFO: Fetching upstream unshallow for erpnext
    $ git remote set-branches upstream ‘*’
    $ git fetch –all –unshallow –quiet
    Switching for erpnext
    $ git checkout -f version-12
    Branch ‘version-12’ set up to track remote branch ‘version-12’ from ‘upstream’.
    Switched to a new branch ‘version-12′
    SUCCESS: Successfully switched branches for: frappe, erpnext
    Please run `bench update –patch` to be safe from any differences in database schema
    Installing applications…
    $ ./env/bin/pip install -q -U pip

    Installing frappe
    $ ./env/bin/pip install -q -U -e ./apps/frappe
    ERROR: google-api-core 1.21.0 has requirement google-auth=1.18.0, but you’ll have google-auth 1.7.1 which is incompatible.
    $ yarn install
    yarn install v1.22.4
    [1/4] Resolving packages…
    [2/4] Fetching packages…
    [3/4] Linking dependencies…
    warning ” > bootstrap@4.3.1″ has unmet peer dependency “jquery@1.9.1 – 3″.
    warning ” > bootstrap@4.3.1″ has unmet peer dependency “popper.js@^1.14.7”.
    [4/4] Building fresh packages…
    Done in 127.35s.

    Installing erpnext
    $ ./env/bin/pip install -q -U -e ./apps/erpnext
    $ yarn install
    yarn install v1.22.4
    [1/4] Resolving packages…
    [2/4] Fetching packages…
    [3/4] Linking dependencies…
    [4/4] Building fresh packages…
    success Saved lockfile.
    Done in 0.19s.
    Updating node packages…

    Installing node dependencies for erpnext
    $ yarn install
    yarn install v1.22.4
    [1/4] Resolving packages…
    success Already up-to-date.
    Done in 0.10s.

    Installing node dependencies for frappe
    $ yarn install
    yarn install v1.22.4
    [1/4] Resolving packages…
    success Already up-to-date.
    Done in 0.90s.
    Migrating erp.dunncox.lan
    Traceback (most recent call last):
    File “/usr/lib/python3.7/runpy.py”, line 193, in _run_module_as_main
    “__main__”, mod_spec)
    File “/usr/lib/python3.7/runpy.py”, line 85, in _run_code
    exec(code, run_globals)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 99, in
    main()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
    click.Group(commands=commands)(prog_name=’bench’)
    File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 764, in __call__
    return self.main(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 717, in main
    rv = self.invoke(ctx)
    File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 555, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/decorators.py”, line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py”, line 26, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 266, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 40, in migrate
    clear_global_cache()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/cache_manager.py”, line 54, in clear_global_cache
    clear_website_cache()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 322, in clear_cache
    frappe.clear_cache(“Guest”)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py”, line 578, in clear_cache
    frappe.cache_manager.clear_user_cache(user)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/cache_manager.py”, line 32, in clear_user_cache
    clear_notifications(user)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/notifications.py”, line 120, in clear_notifications
    config = get_notification_config()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/notifications.py”, line 200, in get_notification_config
    return frappe.cache().hget(“notification_config”, user, _get)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 178, in hget
    value = super(RedisWrapper, self).hget(_name, key)
    File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/redis/client.py”, line 1963, in hget
    return self.execute_command(‘HGET’, name, key)
    File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/redis/client.py”, line 668, in execute_command
    return self.parse_response(connection, command_name, **options)
    File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/redis/client.py”, line 680, in parse_response
    response = connection.read_response()
    File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/redis/connection.py”, line 629, in read_response
    raise response
    redis.exceptions.ResponseError: WRONGTYPE Operation against a key holding the wrong kind of value
    erpnext@erp:~/frappe-bench$ batch version
    -bash: batch: command not found
    erpnext@erp:~/frappe-bench$ bench version
    WARN: bench is installed in editable mode!

    This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

    erpnext 12.10.0
    frappe 12.7.3
    [/code]
    —————————————————-

  2. change:
    sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8

    to:
    sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys 0xF1656F24C74CD1D8

    error:
    erpnext001@erp:~$ mysql -u root
    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
    erpnext001@erp:~$

  3. Dear Trent,
    Thanks for the VM image.can you guide me how to access erpnext from host machine.
    virtualbox:NAT mode
    have tried with port forwarding,but not working

    1. Hi Arjun
      NAT mode always gives me trouble (ie. I lack sufficient knowledge to do it via NAT), so I generally use bridged mode. I’m pretty sure it CAN be done on NAT, but I don’t know how.
      When I have some free time, I can try to play around and see if it will work, but I can’t promise if or when I’ll get to it.

  4. Bench isn’t being installed correct or something, stuck on #147.

    Do you have an updated guide for the latest (12.1.8) kind sir? ๐Ÿ™‚

    1. Here’s my output:

      fatal: [localhost]: FAILED! => {
      “changed”: true,
      “cmd”: [
      “bench”,
      “new-site”,
      “sub.domain.com”,
      “–admin-password”,
      “XXX”,
      “–mariadb-root-password”,
      “XXX”
      ],

      1. Oops, wrong one.

        Here’s my output.

        ERROR: botocore 1.13.17 has requirement python-dateutil=2.1; python_version >= “2.7”, but you’ll have python-dateutil 2.8.1 which is incompatible.

        I’ve pip installed botocore but still a no go…

    2. Which OS are you using?
      #147 might fail if you have created a subdir called site1.local already, and then you run this command again.
      Could you send me trace screens on trent@murgatroyd.za.net and I will have a look.

    3. After the update/patch to v12 at the end, it should have the latest version of 12.x.18

      1. I’m using Ubuntu 18.04 at the moment, but I’ve tried replicating exact steps of yours in Debian Buster as well (Debian wouldn’t let me get through starting at line 57, with installing of dependencies…).

        But on Ubuntu 18.04, it’s all going well until Bench part, where it gives me that botocore and dateutil errors. I’ve looked into the error and found that changes made on Github repo of botocore is being bombarded with dateutil changes as well…

        I’ll just wait it out a little bit.

        1. Although I have successfully installed it on an ubuntu machine (I think I had to do a few workarounds), it is specifically for Debian Buster 10.x – the dependency issues from ubuntu are not included in the sequence.
          I recommend trying it on a freshly installed minimal debian 10 machine.

          1. It was fresh Debian ๐Ÿ™‚

            At this point, I’m willing to give you access to my fresh Debian VPS if you find the time ๐Ÿ˜€

          2. Try adding this (after the wkhtmltopdf section)… I have updated the script
            sudo apt install -y python-dateutil
            If it doesn’t work, we can try the VPS route over the weekend

  5. Got stuck at line 55 & 57, showing multiple errors of missing dependent pacakages

    1. If possible, could you send me the screenshot/trace of the errors and I will have a look.

  6. I thought that the preparation process would be more difficult, but thanks for clarifying anyway! It’s a pleasure to read your posts!

Leave a Reply to Trent Cancel reply

Your email address will not be published. Required fields are marked *

3 − 3 =