Easy install setup guide for erpnext installation on Ubuntu 20.04 LTS. With some modification of course

Hi Nikunj,

Which version of install.py did you fork? From the master or develop branch?

I’d like to keep this as a diff in a git tree for easier tracking.

Cheers

@idlethread

You can follow the following pull request :
https://github.com/frappe/bench/pull/1017

currently we are working on merging this changes into develop branch.

Let me know if you need more info.

Regards,

Thanks Nikunj. Very helpful.

I cloned your tree and I think the following branches: patch-1, patch-2 and patch-3 are all required to get this working correctly. Am I right?

It seems the easy_install CI job failed with this branch. Not sure if it is related, from a cursory glance.

bench setup lets-encrypt site.com is still python 2.7 based. So, http may be ok with this setup but unless python 2.7 can be installed in unbuntu 20, lets-encrypt bench command cannot be used.

Hi Joseph,

Can you attach some error message? I just ran 2to3 on bench/commands/setup.py, util.py and bench/config/lets_encrypt.py and it only came back with a couple of print fixes.

Hi @idlethread

Patch-3 should work it for ubuntu 20.04… it is work in progress… we are having some minor issues which should be solved.

What is your intent ? to have installation on ubuntun 20.04 ?

@Joseph_Marie_Alba

For lets encrypt try have look on the following post :

Yes, I want to install on 20.04.

I’m currently debugging the following wrt to libssl1.1.

TASK [common : install pdf prerequisites for Ubuntu >= 18.04] ****************************************************************************
task path: /tmp/.bench/playbooks/roles/common/tasks/ubuntu.yml:33                                                                         
<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 /root/.ansible/tmp/ansible-tmp-1592584259.791432-237492467221591 `" && echo an
sible-tmp-1592584259.791432-237492467221591="` echo /root/.ansible/tmp/ansible-tmp-1592584259.791432-237492467221591 `" ) && sleep 0'     
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/packaging/os/apt.py                                              
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-2757280cf1n2d/tmpofokeotr TO /root/.ansible/tmp/ansible-tmp-1592584259.791432-23749246722
1591/AnsiballZ_apt.py                                                                                                                     
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1592584259.791432-237492467221591/ /root/.ansible/tmp/ansible-tmp-15
92584259.791432-237492467221591/AnsiballZ_apt.py && sleep 0'                                                                              
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1592584259.791432-237492467221591/AnsiballZ_apt.py && sleep 0
'                                                                                                                                         
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1592584259.791432-237492467221591/ > /dev/null 2>&1 && sleep 0'      
The full traceback is:                                                                                                                    
  File "/tmp/ansible_apt_payload_io54cny6/__main__.py", line 434, in package_status                                                       
    pkg = cache[pkgname]                                                                                                                  
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 305, in __getitem__                                                            
    raise KeyError('The cache has no package named %r' % key)

fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "allow_unauthenticated": false,
            "autoclean": false,
            "autoremove": false,
            "cache_valid_time": 0, 
            "deb": null,
            "default_release": null,
            "dpkg_options": "force-confdef,force-confold",
            "force": true,
            "force_apt_get": false,
            "install_recommends": null,
            "only_upgrade": false, 
            "package": [
                "libssl1.0-dev"
            ],
            "pkg": [
                "libssl1.0-dev"
            ],
            "policy_rc_d": null,
            "purge": false,
            "state": "present",
            "update_cache": null,
            "upgrade": null
        }
    },
    "msg": "No package matching 'libssl1.0-dev' is available"
}

PLAY RECAP *******************************************************************************************************************************
localhost                  : ok=5    changed=0    unreachable=0    failed=1    skipped=3    rescued=0    ignored=0   

Traceback (most recent call last): 
  File "install.py", line 465, in <module>
    install_bench(args)
  File "install.py", line 261, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 385, 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=pcbkingdom']' returned non-zero exit status 2.

My bench has the needed changes AFAICT.

$ tail -n 20 bench/playbooks/roles/common/tasks/ubuntu.yml
    force: yes
  when: ansible_distribution_version is version_compare('14.04', 'ge')

- name: install pdf prerequisites for Ubuntu < 18.04
  apt:
    pkg:
      - libssl-dev
    state: present
    force: yes
  when: ansible_distribution_version is version_compare('18.04', 'lt')

- name: install pdf prerequisites for Ubuntu >= 18.04
  apt:
    pkg:
      - libssl1.1
    state: present
    force: yes
  when: ansible_distribution_version is version_compare('18.04', 'ge')

...

@idlethread

Yes along with the install.py you also need to change some other files.

https://github.com/frappe/bench/pull/1019

https://github.com/frappe/bench/pull/1018

Let me know if you are still facing some troubles.

Regards,
Nikunj Patel

That’s the reason I merged your patch-2 and patch-3 branches. So I have all these changes.

But for some reason, ansible is still search for libssl1.0-dev.

git grep libssl1.0-dev returns nothing in bench.git.

And I’ve deleted all the caches in /root/.cache and /root/.ansible just to be sure. But still see this error.

@idlethread

did you check your

check what is the status of libssl ?

Regards

@Nikunj_Patel I just found it and it is indeed libssl1.0-dev there. I delete that folder to see if it was a cached value and re-reran the playbook but it still re-appears with the same value.

Anyway to make it reflect the new value?

@idlethread

I would suggest you not to delete the /tmp/ .bench/ folder.

Just change the required files and rerun the sudo python3 install.py --production --user Your_USERNAME --mariadb-version 10.5 --verbose

This should get you going.

OK, but the playbook is doing something very wrong if it is able to create /tmp/.bench with a value that is not reflected anywhere obvious in the code.

Sounds like a bug, doesn’t it?

I’d like to create a CI loop around this script and I can’t

@idlethread

need to look that into more detail to confirm if it is a bug.

My aim at the moment was to make ERPnext work on ubuntu20.04.

If you make it through let me know.

It then crashed against at nodejs version. Fixed by changing version in tmp/.bench/playbooks/roles/nodejs/defaults/main.yml to 12.

Then it crashed while setting up dns_caching:

TASK [dns_caching : Add dnsmasq to network config] ***************************************************************************************
task path: /tmp/.bench/playbooks/roles/dns_caching/tasks/main.yml:11                                                                      
<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 /root/.ansible/tmp/ansible-tmp-1592588322.8201768-161253966731486 `" && echo a
nsible-tmp-1592588322.8201768-161253966731486="` echo /root/.ansible/tmp/ansible-tmp-1592588322.8201768-161253966731486 `" ) && sleep 0'  
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/files/lineinfile.py                                              
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-366140hf6wllb/tmpss07g_ck TO /root/.ansible/tmp/ansible-tmp-1592588322.8201768-1612539667
31486/AnsiballZ_lineinfile.py                                                                                                             
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1592588322.8201768-161253966731486/ /root/.ansible/tmp/ansible-tmp-1
592588322.8201768-161253966731486/AnsiballZ_lineinfile.py && sleep 0'                                                                     
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1592588322.8201768-161253966731486/AnsiballZ_lineinfile.py &&
 sleep 0'                                                                                                                                 
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1592588322.8201768-161253966731486/ > /dev/null 2>&1 && sleep 0'     
ERROR! The requested handler 'restart network manager' was not found in either the main handlers list nor in the listening handlers list  
Traceback (most recent call last):                                                                                                        
  File "install.py", line 465, in <module>                                                                                                
    install_bench(args)                                                                                                                   
  File "install.py", line 261, in install_bench                                                                                           
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)                                                                            
  File "install.py", line 385, 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=pcbkingdom']' returned non-zero exit status 1. 

Just re-ran the installer at which point it crashed at wkhtmltox.

TASK [wkhtmltopdf : Install wkhtmltox deb] ***********************************************************************************************
task path: /tmp/.bench/playbooks/roles/wkhtmltopdf/tasks/main.yml:90
<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 /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526” && echo ansible-tmp-1592588604.6127613-269544128595526=“echo /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526” ) && sleep 0’
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/packaging/os/apt.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-41550f8c7tcde/tmp7l06r0u8 TO /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526/AnsiballZ_apt.py
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526/ /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526/AnsiballZ_apt.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526/AnsiballZ_apt.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /root/.ansible/tmp/ansible-tmp-1592588604.6127613-269544128595526/ > /dev/null 2>&1 && sleep 0’
The full traceback is:
File “/tmp/ansible_apt_payload_pgoqtn87/main.py”, line 718, in install_deb
pkg = apt.debfile.DebPackage(deb_file)
File “/usr/lib/python3/dist-packages/apt/debfile.py”, line 77, in init
self.open(filename)
File “/usr/lib/python3/dist-packages/apt/debfile.py”, line 87, in open
self._debfile = apt_inst.DebFile(self.filename)

fatal: [localhost]: FAILED! => {
“changed”: false,
“invocation”: {
“module_args”: {
“allow_unauthenticated”: false,
“autoclean”: false,
“autoremove”: false,
“cache_valid_time”: 0,
“deb”: “/tmp/wkhtmltox.deb”,
“default_release”: null,
“dpkg_options”: “force-confdef,force-confold”,
“force”: false,
“force_apt_get”: false,
“install_recommends”: null,
“only_upgrade”: false,
“package”: null,
“policy_rc_d”: null,
“purge”: false,
“state”: “present”,
“update_cache”: null,
“upgrade”: null
}
},
“msg”: “Unable to install package: E:Could not open file /tmp/wkhtmltox.deb - open (2: No such file or directory)”
}

Fixed that by copying the snippet for wkhtmltox again to /tmp/.bench/playbooks/roles/wkhtmltopdf/tasks/main.yml.

And then it finished! \o/

:smiley:

Since I was bothered with why /tmp/.bench was ignoring my local changes I dug further. Turns out, install.py has a clone_bench_repo that clones bench from the official website unless you use the --repo-url and --bench-branch options to point it to your own tree.

So now, I’m able to run w/o any errors by pushing the changes to my own git tree and the pointing --repo-url to it.

@idlethread

It was my bad… did not mentioned you to use my repo via --repo-url. The idea was to merge this changes with master branches so that everybody can use it. Hope the small issues will be resolved and soon it will be part of master branch.

cheers

Yesterday I revised my own installer scripts to deal with a few issues pointed out to me by those who gave them a try. The scripts are focused exclusively on 18.04 and 20.04. They’re just bash scripts; no Python or Ansible.

Original (locked???) post: An alternative installer for Ubuntu 20.04 LTS

The source code: Install ERPNext on Ubuntu Bionic 18.04 LTS and Focal 20.04 LTS · GitHub

My goal with those scripts was to create a sort of “didactic” installer … does the job but makes it clear what is going on.

I have opened a new thread to discuss them if you want to try a different type of installer

::==> An alternative installer for Ubuntu 20.04 LTS and Ubuntu 18.04 LTS

2 Likes

Hi Nikunj,
I tried the way with your modified “install.py” file here, but unfortunately I am facing this error, can you help how to proceed.
Note: I changed libssl from 1.0 to 1.1, for both i get the error.

Rerun sudo python3 install.py --production --user Your_USERNAME --mariadb-version 10.5 --verbose
after solving each issue you face. All the issue and their solution is mentioned below.

Thank you for the reply.
I noted that I was changing libssl1.0-dev to libssl1.1-dev. When I removed -dev from libssl1.1-dev it proceeded.