An alternative installer for Ubuntu 20.04 LTS

I have created my own ErpNext installer for Ubuntu Focal Fossa 20.04 LTS.

It is available as a Github Gist

I have not tried it on bare metal or a cloud server yet. I did all tests on QEMU/KVM virtual machines: 2CPUs, 70GB disk, 3072GB memory. It’s a bash script, not Python.

I have run the scripts over and over again, continuously refining to minimize warnings, and I’ve put in environment tests to check if everything is where it’s expected to be.

The final Setup Wizard runs without flaws…

I believe there were two frequent sources of error in installation efforts:

  1. Confusion about when to install as root and when not to.
  2. Confusion about when to use Python 2 and when to use Python 3.

In this installer Python 2 is never used or even installed.
I use "sudo -A" wherever root privilege is necessary, so you’ll need to set that up. Instructions are found in the first of the five scripts.

Please give them a try and reply here with comments.


It sounds good. Would it be possible to have write
how to guide on your Github?
Does it install latest MariaDB version?
Would this be OK to use the Ubuntu Server edition?

Many thanks

There are five files. You will find explanations in the first of the five.

While not the most wonderful documentation you will ever see, I did mean for the code to be read and understood by an average programmer. So you will see many echo statements like …

echo -e “\n\nInstalling NodeJs and NPM”;

        :              : 

echo -e “\nInstalled NodeJs and NPM\n\n”;

… that show how the installation is progressing.

The installation is for Ubuntu Server 20:04 LTS Focal Fossa.

It works with the Ubuntu distribution defaults for all third party applications.


By the way…

I watch this space closely most days. If you run into difficulties you should find I get you an answer quickly.

I’ll roll the question and answer into the scripts … so you’ll actually be helping me :smirk:

Hi. Fist of all thanks for your work.

I’m recently discovered this ERP, but having a lot of issues installing ERPNEXT in U18.04

0 knowledge of programing or similar. Just a normal user.

May I know how to ¨run the scripts¨

Best regards

Thank you for your contribution. If I can make a suggestion for future versions. Prior to installation, there needs to be a check to determine if all requirements are satisfied (for example Ansible is running).

I noticed a lot of frustration due to crashed installed, when most of the time, the issue lies in the operating environment and not ErpNext itself.

Great work and easy to read code.

Hello Martin, thank you very much for this starting point.

I wish I could find something as simple as Vestacp that can make us start without much effort on a clean install.

I think if you can make an install like the one Vestacp offer it will make the wonder of many users here who struggle with installations.



  1. Connect to your server as root via SSH

ssh root@your.server
2. # Download installation script
curl -O
3. # Run it

I will take a look at your script and try to make it run. Many thanks for you effort on this!

@crafter @codeman71

I split the job into 5 scripts for a reason.

The 1st one is "source"d by the other 4.

You need to log out and back in again after the 2nd one.

You need to reboot after the 3rd one.

The 4th must complete, and be left running, while you run the 5th one.

Something in the 5th one causes the ‘bench’ (started by the 4th one) to fail. So, just before the end of the 5th one you have to go back to the terminal that was running the 4th one and restart ‘bench’.

I don’t know the reasons for those “gotcha’s” and don’t intend to investigate. What’s there is good enough for my needs. If you can make it better, please do.

I do recommend * * * AS STRONGLY AS POSSIBLE * * * ==> run it in a virtual machine that permits snapshots. KVM, Virtual Box, VmWare … wuddevr.

When you’ve run the 1st script … SNAPSHOT.
When you’ve run the 2nd script … SNAPSHOT.

When you’ve run the Wizard … SNAPSHOT.

When you notice a typo in the Company name and can’t spend a day trying to figure out where and how to fix it …REVERT SNAPSHOT.


You’re fast! I tried using the normal easy (ansible-playbook) install script and got a couple of errors. Perhaps you could help a bit on the errors we’ll log?

1 Like

My ubuntu 20.04 install script is a lot shorter than yours, and only 1 file.: —

It’s interesting to see the different approaches!

Mine has only been tested as a vultr install/firstboot script.

1 Like

Yeah, I just did the normal shell scripting to see if it’d work at all.

It did, so I packaged it up to share. I am heartily sick of the whole installation quagmire and want to spend exactly 0 more minutes on it.

Yeah. You have more in depth knowledge of bench.

Looks good!

I don’t know about that, but I tried to optimize it to do everything from initial install all the way through, so it can be mostly automated.

Unfortunately some of the bench commands basically require user input, like --root-password doesn’t seem to work. I haven’t gotten around to trying to fix that. I think my next todo around ERPNext will be trying to get it to run under nixOS, and probably skipping over bench as much as possible.

this script sounds great. I did try to use but did not succeed. Maybe would be great if the passwords/other user inputs could be setup at the beginning with constant and comments. So it makes it easy for common user like me to understand whole concept.

I am not programmer or system admin usually on trial-error basis end up getting things working. However this ERPNext is quite a complex to to install. I do think it is a great system however the time I spending to configure and still not giving the confidence that has been done properly. I would like to spend more time with the actual system to migrate DB, learn and understand, the configuration is throwing me back…

I have changed the password for

cat <<EOF | mysql -uroot
create user bench@localhost identified by ‘passowrd???’;
GRANT all privileges on . to ‘bench’@‘localhost’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
GRANT all privileges on . to ‘bench’@‘127.%.%.%’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
GRANT all privileges on . to ‘root’@‘localhost’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
GRANT all privileges on . to ‘root’@‘127.%.%.%’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
bench new-site --db-password password

I prepared clean install Ubuntu server 20.04 did update/upgrade command and restart after I ran below command:

sudo bash

However end up with few errors:

ERROR: /opt/bench/frappe-bench/apps/frappe is not a valid editable requirement.It should either be a path to a local project or a VCS URL (beginning with svn+ git+, hg+, or bzr+).

[Errno 2] No such file or directory: ‘bench’
ERROR: There was a problem while creating /opt/bench/frappe-bench
Do you want to rollback these changes? [Y/n]:

I think angelfish and MartinHBramwell did a good job I wish i could get around your files to make this work.

1 Like

This is interesting. You were trying to maximize use of bench but ran into the --root-password issue. My scripts don’t use bench much and have no root password issue.

That looks like the error that occurs when you run bench get-app with bad parameters, but line 228 looks ok, to me

Try running the script to where you guess it is failing, and force it to stop just before with, for example:

echo -e "*** Script curtailed ***";
exit 1;

You might have to move that pair of lines up or down a few lines to home in on exactly the line that fails.


Thanks. Most people say I’m “half fast”.

Hi MartinHBramwell
I have tried your script and got stuck

When in the terminal i process the steps with for example mkdir ${HOME}/.ssh;
$HOME will pick /HOME/USERNAME/ …
however when I run the script the $HOME now referers to /root ?

Not sure if you can give me a push with this maybe easier to talk or see you doing it if you have short time.
many thanks


  • /root/.ssh/ :: was not found
  • SUDO_ASKPASS :: expected ‘SUDO_ASKPASS’ to contain ‘/root/.ssh/’.


Did you run the scripts with sudo???

You should not!

Please research “sudo -A” and “SUDO_ASKPASS”

I’ll add a trap to disallow running them with “sudo”.