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

I have only seen that if you skip the line after the:

apt-get update
apt-get upgrade

The line I am talking about reads:

If you missed that line then you will run into trouble because the installer does not like to work from the root login.

However, I must also add that there are currently problems with the easy install script and it is failing in strange ways. I already have another thread on the forum about this, but there is no resolution yet.

~BKM

Understood, Thank you

@bkm

Perfect guide! Kudos!!!
Just a small edit:

sudo apt install python-pip

gives no installation candidate error.
It works with

sudo apt install python3-pip

Hope it helps :slight_smile:

Ok. Edited & Fixed in the steps at the top of this thread. Thank you for the reminder.

BKM

I just tried the install as described, but I run into the same issue that I experienced during the manual install:

[Errno 2] No such file or directory: '/home/erpnext/frappe-bench/env/bin/python

Any idea what goes wrong during the “bench init” run?

Here the output from your script:

TASK [bench : python3 bench init for production] *******************************
task path: /tmp/.bench/bench/playbooks/roles/bench/tasks/main.yml:44
<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-1622244757.3018384-10500-141330877233945 && echo ansible-tmp-1622244757.3018384-10500-141330877233945=“echo /var/tmp/ansible-tmp-1622244757.3018384-10500-141330877233945” ) && 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-5474dabc0upr/tmp70mre4hw TO /var/tmp/ansible-tmp-1622244757.3018384-10500-141330877233945/AnsiballZ_command.py
<127.0.0.1> EXEC /bin/sh -c ‘setfacl -m u:erpnext:r-x /var/tmp/ansible-tmp-1622244757.3018384-10500-141330877233945/ /var/tmp/ansible-tmp-1622244757.3018384-10500-141330877233945/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-updudkfkwxrohrwjzlblojsyencnepdc ; /usr/bin/python3 /var/tmp/ansible-tmp-1622244757.3018384-10500-141330877233945/AnsiballZ_command.py’”’"’ && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /var/tmp/ansible-tmp-1622244757.3018384-10500-141330877233945/ > /dev/null 2>&1 && sleep 0’
fatal: [localhost]: FAILED! => {
“changed”: true,
“cmd”: [
“bench”,
“init”,
“/home/erpnext/frappe-bench”,
“–frappe-path”,
GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript”,
“–frappe-branch”,
“version-13”,
“–python”,
“python3”
],
“delta”: “0:00:05.564139”,
“end”: “2021-05-28 23:32:43.045758”,
“invocation”: {
“module_args”: {
“_raw_params”: “bench init /home/erpnext/frappe-bench --frappe-path GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript --frappe-branch version-13 --python python3”,
“_uses_shell”: false,
“argv”: null,
“chdir”: null,
“creates”: “/home/erpnext/frappe-bench”,
“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-05-28 23:32:37.481619”,
“stderr”: “Cloning into ‘frappe’…\nAborted!”,
“stderr_lines”: [
“Cloning into ‘frappe’…”,
“Aborted!”
],
“stdout”: "ModuleNotFoundError: No module named ‘virtualenv.seed.via_app_data’\n\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\n\u001b[90m$ /usr/local/bin/virtualenv -q env -p python3\u001b[0m\n\n\u001b[93mGetting frappe\u001b[0m\n\u001b[90m$ git clone GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript --branch version-13 --depth 1 --origin upstream\u001b[0m\n\n\u001b[93mInstalling frappe\u001b[0m\n\u001b[90m$ /home/erpnext/frappe-bench/env/bin/python -m pip install -q -U -e /home/erpnext/frappe-bench/apps/frappe \u001b[0m\n[Errno 2] No such file or directory: ‘/home/erpnext/frappe-bench/env/bin/python’\n\u001b[91mERROR: There was a problem while creating /home/erpnext/frappe-bench\u001b[0m\nDo you want to rollback these changes? [y/N]: ",
“stdout_lines”: [
“ModuleNotFoundError: No module named ‘virtualenv.seed.via_app_data’”,
“\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”,
“\u001b[90m$ /usr/local/bin/virtualenv -q env -p python3\u001b[0m”,
“”,
“\u001b[93mGetting frappe\u001b[0m”,
“\u001b[90m$ git clone GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript --branch version-13 --depth 1 --origin upstream\u001b[0m”,
“”,
“\u001b[93mInstalling frappe\u001b[0m”,
“\u001b[90m$ /home/erpnext/frappe-bench/env/bin/python -m pip install -q -U -e /home/erpnext/frappe-bench/apps/frappe \u001b[0m”,
“[Errno 2] No such file or directory: ‘/home/erpnext/frappe-bench/env/bin/python’”,
“\u001b[91mERROR: There was a problem while creating /home/erpnext/frappe-bench\u001b[0m”,
"Do you want to rollback these changes? [y/N]: "
]
}

PLAY RECAP *********************************************************************
localhost : ok=67 changed=20 unreachable=0 failed=1 skipped=62 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=erpnext’]’ returned non-zero exit status 2.

@dkalisch The problem you are running into is caused by a a change in the redis.conf file.

All you have to do is edit the file as this post inticates:

After you get the failure you can edit the file like in the post and then re-run the install and it will work.

Hope that helps.

BKM

@bkm No, that was actually not the problem, I had the redis.conf set correctly to 127.0.0.1 only already. The problem was, that the virtualenv didn’t set up correctly.

I uninstalled everything python, redid etc. Then I started again according to the description here: https://github.com/frappe/frappe/wiki/The-Hitchhiker%27s-Guide-to-Installing-Frappe-on-Linux

It is manual, but at least I have more control over it now :slight_smile:

Then it would be helpful for you to add back to the post what exactly you found wrong with the virtualenv install and what fixed it so that others can also benefit from your revelation.

That is how the community grows here. Please post your specific fix and we can add it to the list of pre-requisites to get right before running the install.py (which is the topic of this thread).

Thanks in advance for your participation.

BKM

@bkm I actually don’t think that something was wrong with the script, it probably was more something I did before. I am trying to install ERPNext on a machine that already existed and not a fresh one.

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