Install ERPnext 12 on fresh VPS running Ubuntu 18.04 LTS 64bit

Hi everyone,
I am new to ERPnext and tried to install / setup ERPnext v12 on a fresh VPS running Ubuntu 18.04 LTS 64bit, but wasn’t successful. I have tried basically everything I found in this forum as well as other problem solving approaches on the internet.

My VPS is hosted by strato.de and is using Virtuozzo as virtualizer. Since Virtuozzo is being used Easy Install Scripts as well as Docker don’t work (necessarily).

I have mainly used this guide: https://github.com/frappe/frappe/wiki/The-Hitchhiker's-Guide-to-Installing-Frappe-on-Linux

The first error occurs when using: bench init --frappe-branch version-12 --python /usr/bin/python3 frappe-bench :slight_smile:

Building frappe assets…

events.js:291
throw er; // Unhandled ‘error’ event
^

Error: spawn /usr/bin/node EAGAIN
at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
at onErrorNT (internal/child_process.js:470:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted ‘error’ event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
at onErrorNT (internal/child_process.js:470:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: ‘EAGAIN’,
code: ‘EAGAIN’,
syscall: ‘spawn /usr/bin/node’,
path: ‘/usr/bin/node’,
spawnargs: [
‘/home/roman/frappe-bench/apps/frappe/node_modules/jest-worker/build/workers/processChild.js’
]
}

–> I can avoid the error when using: bench init frappe-bench
–> But after succesful install --> ls doesn’t show complete directory (in comparison to guide)

When I try to create a new site with:
bench new-site h2922090.stratoserver.net --db-host 81.169.223.219 --db-port 80

This happens:

MySQL root password:
Traceback (most recent call last):
File “/home/myuser/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 583, in connect
**kwargs)
File “/usr/lib/python3.6/socket.py”, line 724, in create_connection
raise err
File “/usr/lib/python3.6/socket.py”, line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/myuser/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 99, in
main()
File “/home/myuser/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/myuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/myuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/myuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/myuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/myuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/myuser/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/myuser/frappe-bench/apps/frappe/frappe/commands/site.py”, line 40, in new_site
db_port=db_port, new_site=True)
File “/home/myuser/frappe-bench/apps/frappe/frappe/installer.py”, line 72, in _new_site
no_mariadb_socket=no_mariadb_socket,
File “/home/myuser/frappe-bench/apps/frappe/frappe/installer.py”, line 106, in install_db
setup_database(force, source_sql, verbose, no_mariadb_socket)
File “/home/myuser/frappe-bench/apps/frappe/frappe/database/init.py”, line 16, in setup_database
return frappe.database.mariadb.setup_db.setup_database(force, source_sql, verbose, no_mariadb_socket=no_mariadb_socket)
File “/home/myuser/frappe-bench/apps/frappe/frappe/database/mariadb/setup_db.py”, line 39, in setup_database
if force or (db_name not in dbman.get_database_list()):
File “/home/myuser/frappe-bench/apps/frappe/frappe/database/db_manager.py”, line 60, in get_database_list
return [d[0] for d in self.db.sql(“SHOW DATABASES”)]
File “/home/myuser/frappe-bench/apps/frappe/frappe/database/database.py”, line 122, in sql
self.connect()
File “/home/myuser/frappe-bench/apps/frappe/frappe/database/database.py”, line 75, in connect
self._conn = self.get_connection()
File “/home/myuser/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 91, in get_connection
local_infile = frappe.conf.local_infile)
File “/home/myuser/frappe-bench/env/lib/python3.6/site-packages/pymysql/init.py”, line 94, in Connect
return Connection(*args, **kwargs)
File “/home/myuser/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 325, in init
self.connect()
File “/home/myuser/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 630, in connect
raise exc
pymysql.err.OperationalError: (2003, “Can’t connect to MySQL server on ‘81.169.223.219’ ([Errno 111] Connection refused)”)

Any help appreciated! My goal is to have ERPnext running in production mode.

Seems your MariaDB installation fails. I would try this:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python3-minimal build-essential python3-setuptools
wget https://raw.githubusercontent.com/frappe/bench/develop/install.py
export LC_ALL=C.UTF-8
python3 install.py --production --version 12 --user=frappe --verbose

With the verbose option you will get more detail. You can also look for logs as well. Good luck.

That command seems okay. I’ve manually installed dozens of times with:
bench init frappe-bench --frappe-branch version-12 --python /usr/bin/python3

You definitely want this command to succeed, before trying to create a new site. I suggest reviewing some prerequisite software:

  • Node.js installed.
    • It’s important to know the version you’re working with. Node v12 and earlier required Python2. Node v13+ does not. However, using Node v13+ might require some adjustments to Frappe’s package.json, to use later versions of Node-SASS. It’s complicated.
  • Yarn installed.
  • wkhtmltopdf.

To retry installation, just delete the ‘frappe-bench’ directory, and run the 'bench init` command again.

Hi, thanks for your help! What node version do you use? I was using Node v12. Python 2.7 and python3 are both installed. Yarn was installed as well as wkhtmltopdf… still the same error. Should I try Node v13?

I’m currently using Node v15. But I’ve previously installed ERPNext using every Node version since 9.0.

I would definitely recommend sticking with the v12 you have. It’s a lot easier, until you’ve mastered ERPNext Manual Installation.

I’ve never seen your error before:
Error: spawn /usr/bin/node EAGAIN
You may want to search the web for that.

Regarding the 2nd problem with MySQL/MariaDB. First, make sure you can successfully connect to MariaDB as root using a SQL client.

Next, are you certain your DB port is 80? That seems very unusual, since 80 is normally for HTTP traffic. The standard TCP port for MariaDB is 3306.

1 Like

For Error: spawn /usr/bin/node EAGAIN


For MariaDB

@romanqvist I wrote a step by step tutorial to install on Debian which will translate over to Ubuntu quite well: Installing ERPNext on Debian 10 - BuFf0k (hrcity.co.za)
There are a lot of specific dependencies for getting bench to properly install on Debian (Ubuntu is a Debian Clone) and specific versions are necessary. It took me a day to figure out the missing steps which I compiled into the above tutorial.
Part of the issues with the scripts from Frappe relates to the changes made to MariaDB and root access from non-root users being restricted, which is one of the issues I see in your errors. The trick is to create a non-root MariaDB User with full root privileges and an empty db with the same name as the non-root root user. Then you specify the name of the root user during the bench installation.

MariaDB Config
As root (or sudo) mysql -u root
CREATE DATABASE bench;
GRANT ALL PRIVILEGES on . to bench@localhost identified by ‘your_password’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

When creating the bench site for erpnext as the user you created for bench:
bench new-site erpnext.domain.com –mariadb-root-username bench

1 Like

Thanks! I will try it rightaway.

Nothing works so far. The spawn /usr/bin/node EAGAIN still exists… no idea what I could change.

The EAGAIN error is being thrown while Node.js tries to build and bundle assets/resources. This can be a CPU-intensive activity.

I found this brief explanation of EAGAIN.
https://web.archive.org/web/20130508062559/http://www.wlug.org.nz/EAGAIN

Basically, some async actions are failing to return results on-time.

@romanqvist What does your VPS’ cpu and memory look like? I’m wondering if VPS resources are the root cause.

1 Like

That’s also what I figured. My VPS has 6vCores and 16 GB RAM - in theory. But I found some reports on people who had similar problems with other software using strato.de VPS-servers.

I will try Hetzner.com now. Since I am in Germany and because of regulation here I need my data to be stored in the EU, this seems like a good approach. Found several people on the forum who had very good results with it.

I have the system up and running now! Thanks for all your help!
This ERPNext auf Hetzner Cloud installieren did the trick for me! The guide is in German but works copy / paste!

2 Likes

As you are in Germany you use contabo.com. They have data center in Germany. Reasonably priced and ERPNext works fine on their VPS. Make sure you get the SSD one and not the SSD boosted.

1 Like