Fully Automated Install Script for ERPNext Version 14

@flexy2ky Thanks for the quick reply. It worked as you described.
ERPNext 15 is installed and the Login page loads, but without any CSS or JS files loaded, as they all end with a 404 not found error. I could see the files, they do exist. Though, I guess that has to do with some nginx settings in frappe bench. I’ll take a look into this later.

Awesome work! Thanks a lot again.

This is a permission issue. Go to your user’s home directory and run this command sudo chmod 755 /home/$(echo $USER) This should assign the necessary permissions to your user to be able to run the css and js files. You can then go to the frappe-bench directory and run bench --site[your-site-name] migrate && bench restart && bench [your-site-name] clear-cache for good measure. this should fix the issue you’re facing.

Done! Now it works like a charm.

Awesome :wink:

1 Like

I’ll try ISA

Hello
Tried several times and here is the outcome , tried 5 times to install on V14 on Ubuntu 22 with latest updates but fails every time.
Tried 3 times on Ubuntu 22 with latest updates with V15 only one successful installation and two failed.
Tried one time on Debian 10 with V14 , no errors looks successful installation , but when you point browser with the machine IP it shows apache default page.
Any suggestions ?

Clearly your server has apache running and ERPNext uses Nginx hence your issue. you need to completely uninstall apache from your server if you want to use it for ERPNext. I suspect you’re using Contabo VPS cos i know their machines come with apache preloaded so you need to get rid of it.

@flexy2ky Just to say thanks, this script is brilliant and saves a lot of time :smiley:

1 Like

Firstly - thanks for the great script. It’s the only way I’ve managed the install.

FYI - I’ve been playing around with it for 23.10 as well as Noble Numbat beta. Though mostly just for version 15. Changed line 26 to:
SUPPORTED_VERSIONS=(“24.04” “23.10” “22.04” “20.04” “11” “10” “9” “8”)

And added these at about line 319:
sudo rm -f /usr/lib/python3.11/EXTERNALLY-MANAGED
sudo rm -f /usr/lib/python3.12/EXTERNALLY-MANAGED

just before “sudo pip3 install frappe-bench”.

Works a treat with 23.10. For 24.04 - python3-distutils is not yet in the noble repos as of the time of this posting. For now that causes line 224 in the script to baulk: apt install git python3-dev python3-setuptools python3-venv python3-pip python3-distutils redis-server.

But manually installing everything else on that line before running the script (with the mods I mentioned) - then both Frappe & ERPNext (15) appear to install just fine. I’m not a Python person & so I’ve no idea how important python3-distutils is - or what Canonical’s plans for it are.

BTW - it appears node is being installed twice. Once as per the script - and again from the standard repos. So installing 15 on 22.04 you end up with:
node --version
v18.19.1
nodejs --version
v12.22.9

Can cause an issue with the payments module on version 14.

Cheers - Len

It’s nice that you were able to install on Ubuntu 23 and 24. However, Frappe has not announced official support for those releases yet hence i don’t want to include support for them until Frappe announces support officially. This is to ensure dependency versions do not cause problems down the line for users. And from your attempt, you actually removed the higher python versions in order for the instance to work which is a situation you want to avoid in a production instance. Best to align installs with direct version compatibility to maintain stability.

Node is actually not being installed twice. The default node version on ubuntu 22.04 is v12.22.9 and the script uses nvm to install node (this is necessary for effective version control and switching based on specific Frappe/ERPNext version required) but since nvm allows for multiple node versions to exist it does not ovewrite the existing version.

Kindly someone assist. I have tried several scripts and steps but ending up with this;

Getting erpnext
$ git clone GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) --branch version-14 --depth 1 --origin upstream
Cloning into ‘erpnext’…
remote: Enumerating objects: 5102, done.
remote: Counting objects: 100% (5102/5102), done.
remote: Compressing objects: 100% (4389/4389), done.
fatal: the remote end hung up unexpectedly MiB | 268.00 KiB/s
fatal: early EOF
fatal: index-pack failed
subprocess.CalledProcessError: Command ‘git clone GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) --branch version-14 --depth 1 --origin upstream’ returned non-zero exit status 128.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/bench/commands/make.py”, line 75, in init
init(
File “/usr/local/lib/python3.8/dist-packages/bench/utils/render.py”, line 105, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/system.py”, line 102, in init
get_app(
File “/usr/local/lib/python3.8/dist-packages/bench/app.py”, line 765, in get_app
app.get()
File “/usr/local/lib/python3.8/dist-packages/bench/utils/render.py”, line 126, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/app.py”, line 204, in get
self.bench.run(
File “/usr/local/lib/python3.8/dist-packages/bench/bench.py”, line 48, in run
return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/init.py”, line 169, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: git clone GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) --branch version-14 --depth 1 --origin upstream

ERROR: There was a problem while creating frappe-bench

What is the hardware/vps configuration you’re using?

Its just a local instance i need to setup on a laptop not sure if i answered the question correctly.

Thank you for the script, great work. I would like to know how to add HRMS to this

The error suggests an issue with your hardware but i cannot tell exactly why and your screenshot suggests there should be enough resources to run the installation successfully.

cd frappe-bench
bench get-app hrms --branch [your-erpnext-version]
bench --site [your-site-name] install-app hrms

[your-erpnext-version] eg: version-15
[your-site-name] eg: erp.mydomain.com

first i tried just hrms without branch and version number. it gave error and entire site got corrupted and gave 404 error. i tried installing with version number as same as erpnext version and it worked fine.

simply adding these lines does not work. You still needed to install python3.10 which is currently not supported in the script. while i have been able to handle all other issues with installing on 24.04, setting up production has been a pain… so if you did set up production successfully would you mind sharing what you did because i’ve tried many fixes but fail2ban fails to set up and the process breaks.

Hi flex2sky

Sorry not to reply earlier - have been snowed under. That fail2ban problem is NEW.

I always install on a fresh copy of Ubuntu Server. The repos for 23.10 install python 3.11 & for 24.04 that’s 3.12. Starting in 3.11 there’s now a requirement to use a venv when installing stuff - otherwise “sudo pip3 install frappe-bench” should give “error: externally-managed-environment”

See: python - pip install -r requirements.txt is failing: "This environment is externally managed" - Stack Overflow
and: PEP 668 – Marking Python base environments as “externally managed” | peps.python.org

/usr/lib/python3.12/EXTERNALLY-MANAGED is just an empty marker file and removing it causes Python to revert to the way it behaves in 3.10. I included this after reading installs like: Installing ERPNext version 15 on Ubuntu 23+

That said - I now see it’s a very ham-fisted way for production. Years down the track you may end up with multiple incompatible versions of Python all over your drive. I’m not experienced with venv - so I’ll try a deep dive into pipx & learn how to use that.

With regards fail2ban - I just did an install (24.04) - after “$ bench setup role fail2ban” you get:

ERROR! [DEPRECATED]: ansible.builtin.include has been removed. Use include_tasks or import_tasks instead. This feature was removed from ansible-core in a release after 2023-05-16. Please update your playbooks.

The error appears to be in ‘/usr/local/lib/python3.12/dist-packages/bench/playbooks/roles/mariadb/tasks/main.yml’: line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  • include: centos.yml
    ^ here
    ERROR: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘{“production”: true, “admin_emails”: “”, “mysql_root_password”: null, “container”: false}’, ‘-t’, ‘fail2ban’]’ returned non-zero exit status 1.

From Ansible’s site: ansible.builtin.include – Include a play or task list — Ansible Documentation … “we are looking at deprecating it in the near future.” That was 2.10 & they appear coy in updating their docs. But see: ansible.builtin.include has been Removed in Ansible version 2.16 · Issue #389 · ansible-ThoTeam/nexus3-oss · GitHub

And with the install I just did I’ve got:
bower@erpdemo:~/frappe-bench$ ansible --version
ansible [core 2.16.7]

I’ll can check install logs at work tomorrow. I didn’t get an error last time I installed on 24.04. I’ll also try to flesh out that node vs nodejs issue.

I did an install on what must have been the beta version on 20 March - no problem. That was with ansible-9.3.0, ansible-core-2.16.4 & fail2ban (1.0.2-3).

Then on 14 May I did another install on 24.04 - again no prob. With ansible-9.5.1, ansible-core-2.16.6 & fail2ban (1.0.2-3).

So - whatever’s gone wrong must be quite recent.

The install I did last night that reproduced your error was with ansible-playbook [core 2.16.7]. Version 2.16.7 was released on 20 May - if that fits with the error you got. Couldn’t see anything in the changelog relating to this though: ansible/changelogs/CHANGELOG-v2.16.rst at v2.16.7 · ansible/ansible · GitHub

You’ll see that if you do a “sudo bench setup production [username]” on the failed install you should get the error again.

I’ll post this to the main ERPNext forum & see what they say.

@Elkanaaa I have a fix for it already in the install script. i am including support for 23.04, 24.04 and Debian 12. Will be published in a couple of hours. I’m just testing across distros and versions to ensure full support is still guaranteed for existing distros.