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

Hi Shashank
Iam able to login to erpnext v14 without any issues
all modules are working
Pdf output is without any errors
i have already started using it
the only problem is bench update
it throws the error as shown in my previous post 71/74
bench update --reset does the update with bot version warning
Regards
Hemanth

sudo apt-get install git python3-dev python3.10-dev python3-setuptools python3-pip python3-distutils redis-server -y

getting this error:

E: Unable to locate package python3.10-dev
E: Couldn’t find any package by glob ‘python3.10-dev’
E: Couldn’t find any package by regex ‘python3.10-dev’

Hi @MubeenMazhar

Can you please confirm which version of Ubuntu are you using? This guide is made specifically for Ubuntu 22.04 which has Python 3.10 as the default in its repositories.

This works, thank you! Two questions:

  • What is the routine for keeping this installation up to date?
  • Please do post instructions for SSL configuration!

To keep up with the latest releases you can use the standard bench update method. Make sure to take a backup of all your sites, databases and files before running the bench update command as it is known to break things.

For SSL configuration, you can run the following commands;

Before you begin, add an A record on your domain DNS and point it to the ERPN server IP address.

cd /home/[frappe-user]/frappe-bench/

bench config dns_multitenant on

bench setup add-domain [subdomain.yourdomain.com] --site [site-name]

bench setup nginx 
sudo service nginx reload

sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot

sudo ln -s /snap/bin/certbot /usr/bin/certbot

sudo certbot --nginx

On console prompt, select correct site number and trying access your site on https:// from the custom domain you just added.

Thanks,
Shashank

3 Likes

I would love to remove the Not Secure notice in my browser for my local installation. Would this work for local installations too? I own the key and crt files, would it be simple to swap them out?

No the certbot will not work for localhost environment. Also it won’t really make sense as the localhost is accessible only on your system. If you still want to access localhost via https:// then you can try the mkcert option as below;

Refer,

@shashank_shirke or to anyone:

First of all thanks for this guide. I’ve been able to follow it all the way to Step 5.5 bench new-site.

I run into mariadb/mysql error "Access Denied . . ". Have read a few threads and i think it has something to do with not being able to invoke mysql (need to SUDO) because of Mariadb 10.6, but it is not clear how the problem is solved. Have tried the ff with no avail:

  1. Grant all Privileges to root (seems doesn’t make sense to me since root has all access, but nevertheless tried it, no avail same error)
  2. Created a new mysql user (Frappe), grant all privileges to it, specified it as the mariadb root user with password during BENCH NEW-SITE, no avail same error

Can you or someone please provide some insight as to how this was solved? Much thanks!

Chris

Hi @cphoa28

Which cloud service provider are you using? This is a commonly reported issue on AWS EC2 instances and Azure virtual machines. Primary reason being, both providers don’t allow actual root access and instead create a system user with sudo permissions.

In your case, which user are you logged into when running the mysql installation? You can run sudo -i to enter as root user and then create a new user that has will be added to root group. Use this newly created user (with root privileges) to run the MySQL installation after which you should not get the access denied error when running bench new-site

Thanks,
Shashank

@shashank_shirke ,
Thanks for the quick reply!!

Yes, running on Digital Ocean Droplet.

Logged in as root but SU as frappe. Followed your instructions on creating that frappe user. I’ll figure out how to give it root privs and see if that will work.

Super thanks mate! Been tearing my hair out for 4 days now trying to make this work. Will update and see.

Chris

DigitalOcean works the best since they allow direct root access. You don’t need to do anything special to allow root privileges. Step 1.4 does it for you already.

@shashank_shirke

Unfortunately, same error. :frowning:

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/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 109, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=“bench”)
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 74, in new_site
_new_site(
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 75, in _new_site
install_db(
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 151, in install_db
setup_database(force, source_sql, verbose, no_mariadb_socket)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/init.py”, line 20, in setup_database
return frappe.database.mariadb.setup_db.setup_database(
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/setup_db.py”, line 41, in setup_database
if force or (db_name not in dbman.get_database_list()):
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/db_manager.py”, line 49, in get_database_list
return self.db.sql(“SHOW DATABASES”, pluck=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 190, in sql
self.connect()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 115, in connect
self._conn = self.get_connection()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 90, in get_connection
conn = self._get_connection()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 96, in _get_connection
return self.create_connection()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 99, in create_connection
return pymysql.connect(**self.get_connection_settings())
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 353, in init
self.connect()
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 633, in connect
self._request_authentication()
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 907, in _request_authentication
auth_packet = self._read_packet()
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 725, in _read_packet
packet.raise_for_error()
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/frappe/frappe-bench/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 ‘frappe’@‘localhost’ (using password: YES)”)

Any other clues?

Chris

@shashank_shirke

Ran without specifying frappe as user, this is what i get. Same error, root as user:

frappe@APD-PROD01:~/frappe-bench$ bench new-site site1.local
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/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 109, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=“bench”)
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 74, in new_site
_new_site(
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 75, in _new_site
install_db(
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 151, in install_db
setup_database(force, source_sql, verbose, no_mariadb_socket)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/init.py”, line 20, in setup_database
return frappe.database.mariadb.setup_db.setup_database(
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/setup_db.py”, line 41, in setup_database
if force or (db_name not in dbman.get_database_list()):
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/db_manager.py”, line 49, in get_database_list
return self.db.sql(“SHOW DATABASES”, pluck=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 190, in sql
self.connect()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 115, in connect
self._conn = self.get_connection()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 90, in get_connection
conn = self._get_connection()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 96, in _get_connection
return self.create_connection()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 99, in create_connection
return pymysql.connect(**self.get_connection_settings())
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 353, in init
self.connect()
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 633, in connect
self._request_authentication()
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 907, in _request_authentication
auth_packet = self._read_packet()
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 725, in _read_packet
packet.raise_for_error()
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/frappe/frappe-bench/env/lib/python3.10/site-packages/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1698, “Access denied for user ‘root’@‘localhost’”)

Chris

If you want to install SSL on localhost, follow this tutorial, it helped me.

You must reset the MySQL password, I executed the steps described in the following guide depending on the version I had installed on my machine and I was able to continue with the installation.

https://devanswers.co/how-to-reset-mysql-root-password-ubuntu/

@Leo_Sarmiento
I had to follow same instructions for MariaDB instead of MySql, and miraculously, IT WORKED!!! I can now continue the install!

For some reason even if you set a password for root during MariaDB install, it somehow doesn’t take it???

Furthermore you have to set to safe mode to actually change the root password.

Anyway, super thanks for this!! I can continue the install now.

@shashank_shirke
Suggest to include this little tidbit in your instructions in case someone else encounters it.

Chris

1 Like

Ran into this error isntall HRMS onto my site:

pdating DocTypes for hrms : [========================================] 100%

Patching Existing Data…
An error occurred while installing hrms: Error 111 connecting to localhost:13000. Connection refused.
Traceback (most recent call last):
File “env/lib/python3.10/site-packages/redis/connection.py”, line 559, in connect
sock = self._connect()
File “env/lib/python3.10/site-packages/redis/connection.py”, line 615, in _connect
raise err
File “env/lib/python3.10/site-packages/redis/connection.py”, line 603, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

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 299, in install_app
frappe.get_attr(after_install)()
File “apps/hrms/hrms/setup.py”, line 19, in after_install
run_post_install_patches()
File “apps/hrms/hrms/setup.py”, line 654, in run_post_install_patches
frappe.get_attr(f"hrms.patches.post_install.{patch_name}.execute")()
File “apps/hrms/hrms/patches/post_install/rename_stop_to_send_birthday_reminders.py”, line 10, in execute
rename_field(“HR Settings”, “stop_birthday_reminders”, “send_birthday_reminders”)
File “apps/frappe/frappe/model/utils/rename_field.py”, line 55, in rename_field
update_user_settings(doctype, old_fieldname, new_fieldname)
File “apps/frappe/frappe/model/utils/rename_field.py”, line 166, in update_user_settings
sync_user_settings()
File “apps/frappe/frappe/model/utils/user_settings.py”, line 49, in sync_user_settings
for key, data in frappe.cache().hgetall(“_user_settings”).items():
File “apps/frappe/frappe/utils/redis_wrapper.py”, line 177, in hgetall
value = super().hgetall(self.make_key(name))
File “env/lib/python3.10/site-packages/redis/client.py”, line 3014, in hgetall
return self.execute_command(‘HGETALL’, name)
File “env/lib/python3.10/site-packages/redis/client.py”, line 898, in execute_command
conn = self.connection or pool.get_connection(command_name, **options)
File “env/lib/python3.10/site-packages/redis/connection.py”, line 1192, in get_connection
connection.connect()
File “env/lib/python3.10/site-packages/redis/connection.py”, line 563, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:13000. Connection refused.

Any clue?

Chris

Are you in production or development mode?