Install v13 Production on Ubuntu 20.04 VPS - This is how I did it "Easy Install" script

Anyone got error with Ldap ad? I’m getting ldap3.core.exceptions.LDAPKeyError: “key ‘samaccountname’ not found” error

To everyone who keeps on getting errors, easy install scripts are abandonware and are often outdated. A very simple and foolproof solution is to install bench using the Hitchhikers guide to installing Frappe Bench on linux. A few things you should be careful about is to install python3 instead of python2.7 and install the related python3 packages and not the 2.7 ones. I recently bought a new vps and tried almost every single easy install guide on the community and the internet and in the end the only thing that worked was the hitchhikers guide. Also it works best with production mode.

1 Like

Abandonware?!?

I have to interject here. I know the easy install script (install.py) is not always the best working answer, but it is certainly not abandonware. It is actively updated every week.

The problems associated with using the easy install method are varied and constantly changing through no fault of the script itself.

The easy install script uses a playbook method of installing all of the necessary components to get an operational system. The playbook package itself is another open source 3rd party code set that is NOT maintained by the Frappe-ERPNext team. IT is maintained by it’s own development project. It is also frequently updated very much like ERPNext is updated. Sometimes those updates interfere with the smooth operation of the ERPNext installation. When that happens, our Frappe developers have to spend valuable volunteer time to dig into code they didn’t write to try and figure out how to get the installation process to work again.

If that isn’t enough… Almost every aspect of the frappe-erpnext systems are built from, or rely on other 3rd party open source projects in order to function. Packages like git, curl, yarn, redis, ansible, and wkhtmltopdf are all required to get a functional frappe/erpnext system and yet every one of them are open source projects themselves that are independently run by their own communities. Each of those independent projects also release updates and changes which sometimes causes our installs to fail.

I acknowledge that the easy install methods may not get nearly enough testing time, but it is certainly not to blame for all of the apparent failures to install. The developers of frappe/erpnext cannot police the code of every package they use to build their own project.

One final note on Hitchhikers Guide…
It is also full or errors! It is not updated very often and it references very old package versions that are either no longer available or otherwise obsolete. It is also NOT written for the non-coder/non-developer users that are experiencing the most difficulties with installs. The only people that can get any help from the Hitchhikers Guide are other developers or coders that can see the packages and already understand the significance of each block of the install. They can already understand what needs to be changed in the text. Makes you wonder why none of those people that push the guide ever go back and fix the text. After all it is also an open source text. :grin:

So, if you find problems with the easy install method, there is also another (better explained) set of manual steps that can help even the novice user get a successful installation. Try this:

So to @Vesper_Solutions I do not believe it is fair to call the easy install method abandonware just yet. The fact that is doesn’t always work is why we have this community. We help each other with work-arounds for such problems when we can.

BKM

1 Like

I agree that the community serves as a great help for all of us but for those who rely on frappe and erpnext for real life professional use cases, time is of the essence.

@bkm Recently I had asked an expert to create an Easy Install script for Ubuntu 20. It works flawlessly each time. I have tested multiple times and it has never failed me. What users dont understand is that by default Ubuntu 20 installs python 3.8 and that version has to be replaced before starting fresh bench installation. Reinstalling OS does not do help.

This is how I do it. I am novice on Linux but I follow this method religiously.

export LC_ALL=C.UTF-8
adduser [name of new user, dont use frappe or erpnext. Make it unique]
usermod -aG sudo [user name you created above]
sudo su [user name you created above]
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python3.6
wget https://gist.githubusercontent.com/Muzzy73/6297904cf8171d04902e25b9dc1fc447/raw/8e8d65b53e96f608dc344ccb92f7dd638246e8e9/install.py
sudo python3 install.py --production --user [user name you created in the above] --version [ERP version you want like 11,12,13] --site [site name you want to set like erp.abc.com] --mysql-root-password [SQL password you want to set] --admin-password [Admin Password you want to set]  --verbose

You have to enter information in the [ ] and without the brackets.

Once I have entered the last command I go for a coffee and smoking break. Back in 15 minutes to see Bench + Frappe + ERPNext has been successfully installed! message.

I cant guarantee how long this will work but it has yet to fail me. And please dont ask me what is the difference in my install.py than the official version. I have no idea.

Best of luck.

P.S. All my server are Intel Xeon 4 core, 8 GB RAM, 200 GB SSD. Server specification also make huge difference.

2 Likes

Join frappe team and help them in fixing the install script. You’re expecting them to fix things for you for free while you earn from it. Common thinking about open source being free but there is a lot of time and effort put in to make things work.

Good luck with your projects.

Thanks for sharing @Muzzy !!

I think your process works for you for 2 reasons.

  • Number one, you have your own install.py file to work from (although thanks for sharing the link to it in your command).

  • Number 2, you are likely installing everything from scratch yourself for the Ubuntu OS. When Ubuntu 20.04 is allowed to install things from it’s own list of repositories, it does in fact install Python 3.8 and that is a problem. Once Python 3.8 is installed you CANNOT get rid of it and install 3.6. The python installer will not let you overwrite the newer with the older version. So, this tells me you are installing python 3.6 as part of your OS install.

Most of the rest of us are using prepared OS images from the VPS provider and they almost all already have python 3.8 as part of the image before you even spin it up. It is already “baked in” the image as soon as you fire it up. Most of my effort to get install.py to work with Ubuntu 20.04 was related to getting it to work with python 3.8 and I did get that to work. I have several servers running ERPNext v13.4.1 and python 3.8 on Ubuntu 20.04

However, this “baked in” problem started to bother me a great deal and I started looking for alternatives. I wound up switching my new installs to Debian 10 because the images for it an all of the VPS providers I have been using are pretty stripped down and you have to install all of the prerequisites yourself anyway. That gets me past any further problems with cutting edge packages being “baked in” the images I spin up.

I am happy to hear someone else is having such good luck with installs.

Thank you for the explaining the steps.

BKM

I don’t install the OS. It is installed by the VPS when I purchase it. My servers also have 3.8 hence the intial extra command of getting python 3.6 before ERPNext installation command. I have tried the above method on VPS and local server OS (server edition).

Hi @Muzzy
Thanks a lot for sharing.
If I want to use your shared steps, is it valid for develop installation? what need to be changed for the same?

@nmami I have updated what you need to do for information in [ ]

Hi @Muzzy
Just now completed successfully production install

But my question if i need to install development not production what steps I need to use?

I got your last update between [] but still for production instance all steps?

thx

just change --production to --develop. Rest all same

Failed, unfortunately don’t know why.

Sorry but dont have any idea about develop. Maybe you can set production completely and then migrate to develop.

1 Like

worked once like a charm. then i tried to create another droplet, following the exact steps but fails, tried more than 4 time now. Digital ocean droplet - Ubuntu 20.04 LTS , 1vCPU 2GB ram 50GB SSD

TASK [bench : Setup Procfile] ****************************************************************************************
task path: /tmp/.bench/bench/playbooks/roles/bench/tasks/main.yml:60
<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 `"&& mkdir /var/tmp/ansible-tmp-1624372529.164145-42719-56623924971094 && echo ansible-tmp-1624372529.164145-42719-56623924971094="` echo /var/tmp/ansible-tmp-1624372529.164145-42719-56623924971094 `" ) && 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-275201gw0qoy8/tmpddzhdowa TO /var/tmp/ansible-tmp-1624372529.164145-42719-56623924971094/AnsiballZ_command.py
<127.0.0.1> EXEC /bin/sh -c 'setfacl -m '"'"'u:[USER]:r-x'"'"' /var/tmp/ansible-tmp-1624372529.164145-42719-56623924971094/ /var/tmp/ansible-tmp-1624372529.164145-42719-56623924971094/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n  -u [USER] /bin/sh -c '"'"'echo BECOME-SUCCESS-uyvaboicpersjjsurhzpqbmhpfmnpqml ; /usr/bin/python3 /var/tmp/ansible-tmp-1624372529.164145-42719-56623924971094/AnsiballZ_command.py'"'"' && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1624372529.164145-42719-56623924971094/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "changed": true,
    "cmd": [
        "bench",
        "setup",
        "procfile"
    ],
    "delta": "0:00:00.480597",
    "end": "2021-06-22 14:35:29.921658",
    "invocation": {
        "module_args": {
            "_raw_params": "bench setup procfile",
            "_uses_shell": false,
            "argv": null,
            "chdir": "/home/[USER]/frappe-bench",
            "creates": "/home/[USER]/frappe-bench/Procfile",
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": true
        }
    },
    "msg": "non-zero return code",
    "rc": 1,
    "start": "2021-06-22 14:35:29.441061",
    "stderr": "Aborted!",
    "stderr_lines": [
        "Aborted!"
    ],
    "stdout": "\u001b[93mWARN: bench is installed in editable mode!\n\nThis is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`\n\u001b[0m\nA Procfile already exists and this will overwrite it. Do you want to continue? [y/N]: ",
    "stdout_lines": [
        "\u001b[93mWARN: 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`",
        "\u001b[0m",
        "A Procfile already exists and this will overwrite it. Do you want to continue? [y/N]: "
    ]
}

No idea why it fails with exact same config.

I see the same errors on other systems now as well. When I created this in April it was working well, but as you can see in other posts in this thread, the Ubuntu image has been changing and becomes unfit for installing ERPNext without a great deal of work (which also seems to change every week as well).

To that end, I have stopped using Ubuntu as my OS and started using Debian 10 because it tends to be a bit more stripped down and less stuff that you don’t need built into it. Here is my steps for getting Debian 10 running:

However…
If you insist on using Ubuntu, there is one other method you can try. I used these step for a while before I turned away from Ubuntu. You might find this to be working better:

Hope this helps.

BKM

2 Likes

Tried v13 debian10 as per your suggestion. works well. restored my prod db from v12 and with minimal effort, its up and running now. only faced minor hiccups due to invalid data field options in my custom apps.

Thanks.

2 Likes

This failed for me, I think…? Not sure how to interpret the results. I’m on a physical machine (8 core 2.6 Ghz with 16GB Ram) running 20.04.

PLAY RECAP ********************************************************************************************
localhost : ok=14 changed=9 unreachable=0 failed=1 skipped=13 rescued=0 ignored=0

Traceback (most recent call last):
File “install.py”, line 500, in
install_bench(args)
File “install.py”, line 281, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 416, 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=jlherpnext’]’ returned non-zero exit status 2.

Had wrong version of Maria…upgraded to 10.5 and thought I had made a little progress as the script seemed to run longer but…hmm, looks the same. :frowning:

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

Traceback (most recent call last):
File “install.py”, line 500, in
install_bench(args)
File “install.py”, line 281, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 416, 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=jlherpnext’]’ returned non-zero exit status 2.

Lately I had given up installing in Ubuntu :slight_smile:. I don’t know why but it always failed (manual and easy install).
Now I only manually install on CentOS 8. And as CentOS is deprecated, I tried to install in AlmaLinux (the CentOS alternative) and always succeed.