[Guide] How to install ERPNext v15 on Linux Ubuntu (step-by-step instructions)

What OS version did you install on?

1 Like

ubuntu 22.04.4 LTS

for your information, today i also tried again, it starts well and until it says mariadb installed successfully is very well, but after that the terminal closes and fades away.

If you can say what errors you get, it can help debug it…
That been said,
I too am having some problems with the installation (be it with or without the script).
I am getting to the part of sudo bench setup production frappe and there is an error at bench setup role fail2ban:

ERROR! [DEPRECATED]: ansible.builtin.include has been removed. Use include_tasks or import_tasks instead. This feature was removed from ansible-core in a release after 2023-05-16. Please update your playbooks.

The error appears to be in '/usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/mariadb/tasks/main.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- include: centos.yml
  ^ here
ERROR: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-vvvv', '-e', '{"production": true, "admin_emails": "", "mysql_root_password": null, "container": false}', '-t', 'fail2ban']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py", line 370, in setup_roles
    run_playbook("site.yml", extra_vars=extra_vars, tag=role)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/__init__.py", line 345, in run_playbook
    subprocess.check_call(args, cwd=os.path.join(bench.__path__[0], "playbooks"))
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-vvvv', '-e', '{"production": true, "admin_emails": "", "mysql_root_password": null, "container": false}', '-t', 'fail2ban']' returned non-zero exit status 1.
ERROR: bench setup role fail2ban
subprocess.CalledProcessError: Command 'bench setup role fail2ban' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py", line 110, in setup_production
    setup_production(user=user, yes=yes)
  File "/usr/local/lib/python3.10/dist-packages/bench/config/production_setup.py", line 37, in setup_production
    setup_production_prerequisites()
  File "/usr/local/lib/python3.10/dist-packages/bench/config/production_setup.py", line 28, in setup_production_prerequisites
    exec_cmd("bench setup role fail2ban")
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/__init__.py", line 178, in exec_cmd
    raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: bench setup role fail2ban

Any idea what’s going on?
The system is Ubuntu 22.04, installed from ubuntu 22.04.4 media.
Maybe there is a way to change the ansible version, or change the playbook according to the change in the ansible software?

I did fix it by manually changing: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/mariadb/tasks/main.yml, so that the three includes in the begining of the file will be include_tasks as the error message states in the begining. This seemed to fix the issue…

https://medium.com/@prasantpant/update-your-frappe-to-specific-latest-version-a08689fcd296

https://medium.com/devops-dev/erpnext-for-production-via-linux-os-step-by-step-frappe-fa36d0ed061e

I have updated the script to handle the Ansible issue which breaks production setup due to the recent update. I’ve also added support for Ubuntu 23.04, 24.04 and Debian 12.

2 Likes

I am happy that you were able to find out a way, but the problem is i dont see any error message, the terminal closes automatically

Hmmm… :thinking:
Maybe try:

./erpNext15install.sh >> log.log

And see if the file has anything in it…

1 Like

works like charm thanks :slight_smile:

Thanks for your help, I am going to delete my current ubuntu and install a fresh one and do the steps again, i will update you.
Thank you very much

1 Like

That will work for sure

1 Like

Oh no, thank you. And good luck.

strong text

According to the tutorial, python has always been 3.8. After using other commands to install 3.10, it got confused. Can it still be solved?

@shashank_shirke I am getting this error while erpnext setup , getting error in the mysql password bench new-site erp.codewithkarani1.com
MySQL root password:
Traceback (most recent call last):
File “/usr/lib/python3.10/runpy.py”, line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.10/runpy.py”, line 86, in _run_code
exec(code, run_globals)
File “/home/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py”, line 110, in
main()
File “/home/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py”, line 20, in main
click.Group(commands=commands)(prog_name=“bench”)
File “/home/bench/erpnext/env/lib/python3.10/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/bench/erpnext/env/lib/python3.10/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/bench/erpnext/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/bench/erpnext/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/bench/erpnext/env/lib/python3.10/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/bench/erpnext/env/lib/python3.10/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/bench/erpnext/apps/frappe/frappe/commands/site.py”, line 74, in new_site
_new_site(
File “/home/bench/erpnext/apps/frappe/frappe/installer.py”, line 62, in _new_site
install_db(
File “/home/bench/erpnext/apps/frappe/frappe/installer.py”, line 132, in install_db
setup_database(force, source_sql, verbose, no_mariadb_socket)
File “/home/bench/erpnext/apps/frappe/frappe/database/init.py”, line 20, in setup_database
return frappe.database.mariadb.setup_db.setup_database(
File “/home/bench/erpnext/apps/frappe/frappe/database/mariadb/setup_db.py”, line 34, in setup_database
if force or (db_name not in dbman.get_database_list()):
File “/home/bench/erpnext/apps/frappe/frappe/database/db_manager.py”, line 64, in get_database_list
return [d[0] for d in self.db.sql(“SHOW DATABASES”)]
File “/home/bench/erpnext/apps/frappe/frappe/database/database.py”, line 161, in sql
self.connect()
File “/home/bench/erpnext/apps/frappe/frappe/database/database.py”, line 85, in connect
self._conn = self.get_connection()
File “/home/bench/erpnext/apps/frappe/frappe/database/mariadb/database.py”, line 76, in get_connection
conn = pymysql.connect(
File “/home/bench/erpnext/env/lib/python3.10/site-packages/pymysql/connections.py”, line 353, in init
self.connect()
File “/home/bench/erpnext/env/lib/python3.10/site-packages/pymysql/connections.py”, line 633, in connect
self._request_authentication()
File “/home/bench/erpnext/env/lib/python3.10/site-packages/pymysql/connections.py”, line 907, in _request_authentication
auth_packet = self._read_packet()
File “/home/bench/erpnext/env/lib/python3.10/site-packages/pymysql/connections.py”, line 725, in _read_packet
packet.raise_for_error()
File “/home/bench/erpnext/env/lib/python3.10/site-packages/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/bench/erpnext/env/lib/python3.10/site-packages/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, “Access denied for user ‘root’@‘localhost’ (using password: YES)”)
erpnext@erp:/home/bench/erpnext$ mysql -u root -p

Hi,

You are inputting the wrong mysql password. Please enter the correct password.

Thanks,

Divyesh Mangroliya

see this.

I made some adjustments to the script:
Added a fix to the aforementioned bench setup production... error, reset the script to handle Ubuntu 22.04.4 and above (with it’s newer-er handling of restarting processes after updates), and the option to add URI’s of additional custom apps.
Maybe now it will be better…

This instructions do not work!
I installed a fresh Linux Ubuntu 22.04 and followed each step which allread had several minor errors, after 7.5 I am not getting any further.
Again I did it 3 times.

try this GitHub - flexcomng/erpnext_quick_install: Unattended install script for ERPNext Versions, 13, 14 and 15

It also does not work: Collecting frappe-bench
Downloading frappe_bench-5.22.6-py3-none-any.whl (150 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 151.0/151.0 KB 3.3 MB/s eta 0:00:00
Collecting jinja2~=3.1.3
Downloading jinja2-3.1.4-py3-none-any.whl (133 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.3/133.3 KB 5.3 MB/s eta 0:00:00
Collecting honcho
Downloading honcho-1.1.0-py2.py3-none-any.whl (21 kB)
Collecting gitpython~=3.1.30
Downloading GitPython-3.1.43-py3-none-any.whl (207 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 207.3/207.3 KB 5.5 MB/s eta 0:00:00
Collecting python-crontab~=2.6.0
Downloading python_crontab-2.6.0-py3-none-any.whl (25 kB)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from frappe-bench) (2.25.1)
Collecting tomli
Downloading tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting semantic-version~=2.8.2
Downloading semantic_version-2.8.5-py2.py3-none-any.whl (15 kB)
Requirement already satisfied: click>=7.0 in /usr/lib/python3/dist-packages (from frappe-bench) (8.0.3)
Requirement already satisfied: setuptools>40.9.0 in /usr/lib/python3/dist-packages (from frappe-bench) (59.6.0)
Collecting gitdb<5,>=4.0.1
Downloading gitdb-4.0.11-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.7/62.7 KB 5.9 MB/s eta 0:00:00
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Requirement already satisfied: python-dateutil in /usr/lib/python3/dist-packages (from python-crontab~=2.6.0->frappe-bench) (2.8.1)
Collecting smmap<6,>=3.0.1
Downloading smmap-5.0.1-py3-none-any.whl (24 kB)
Installing collected packages: honcho, tomli, smmap, semantic-version, python-crontab, MarkupSafe, jinja2, gitdb, gitpython, frappe-bench
Successfully installed MarkupSafe-2.1.5 frappe-bench-5.22.6 gitdb-4.0.11 gitpython-3.1.43 honcho-1.1.0 jinja2-3.1.4 python-crontab-2.6.0 semantic-version-2.8.5 smmap-5.0.1 tomli-2.0.1
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: 12. Virtual Environments and Packages — Python 3.12.3 documentation
Traceback (most recent call last):
File “/usr/local/lib/python3.10/dist-packages/bench/commands/make.py”, line 75, in init
init(
File “/usr/local/lib/python3.10/dist-packages/bench/utils/render.py”, line 105, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/system.py”, line 64, in init
bench.setup.dirs()
File “/usr/local/lib/python3.10/dist-packages/bench/utils/render.py”, line 126, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/bench/bench.py”, line 338, in dirs
os.makedirs(self.bench.name, exist_ok=True)
File “/usr/lib/python3.10/os.py”, line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: ‘frappe-bench’

ERROR: There was a problem while creating frappe-bench
Do you want to rollback these changes? [y/N]:

I am also getting the same error even when i re install Ubuntu. It seems the commands that i used to input successfully are suddenly not working When i input this command

sudo bench setup production [frappe-user]

Below is the error

ERROR! [DEPRECATED]: ansible.builtin.include has been removed. Use include_tasks or import_tasks instead. This feature was removed from ansible-core in a release after 2023-05-16. Please update your playbooks.

The error appears to be in ‘/usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/mariadb/tasks/main.yml’: line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  • include: centos.yml
    ^ here
    ERROR: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘{“production”: true, “admin_emails”: “”, “mysql_root_password”: null, “container”: false}’, ‘-t’, ‘fail2ban’]’ returned non-zero exit status 1.
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 8, in
    sys.exit(cli())
    File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 132, in cli
    bench_command()
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1157, in call
    return self.main(*args, **kwargs)
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1078, in main
    rv = self.invoke(ctx)
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 783, in invoke
    return __callback(*args, **kwargs)
    File “/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py”, line 370, in setup_roles
    run_playbook(“site.yml”, extra_vars=extra_vars, tag=role)
    File “/usr/local/lib/python3.10/dist-packages/bench/utils/init.py”, line 345, in run_playbook
    subprocess.check_call(args, cwd=os.path.join(bench.path[0], “playbooks”))
    File “/usr/lib/python3.10/subprocess.py”, line 369, in check_call
    raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘{“production”: true, “admin_emails”: “”, “mysql_root_password”: null, “container”: false}’, ‘-t’, ‘fail2ban’]’ returned non-zero exit status 1.
    ERROR: bench setup role fail2ban
    subprocess.CalledProcessError: Command ‘bench setup role fail2ban’ returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 132, in cli
bench_command()
File “/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py”, line 110, in setup_production
setup_production(user=user, yes=yes)
File “/usr/local/lib/python3.10/dist-packages/bench/config/production_setup.py”, line 37, in setup_production
setup_production_prerequisites()
File “/usr/local/lib/python3.10/dist-packages/bench/config/production_setup.py”, line 28, in setup_production_prerequisites
exec_cmd(“bench setup role fail2ban”)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/init.py”, line 178, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: bench setup role fail2ban

1 Like