Issue during installation erpnext

Hello

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

and the installation script start installing the packages but its stooped during this steps

Now to install NVM, Node, npm and yarn
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
v18.20.8 is already installed.
Now using node v18.20.8 (npm v10.8.2)
E: Unable to correct problems, you have held broken packages.
An error occurred on line 322 with exit status 0
Connection to xxx.xxx.xxx.xxx closed.

please advice

server, ubunto 24,4
memory 8 GB
ssd 160GB
4 cores cpu

may the network
retry it

Let’s start!
i edit theses steps with some thing to avoid some error i found it in the above url

:page_facing_up: Table of Contents:

  • Step 1: Server Setup
  • Step 2: Install Required Packages
  • Step 3: Configure MySQL Server
  • Step 4: Install CURL, Node, NPM, Yarn
  • Step 5: Install Frappe Bench
  • Step 6: Install ERPNext and other Apps
  • Step 7: Setup Production Server
  • Step 8: Custom Domain & SSL Setup

PRE-REQUISITES:

  • Operating System: Linux Ubuntu 22.04 LTS
  • Minimum Recommended Hardware: 2 CPU | 4 GB RAM | 20 GB Disk
  • Root shell access to the server (via SSH)

:one: SERVER SETUP


1.1 Login to the server as root user

1.2 Setup correct date and timezone (important step as it impacts ERPNext usage)

Check the server’s current timezone

date

Set correct timezone as per your region

timedatectl set-timezone "Asia/Kolkata"

1.3 Update & upgrade server packages

sudo apt-get update -y
sudo apt-get upgrade -y

1.4 Create a new user
We create this user as a security measure to prevent root user access.
This user will be assigned admin permissions and will be used as the main Frappe Bench user

sudo adduser [frappe-user]
sudo usermod -aG sudo [frappe-user]
su [frappe-user] 
cd /home/[frappe-user]/

Note: Replace [frappe-user] with your username. Eg. sudo adduser myname

For some cloud providers like AWS & Azure, you wont’t have root password access so you can simply run sudo -i when you login to the server using the default user (eg. ubuntu in AWS)

:two: INSTALL REQUIRED PACKAGES


Frappe Bench and ERPNext requires many packages to run smoothly. In this step we will install all the required packages for the system to work correctly.

Note: During the installation of these packages the server might prompt you to confirm if you want to continue installing the package [Y/n]. Just hit “y” on your keyboard to continue.

2.1 Install GIT

sudo apt-get install git

Check if GIT is correctly installed by running git --version

2.2 Install Python

sudo apt-get install python3-dev python3.10-dev python3-setuptools python3-pip python3-distutils

2.3 Install Python Virtual Environment

sudo apt-get install python3.10-venv

Check if Python is correctly installed by running python3 -V

2.4 Install Software Properties Common (for repository management)

sudo apt-get install software-properties-common

2.5 Install MariaDB (MySQL server)

sudo apt install mariadb-server mariadb-client

Check if MariaDB is correctly installed by running mariadb --version

2.6 Install Redis Server

sudo apt-get install redis-server

2.7 Install other necessary packages (for fonts, PDFs, etc)

sudo apt-get install xvfb libfontconfig wkhtmltopdf
sudo apt-get install libmysqlclient-dev

:three: CONFIGURE MYSQL SERVER


3.1 Setup the server

sudo mysql_secure_installation

During the setup process, the server will prompt you with a few questions as given below. Follow the instructions to continue the setup;

  • Enter current password for root: (Enter your SSH root user password)
  • Switch to unix_socket authentication [Y/n]: Y
  • Change the root password? [Y/n]: Y
    It will ask you to set new MySQL root password at this step. This can be different from the SSH root user password.
  • Remove anonymous users? [Y/n] Y
  • Disallow root login remotely? [Y/n]: N
    This is set as N because we might want to access the database from a remote server for using business analytics software like Metabase / PowerBI / Tableau, etc.
  • Remove test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y

3.2 Edit the MySQL default config file

sudo nano /etc/mysql/my.cnf

Add the below code block at the bottom of the file;

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4

If you don’t know how to use VIM:

  • Once the file is open, hit “i” key to start editing the file.
  • After you’re done editing the file hit “Esc + :wq” to save the file

3.3 Restart the MySQL server (for the config to take effect)

sudo service mysql restart

:four: Instal CURL, Node, NPM and Yarn


4.1 Install CURL

sudo apt install curl

4.2 Install Node

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

source ~/.profile

nvm install 18

4.3 Install NPM

sudo apt-get install npm

4.4 Install Yarn

sudo npm install -g yarn

Check if Node is correctly installed by running node --version

:five: INSTALL FRAPPE BENCH


5.1 Install Frappe Bench

sudo pip3 install frappe-bench

Check if Frappe Bench is correctly installed by running bench --version

5.2 Initialize Frappe Bench

bench init --frappe-branch version-15 frappe-bench

5.3 Go to Frappe Bench directory
This will be the main directory from where we will be running all the commands.
The full path of this directory will be: /home/[frappe-user]/frappe-bench/

cd frappe-bench/

5.4 Change user directory permissions
This will allow execution permission to the home directory of the frappe user we created in step 1.4

chmod -R o+rx /home/[frappe-user]/

5.5 Create a New Site
We will use this as the default site where ERPNext and other apps will be installed.

bench new-site site1.local

:six: Install ERPNext and other Apps


Finally, we’re at the last stage of the installation process!

6.1 Download the necessary apps to our server
Download the payments apps . This app is required during ERPNext installation

bench get-app payments

Download the main ERPNext app

bench get-app --branch version-15 erpnext

Download the HR & Payroll app (optional)

bench get-app hrms

Check if all the apps are correctly downloaded by running bench version --format table

6.2 Install all the Apps

Install the main ERPNext app

bench --site site1.local install-app erpnext

Install the HR & Payroll app (optional)

bench --site site1.local install-app hrms

Note: You might get some warnings / error messages while trying to install apps on the default site. These messages can be ignored and you can proceed further.

:seven: SETUP PRODUCTION SERVER


7.1 Enable scheduler service

bench --site site1.local enable-scheduler

7.2 Disable maintenance mode

bench --site site1.local set-maintenance-mode off

7.3 Setup production config

sudo bench setup production [frappe-user]

7.4 Setup NGINX web server

bench setup nginx

7.5 Final server setup

sudo supervisorctl restart all
sudo bench setup production [frappe-user]

When prompted to save new/existing config files, hit “Y”

:tada: Ready to Go!

You can now go to your server [IP-address]:80 and you will have a fresh new installation of ERPNext ready to be configured!

If you are facing any issues with the ports, make sure to enable all the necessary ports on your firewall using the below commands;

sudo ufw allow 22,25,143,80,443,3306,3022,8000/tcp
sudo ufw enable

i avoid the step 8 too in my case

1 Like

Thank you,

everything goes fine until this step

bench --site ishtar1.local install-app erpnext

instead site1 i used ishtar 1

the ssh shows this error,

frappe@vps:~/frappe/frappe-bench$ bench --site ishtar1.local install-app erpnext
An error occurred while installing erpnext: (1045, "Access denied for user '_64d18b5eec51100d'@'localhost' (using password: YES)")
Traceback with variables (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 484, in install_app
    _install_app(app, verbose=context.verbose, force=force)
      context = {'sites': ['ishtar1.local'], 'force': False, 'verbose': False, 'profile': False}
      apps = ('erpnext',)
      force = False
      _install_app = <function install_app at 0x7f8ddf26d090>
      filelock = <function filelock at 0x7f8ddf25e8c0>
      exit_code = 0
      site = 'ishtar1.local'
      app = 'erpnext'
      err = OperationalError(1045, "Access denied for user '_64d18b5eec51100d'@'localhost' (using password: YES)")
  File "apps/frappe/frappe/installer.py", line 280, in install_app
    frappe.clear_cache()
      name = 'erpnext'
      verbose = False
      set_as_patched = True
      force = False
      sync_jobs = <function sync_jobs at 0x7f8dde71ac20>
      sync_for = <function sync_for at 0x7f8dde71b640>
      sync_customizations = <function sync_customizations at 0x7f8de0382710>
      sync_fixtures = <function sync_fixtures at 0x7f8dde71b880>
  File "apps/frappe/frappe/__init__.py", line 984, in clear_cache
    for key in frappe.get_hooks("persistent_cache_keys"):
      user = None
      doctype = None
      frappe = <module 'frappe' from 'apps/frappe/frappe/__init__.py'>
      clear_routing_cache = <function clear_routing_cache at 0x7f8dde223be0>
      keys_to_delete = ********
  File "apps/frappe/frappe/__init__.py", line 1609, in get_hooks
    hooks = _dict(cache.get_value("app_hooks", _load_app_hooks))
      hook = 'persistent_cache_keys'
      default = '_KEEP_DEFAULT_LIST'
      app_name = None
  File "apps/frappe/frappe/utils/redis_wrapper.py", line 101, in get_value
    val = generator()
      self = RedisWrapper<ConnectionPool<Connection<host=127.0.0.1,port=13000,db=0>>>
      key = ********
      generator = <function _load_app_hooks at 0x7f8de0f28e50>
      user = None
      expires = False
      shared = False
      original_key = ********
      local_cache = {b'_64d18b5eec51100d|defaults': {}}
      val = None
  File "apps/frappe/frappe/utils/caching.py", line 59, in wrapper
    return_val = func(*args, **kwargs)
      args = ()
      kwargs = {}
      args_key = ********
      func = <function _load_app_hooks at 0x7f8de0f28dc0>
  File "apps/frappe/frappe/__init__.py", line 1572, in _load_app_hooks
    apps = [app_name] if app_name else get_installed_apps(_ensure_on_bench=True)
      app_name = None
      hooks = {}
      types = <module 'types' from '/usr/lib/python3.10/types.py'>
  File "apps/frappe/frappe/utils/caching.py", line 59, in wrapper
    return_val = func(*args, **kwargs)
      args = ()
      kwargs = {'_ensure_on_bench': True}
      args_key = ********
      func = <function get_installed_apps at 0x7f8de0f28c10>
  File "apps/frappe/frappe/__init__.py", line 1541, in get_installed_apps
    installed = json.loads(db.get_global("installed_apps") or "[]")
      _ensure_on_bench = True
  File "apps/frappe/frappe/database/database.py", line 1134, in get_global
    return self.get_default(key, user)
      self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7f8dde6b1d50>
      key = ********
      user = '__global'
  File "apps/frappe/frappe/database/database.py", line 1138, in get_default
    d = self.get_defaults(key, parent)
      self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7f8dde6b1d50>
      key = ********
      parent = '__global'
  File "apps/frappe/frappe/database/database.py", line 1154, in get_defaults
    defaults = frappe.defaults.get_defaults_for(parent)
      key = ********
      parent = '__global'
  File "apps/frappe/frappe/defaults.py", line 240, in get_defaults_for
    frappe.qb.from_(table)
      parent = '__global'
      defaults = None
      table = Table('tabDefaultValue')
  File "apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
      query = 'SELECT `defkey`,`defvalue` FROM `tabDefaultValue` WHERE `parent`=%(param1)s ORDER BY `creation`'
      args = ()
      kwargs = {'as_dict': True}
      child_queries = []
      params = {'param1': '__global'}
      execute_child_queries = <function patch_query_execute.<locals>.execute_child_queries at 0x7f8dde6c57e0>
      prepare_query = <function patch_query_execute.<locals>.prepare_query at 0x7f8dde6c5870>
  File "apps/frappe/frappe/database/database.py", line 207, in sql
    self.connect()
      self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7f8dde6b1d50>
      query = 'SELECT `defkey`,`defvalue` FROM `tabDefaultValue` WHERE `parent`=%(param1)s ORDER BY `creation`'
      values = {'param1': '__global'}
      as_dict = True
      as_list = 0
      debug = False
      ignore_ddl = 0
      auto_commit = 0
      update = None
      explain = False
      run = True
      pluck = False
      as_iterator = False
  File "apps/frappe/frappe/database/database.py", line 112, in connect
    self._conn: "MariadbConnection" | "PostgresConnection" = self.get_connection()
      self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7f8dde6b1d50>
  File "apps/frappe/frappe/database/mariadb/database.py", line 108, in get_connection
    conn = self._get_connection()
      self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7f8dde6b1d50>
  File "apps/frappe/frappe/database/mariadb/database.py", line 114, in _get_connection
    return self.create_connection()
      self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7f8dde6b1d50>
  File "apps/frappe/frappe/database/mariadb/database.py", line 117, in create_connection
    return pymysql.connect(**self.get_connection_settings())
      self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7f8dde6b1d50>
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 361, in __init__
    self.connect()
      self = <pymysql.connections.Connection object at 0x7f8dde1dfbe0>
      user = '_64d18b5eec51100d'
      password = ********
      host = '127.0.0.1'
      database = '_64d18b5eec51100d'
      unix_socket = None
      port = 3306
      charset = 'utf8mb4'
      collation = 'utf8mb4_unicode_ci'
      sql_mode = None
      read_default_file = None
      conv = {<class 'bool'>: <function escape_bool at 0x7f8ddf142e60>, <class 'int'>: <function escape_int at 0x7f8ddf142ef0>, <class 'float'>: <function escape_float at 0x7f8ddf142f80>, <class 'str'>: <function escape_str at 0x7f8ddf1431c0>, <class 'bytes'>: <function escape_bytes at 0x7f8ddf143130>, <class 'tuple'>: <function escape_sequence at 0x7f8ddf142d40>, <class 'list'>: <function escape_sequence at 0x7f8ddf142d40>, <class 'set'>: <function escape_sequence at 0x7f8ddf142d40>, <class 'frozenset'>: <function escape_sequence at 0x7f8ddf142d40>, <class 'dict'>: <function escape_dict at 0x7f8ddf142cb0>, <class 'NoneType'>: <function escape_None at 0x7f8ddf143250>, <class 'datetime.date'>: <function escape_date at 0x7f8ddf143490>, <class 'datetime.datetime'>: <function escape_datetime at 0x7f8ddf143400>, <class 'datetime.timedelta'>: <function escape_timedelta at 0x7f8ddf1432e0>, <class 'datetime.time'>: <function escape_time at 0x7f8ddf143370>, <class 'time.struct_time'>: <function escape_struc...
      use_unicode = True
      client_flag = 3842573
      cursorclass = <class 'pymysql.cursors.Cursor'>
      init_command = None
      connect_timeout = 10
      autocommit = False
      local_infile = False
      max_allowed_packet = 16777216
      defer_connect = False
      auth_plugin_map = None
      read_timeout = None
      write_timeout = None
      bind_address = None
      binary_prefix = False
      program_name = None
      server_public_key = ********
      ssl = None
      ssl_ca = None
      ssl_cert = None
      ssl_disabled = None
      ssl_key = ********
      ssl_key_password = ********
      ssl_verify_cert = None
      ssl_verify_identity = None
      compress = None
      named_pipe = None
      passwd = ********
      db = None
      read_default_group = None
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 669, in connect
    self._request_authentication()
      self = <pymysql.connections.Connection object at 0x7f8dde1dfbe0>
      sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
      kwargs = {}
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 957, in _request_authentication
    auth_packet = self._read_packet()
      self = <pymysql.connections.Connection object at 0x7f8dde1dfbe0>
      charset_id = 45
      data_init = b'\r\xa2:\x00\xff\xff\xff\x00-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
      data = b'\r\xa2:\x00\xff\xff\xff\x00-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00_64d18b5eec51100d\x00\x14\x9a\xaed\x95\xf9A\x7fu\x1d\x9c\xbf\xc0|>f\xc4\x89\xa9\xca\xbd_64d18b5eec51100d\x00mysql_native_password\x006\x0c_client_name\x07pymysql\x0f_client_version\x051.1.1\x04_pid\x0519562'
      authresp = b'\x9a\xaed\x95\xf9A\x7fu\x1d\x9c\xbf\xc0|>f\xc4\x89\xa9\xca\xbd'
      plugin_name = b'mysql_native_password'
      connect_attrs = b'\x0c_client_name\x07pymysql\x0f_client_version\x051.1.1\x04_pid\x0519562'
      k = b'_pid'
      v = b'19562'
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 775, in _read_packet
    packet.raise_for_error()
      self = <pymysql.connections.Connection object at 0x7f8dde1dfbe0>
      packet_type = <class 'pymysql.protocol.MysqlPacket'>
      buff = bytearray(b"\xff\x15\x04#28000Access denied for user \'_64d18b5eec51100d\'@\'localhost\' (using password: YES)")
      packet_header = b'U\x00\x00\x02'
      btrl = 85
      btrh = 0
      packet_number = 2
      bytes_to_read = 85
      recv_data = b"\xff\x15\x04#28000Access denied for user '_64d18b5eec51100d'@'localhost' (using password: YES)"
      packet = <pymysql.protocol.MysqlPacket object at 0x7f8dde23c040>
  File "env/lib/python3.10/site-packages/pymysql/protocol.py", line 219, in raise_for_error
    err.raise_mysql_exception(self._data)
      self = <pymysql.protocol.MysqlPacket object at 0x7f8dde23c040>
      errno = 1045
  File "env/lib/python3.10/site-packages/pymysql/err.py", line 150, in raise_mysql_exception
    raise errorclass(errno, errval)
      data = b"\xff\x15\x04#28000Access denied for user '_64d18b5eec51100d'@'localhost' (using password: YES)"
      errno = 1045
      errval = "Access denied for user '_64d18b5eec51100d'@'localhost' (using password: YES)"
      errorclass = <class 'pymysql.err.OperationalError'>
pymysql.err.OperationalError: (1045, "Access denied for user '_64d18b5eec51100d'@'localhost' (using password: YES)")

PS: this user ‘_64d18b5eec51100d’@‘localhost’ is not shown in my db users list

Please advice

follow the below steps?
CREATE USER user_name(same as db name) WITH PASSWORD ‘password’;
GRANT ALL PRIVILEGES ON DATABASE db name TO user_name;