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

Thank you for responding.

Correct, I do not have any apps installed apart from Payments on site2.local, but have everything I installed on site1.local working great.
When I try to install, I get the below error:

I have tried bench --site [sitename] reinstall as suggested but I am not sure where I am going wrong.

billy@vmi1070139:~/frappe-bench$ bench --site site2.local install-app erpnext
App payments already installed

Installing erpnext…
An error occurred while installing erpnext: ERPNext can only be installed on a fresh site where the setup wizard is not completed.
You can reinstall this site (after saving your data) using: bench --site [sitename] reinstall
Traceback (most recent call last):
File “apps/frappe/frappe/commands/site.py”, line 413, in install_app
_install_app(app, verbose=context.verbose, force=force)
File “apps/frappe/frappe/installer.py”, line 283, in install_app
out = frappe.get_attr(before_install)()
File “apps/erpnext/erpnext/setup/install.py”, line 38, in check_setup_wizard_not_completed
frappe.throw(message) # nosemgrep
File “apps/frappe/frappe/init.py”, line 522, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 490, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 442, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: ERPNext can only be installed on a fresh site where the setup wizard is not completed.
You can reinstall this site (after saving your data) using: bench --site [sitename] reinstall

I ran into some problem upgrading from v13 in ubuntu 20.04 so, I decided to take backup with files and clean install new ubuntu 22.04 and installed v14 following this guide. There were no problems in installation of ERPN v14. But when I tried to restore the old database, this error appeared.

ERROR 2006 (HY000) at line 5828: Server has gone away
Table ‘tabDefaultValue’ missing in the restored site. Database not installed correctly, this can due to lack of permission, or that the database name exists. Check your mysql root password, validity of the backup file or use --force to reinstall

This gave Internal Server error in web browser.
Luckily I had taken backup of v14 before giving restore command. I restore and I have v14 up and running but I have yet to restore old data.

Here’s the old site_config.json:

{
 "db_name": "_456ad5fddff313da",
 "db_password": "some password here",
 "db_type": "mariadb",
 "encryption_key": "some key here",
 "pause_scheduler": 0,
 "user_type_doctype_limit": {
  "employee_self_service": 10
 }
}

Here’s the new site_config.json in v14:


{
 "db_name": "_e516733d80f92fe9",
 "db_password": "some other password",
 "db_type": "mariadb",
 "maintenance_mode": 0,
 "user_type_doctype_limit": {
  "employee_self_service": 20
 },
 "domains": [
  "erp.example.com"
 ]
}

How can I resolve this issue and restore v13 backups into v14 ?

Hi @anupd can you please confirm the exact steps that you’re performing to restore the v13 backup into the new v14 installation? Also, I hope you have correctly configured MySQL permissions in the v14 setup.

Hello,
I am so sorry, I should have updated the progress here.

I learnt that the error Server has gone away. has something to do with max_allowed_packet in /etc/mysql/my.cnf.

Adding this line below [mysqld] solved that problem.

max_allowed_packet = 1024M

Apparently this error had occurred because my sql backup file was too huge.

Even though this problem was solved, ERPNext did not run as expected as there appeared other problems. I ultimately had to install fresh v14 again on ubuntu 22.04, then rollback to v13 (with switch to branch), then restore that backup in v13 and then upgrade it to v14. Now ERPNext is running fine.

I had to go through all this fuss because a simple upgrade of OS to 22.04, upgrading of python/pip and then v13 to v14 produced alot of errors which I could not resolve. I wish someone had made a detailed guide like this one to upgrade v13 to v14.

Thank you for this wonderful step by step guide, though.

@anupd great to know that you managed to resolve the issue. If possible to share the exact steps you followed to restore the v13 database into v14 post the OS update to 22.04. It’ll be helpful to others who might face similar issues. Thanks!

Sure. I will try to list out the steps soon. However, since I didnot record the steps back then, I can now only share the steps and not the exact commands.

Anyone also got this error? My upgrade is stuck on it…

@pronext you can safely ignore this error message and continue with the installation process.

I thought that too, but is takes a little more commands than that.
I created a update script which was working for me on to update v13 to v14 and I shared it here in the community: V13 to v14 Upgrade Script - want that for every major version

Thank you @shashank_shirke for easiest & simplest guide to install ERPnext V14, as for the windows user this one is the best guide.

I have done installation on ubuntu server 22.04 and debian 11 bullseye netinstall with minimal lxde environment on virtualbox & comparing both like the debian version more just because of the low memory footprint and better performance. For debian version I have install the python 3.10 and related packages, mariadb and default-libmysqlclient-dev package with aptitude (to solve the dependency error) from bookworm and remaining from stable repo.

Now to update erpnext version which command to use bench update or bench update --reset?

@NURAV glad to know that you found this guide helpful. Regarding updating, first try using bench update. Only if there are any local changes to the core files you’ll need to use the --reset flag which will overwrite all local changes so use it with caution.

You can force install an app with bench install-app hrms --force

Just wanted to say thanks very much for this! I tried DigitalOcean’s 2020 tutorial twice but kept having issues with all their complex extra command steps… Was very straight forward and easy to follow if you’ve setup a web server before.

how to get education app?

Hi @GhadaEbrahim to get any app you just need to run the bench get-app and then then bench install-app commands. For eg. to get education app you can run the following:

bench get-app education
bench --site yoursitename.com install-app education

For more details check the official repo here: GitHub - frappe/education

After initiating frappe I am having some waring “WARN: restart failed: Couldn’t find supervisorctl in PATH”

Any one know what to do?

I have tried to install with this waring I was successfully install erpnext.

You must not complete the setup wizard before installing erpnext app.

Once you perform setup wizard, erpnext app cannot be installed.

I get the same error too with hrms app.

However I also get an error when installing payments app:

An error occurred while installing payments: 'CustomField' object has no attribute 'is_virtual'

My problem was to UPGRADE a site, instead of installing a new site. I do this then it works:

bench --verbose --site SITE_NAME migrate

Then you can:

bench --verbose --site SITE_NAME install-app hrms

Hope this helps

All this was working fine until 90 days were over. The certificate seemed to renew it self but after a huge trouble I learnt that we had to run this line after 90 days to keep the web application running on https.

sudo certbot --nginx

Is there any way to automate this ?