Ubuntu 18.04 -ERPNext installation

Hello @fishter and @apkrajar

Have you come across this error*

     TASK [bench : Install ERPNext to default site] *************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["bench", "--site", "site1.local", "install-app", "erpnext"], "delta": "0:00:02.576363", "end": "2019-02-12 11:33:47.311120", "msg": "non-zero return code", "rc": 1, "start": "2019-02-12 11:33:44.734757", "stderr": "", "stderr_lines": [], "stdout": "site1.local does not exist", "stdout_lines": ["site1.local does not exist"]}
	to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP *************************************************************************************************************************************************************************************************
localhost                  : ok=76   changed=15   unreachable=0    failed=1   

Traceback (most recent call last):
  File "install.py", line 425, in <module>
    install_bench(args)
  File "install.py", line 122, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 338, in run_playbook
    success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'))
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=frappe']' returned non-zero exit status 2
1 Like

Sorry, no.

I’m not using the playbook install method.

i have used Easy install method.

How are you doing?

Hi, I have installed version 11 using easy install script on ubuntu 18.04 on ESXi and VirtualBox.
First run of the script ends with error message, if I run it once again, finished without errors and everything seems to be working OK.

EDIT: this is mentioned error message

TASK [dns_caching : Add dnsmasq to network config] *****************************
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 425, in <module>
    install_bench(args)
  File "install.py", line 122, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 338, in run_playbook
    success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'))
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=frappe']' returned non-zero exit status 1

@Suresh_Alien
I’m using manual installation and I have followed the below steps to prepare the system (this steps are for Frappe & ERPNext v10)

sudo apt -y install python-minimal
sudo apt -y install git build-essential python-setuptools python-dev libffi-dev libssl-dev

wget https://bootstrap.pypa.io/get-pip.py
sudo -H python get-pip.py

sudo -H pip install --upgrade pip setuptools
sudo -H pip install ansible

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

sudo sh -c "echo 'deb [arch=amd64,i386] https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu '$(lsb_release -cs)' main' > /etc/apt/sources.list.d/MariaDB-10.2.list"


sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.nodesdirect.com/mariadb/repo/10.2/ubuntu bionic main'

sudo apt update
sudo apt -y install mariadb-server libmysqlclient-dev // set your password

Restart MariaDB and enable it to automatically start at boot time.

sudo systemctl restart mariadb
sudo systemctl enable mariadb

sudo apt-get install curl

sudo curl --silent --location https://deb.nodesource.com/setup_8.x | sudo bash -
sudo apt -y install nginx nodejs redis-server

sudo systemctl start nginx
sudo systemctl enable nginx

sudo systemctl start redis-server
sudo systemctl enable redis-server

sudo apt-get update
sudo apt-get install xvfb libfontconfig wkhtmltopdf
sudo npm install -g yarn

Now the System is ready to install Frappe & ERPNext

1 Like

@apkrajar @martin42

I do not use the development install, but I do use the easy install method with 'install.py script and setting up --production server.

The error that @martin42 got during install was relate to a different way the playbook treats the default user for installing the system. If you want to install in in /frappe then you have to make sure that the frappe user is NOT created before you run the install script. When you do run it is should look like this:

sudo python install.py --production --user frappe (or whatever user you define)

If the default user is created before the scrit runs the the error pops up. If you do not create the user first and let the install script do it for you, there is no error.

The only thing to watch out for is if yo are using Ubuntu 18.04 the way hostnames are created and saved has changed and it cn cause you even further errors later. So it needs to be fixed before you login to the system for the first time to run the setup wizard.

Check this post for details about the hostname issue:

Hope this helps…

BKM

@bkm

The frappe user was not created before running the install script, I’m 100% sure. I have tried to replicate it on the same machine (Lubuntu 18.04 on VirtualBox)

First run was with not existing user like this:

martin@lubu18vb:~$ id -u frappe
id: ‘frappe’: no such user
martin@lubu18vb:~$ sudo python install.py --production --user frappe

Second run was with existing (current) user:

martin@lubu18vb:~$ id -u martin
1000
martin@lubu18vb:~$ sudo python install.py --production --user martin

In both cases I got exactly the same error message I posted above after first run of the script and in both cases I got successful finish with no errors by running install script second time.

I also tried the same procedure on fresh install of ubuntu server 18.04

First run with not existing user frappe:

martin@ubusrv18vb:~$ id -u frappe
id: ‘frappe’: no such user
martin@ubusrv18vb:~$ sudo python install.py --production --user frappe
[sudo] password for martin:

Second run was with existing (current) user:

martin@ubusrv18vb:~$ id -u martin
1000
martin@ubusrv18vb:~$ sudo python install.py --production --user martin
[sudo] password for martin:

Here I got also in both cases identical error message, but different from error from the post above. Running script second time didn’t help here, every next run finished with the same error.

TASK [common : Install prerequisites using apt-get] ****************************
[DEPRECATION WARNING]: Invoking "apt" only once while using a loop via
squash_actions is deprecated. Instead of using a loop to supply multiple items
and specifying `pkg: "{{ item }}"`, please use `pkg: ['dnsmasq', 'fontconfig',
'git', 'htop', 'libcrypto++-dev', 'libfreetype6-dev', 'liblcms2-dev', 'libssl-
dev', 'libwebp-dev', 'libxext6', 'libxrender1', 'libxslt1-dev', 'libxslt1.1',
'libffi-dev', 'ntp', 'postfix', 'python-dev', 'python3-dev', 'python-tk',
'screen', 'vim', 'xfonts-75dpi', 'xfonts-base', 'zlib1g-dev', 'apt-transport-
https', 'libsasl2-dev', 'libldap2-dev', 'libcups2-dev', 'pv']` and remove the
loop. This feature will be removed in version 2.11. Deprecation warnings can be
 disabled by setting deprecation_warnings=False in ansible.cfg.
failed: [localhost] (item=[u'dnsmasq', u'fontconfig', u'git', u'htop', u'libcrypto++-dev', u'libfreetype6-dev', u'liblcms2-dev', u'libssl-dev', u'libwebp-dev', u'libxext6', u'libxrender1', u'libxslt1-dev', u'libxslt1.1', u'libffi-dev', u'ntp', u'postfix', u'python-dev', u'python3-dev', u'python-tk', u'screen', u'vim', u'xfonts-75dpi', u'xfonts-base', u'zlib1g-dev', u'apt-transport-https', u'libsasl2-dev', u'libldap2-dev', u'libcups2-dev', u'pv']) => {"changed": false, "item": ["dnsmasq", "fontconfig", "git", "htop", "libcrypto++-dev", "libfreetype6-dev", "liblcms2-dev", "libssl-dev", "libwebp-dev", "libxext6", "libxrender1", "libxslt1-dev", "libxslt1.1", "libffi-dev", "ntp", "postfix", "python-dev", "python3-dev", "python-tk", "screen", "vim", "xfonts-75dpi", "xfonts-base", "zlib1g-dev", "apt-transport-https", "libsasl2-dev", "libldap2-dev", "libcups2-dev", "pv"], "msg": "No package matching 'dnsmasq' is available"}
        to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=1

Traceback (most recent call last):
  File "install.py", line 425, in <module>
    install_bench(args)
  File "install.py", line 122, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 338, in run_playbook
    success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'))
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=martin']' returned non-zero exit status 2
martin@ubusrv18vb:~$

Ok, I have had a different experience with this. I have only installed v11 on 5 or 6 VPS servers so my pool of testing is limited to that base.

I received the message you got (word for word minus the username) 3 times. In all three cases I had already created the “bkm” user and used “bkm” in the --user switch when I ran the install script. All 3 failed as yours did. In each case I went back to the server and completely re-installed the Ubuntu 18.04 OS to start again fresh. In each case I also ran the install.py script WITHOUT first creating my “bkm” user and in all 3 cases the install was successful with no errors.

This was on 2 different hosting services (two servers on one and one server on the other). Your experience is very different. I could not tell you why, but hopefully someone here like maybe @codingCoffee could chime in with a hint at what is going on in the install script as it pertains to the existing / non-existing Ubuntu users during install.

I may have assumed too much about how it was working because I was able to recreate my condition in multiple places, but it is also true that the playbook and the install.py script change frequently.

I am at a loss to explain your condition.

BKM

The error is “No package matching ‘dnsmasq’ is available”

It’s possible that your OS image is a bit old. Have you tried updating your packages with
sudo apt update and sudo apt upgrade?

Im also trying install ERPNext on Ubuntu 18.04 Desktop on virtual machine.
but also got an error, now im looking for updated step by step how can I install ERpNext using Easy Install in documentation…

Hope someone post or share the working step by step installation on Ubuntu 18.04

Please post your error details…

Thank you for your reply, I will , im now trying again now. with fresh install Ubuntu 18.04

@kirthi here Sir the error encountered after i I tried the command in easy install.

Fetched 33.8 MB in 30s (1,126 kB/s)
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.15.0-43.46_amd64.deb 404 Not Found [IP: 202.90.159.172 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Err:1 Index of /ubuntu bionic-updates/main amd64 libcurl4 amd64 7.58.0-2ubuntu3.5
404 Not Found [IP: 202.90.159.172 80]
Err:2 Index of /ubuntu bionic-updates/main amd64 curl amd64 7.58.0-2ubuntu3.5
404 Not Found [IP: 202.90.159.172 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/curl/libcurl4_7.58.0-2ubuntu3.5_amd64.deb 404 Not Found [IP: 202.90.159.172 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/curl/curl_7.58.0-2ubuntu3.5_amd64.deb 404 Not Found [IP: 202.90.159.172 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Err:1 Index of /ubuntu bionic-updates/main amd64 libcurl4 amd64 7.58.0-2ubuntu3.5
404 Not Found [IP: 202.90.159.172 80]
Err:2 Index of /ubuntu bionic-updates/main amd64 curl amd64 7.58.0-2ubuntu3.5
404 Not Found [IP: 202.90.159.172 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/curl/libcurl4_7.58.0-2ubuntu3.5_amd64.deb 404 Not Found [IP: 202.90.159.172 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/curl/curl_7.58.0-2ubuntu3.5_amd64.deb 404 Not Found [IP: 202.90.159.172 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Is this on a VM? Anyway, there is no internet connectivity in this machine. Please ensure that this VM has internet connection and run the script again

Sir I’m sure that i have internet connection.

I think you need to run apt update/upgrade before you rerun the install script

sudo apt update -y && sudo apt upgrade -y

System was fresh installation, updated just before installation of erpnext (apt-get update, apt-get upgrade), sources are:

martin@ubusrv18vb:~$ cat /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu bionic main
deb http://archive.ubuntu.com/ubuntu bionic-security main
deb http://archive.ubuntu.com/ubuntu bionic-updates main

It is on virtual machine, tried both on VirtualBox on notebook and ESXi server - in both cases got exactly the same result.

EDIT: when I tried to install dnsmasq manually got this:

martin@ubusrv18vb:~$ sudo apt install dnsmasq
[sudo] password for martin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package dnsmasq is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  dnsmasq-base

E: Package 'dnsmasq' has no installation candidate

martin@ubusrv18vb:~$ sudo apt install dnsmasq-base
Reading package lists... Done
Building dependency tree
Reading state information... Done
dnsmasq-base is already the newest version (2.79-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I tried it once more with fresh installed ubuntu server, but now it was installed from 18.04.2 “alternative” server image (installations mentioned above were made using 18.04.1 live install image). And with this version 18.04.2, everything works like @bkm described in post 8 and 10 above - if there is no frappe user created before running install script, everything works absolutely OK without errors. If you create frappe user before running install script or install with current user, you got error for the first time, but if you run install script once again, it finishes without errors and erpnext looks to be working OK.

In Ubuntu 18.04 LTS, the dnsmasq package is only available through Universe, not Main.

deb http://ubuntu.ca-west.mirror.fullhost.io/ubuntu/ bionic-security universe

If you add the Universe repository, then apt-get update, you should be able to install it.

2 Likes

Yes, you are right, if you install from image 18.04.2 you get by default different source list than you get from image 18.04.1 (here you get only main)