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

frappe@VM-20-6-ubuntu:~/frappe-bench$ bench --site mysite install-app hrms
App payments already installed
App erpnext already installed

Installing hrms...
An error occurred while installing hrms: ('Module Def', 'HR', IntegrityError(1062, "Duplicate entry 'HR' for key 'PRIMARY'"))
Traceback (most recent call last):
  File "apps/frappe/frappe/model/base_document.py", line 499, in db_insert
    frappe.db.sql(
  File "apps/frappe/frappe/database/database.py", line 206, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 775, in _read_query_result
    result.read()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 1156, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, "Duplicate entry 'HR' for key 'PRIMARY'")

During handling of the above exception, another exception occurred:

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 288, in install_app
    add_module_defs(name, ignore_if_duplicate=force)
  File "apps/frappe/frappe/installer.py", line 608, in add_module_defs
    d.insert(ignore_permissions=True, ignore_if_duplicate=ignore_if_duplicate)
  File "apps/frappe/frappe/model/document.py", line 268, in insert
    self.db_insert(ignore_if_duplicate=ignore_if_duplicate)
  File "apps/frappe/frappe/model/base_document.py", line 526, in db_insert
    raise frappe.DuplicateEntryError(self.doctype, self.name, e)
frappe.exceptions.DuplicateEntryError: ('Module Def', 'HR', IntegrityError(1062, "Duplicate entry 'HR' for key 'PRIMARY'"))

Anybody can help to resolve this issue?

1 Like

I had this issue too. I was able to resolve it.

cd /tmp
wget https://github.com/redis/redis/archive/refs/tags/6.2.7.tar.gz
cd redis-6.2.7/
make
sudo make install

Thank you for a great guide. Worked perfectly.

Just a quick tip to those who are running on Azure like me. You have to edit NSG rules, Networking Security Group rules to allow port 443 connections to go through.

1 Like

Hello, how can i solve my login problem?

https://i.imgur.com/0Zj5SFo.jpg

I don’t know the right input.

Thank you

jannis

Date: August 18, 2022

The same problem for me.

Solution:

User, first line: Administrator
Pass, second line: password you set at the time of installation

i need help for this error
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.11.1 documentation

I followed this guide to the end without a hitch - thank you very much!! Where I ran into trouble is when switching to multi-domain. I succesfully do so, but the dashboard doesn’t have any apps when I log in. And I have no domain listed at the domain setting. Your further guidance will be highly appreciated.

Creation of your site - site1.local failed because MariaDB is not properly
configured.  If using version 10.2.x or earlier, make sure you use the
the Barracuda storage engine.

Please verify the settings above in MariaDB's my.cnf.  Restart MariaDB.  And
then run `bench new-site site1.local` again.

I got this error while creating new site, can you please help what configuration to use? and in my etc/mysql/mariadb.conf.d/ I don’t have mariadb.cnf file

Hi @holybilly, great to know that you managed to sail through the process without any issues. As for the modules, from the screenshot I think you have just installed Frappe framework and not the ERPNext app. Can you check which apps are installed on your instance by clicking on Help → About (top right corner in nav bar)?

Hi @auliabismar have you correctly followed step no. 3.1 and 3.2 in the guide? It looks like there is some misconfiguration on your MySQL server.

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.