How to Install ERPNext on Ubuntu 20.04

In this tutorial, we will show you how to install ERPNext on Ubuntu 20.04 using one of our optimized ERPNext hosting servers.

install erpnext on ubuntu 20.04

ERPNext is a free, open-source ERP system written in the Frappe framework. Simple yet powerful, it is designed for small and medium businesses that support retail, trading, services, manufacturing, distribution, non-profits, and other sectors.
It is built with open source tools and offers features that can be used to run your business and collaborate with your customers and employees.
It also comes with a simple and user-friendly web interface with all functionalities of an ERP system.

ERPNext is one of the best ERP applications used by thousands of businesses worldwide to manage their ERP processes. It offers a rich set of features including HR, Sales, Purchases, CRM, Manufacturing, Inventory, and Accounting management. Let’s get started with the installation process.

Prerequisites

  • An Ubuntu 20.04 VPS with root access enabled (We include root access for free across all of our VPS plans) or a user with sudo privileges.
  • A valid domain name pointed to your server.
  • A minimum of 2GB of RAM and 2 CPU cores.

1. Log in via SSH and Update your System

First, you will need to log in to your Ubuntu 20.04 VPS via SSH as the root user:

ssh root@IP_ADDRESS -p PORT_NUMBER

Make sure to replace “IP_ADDRESS” and “PORT_NUMBER” with their respective values. The default SSH port is 22, but it might be set to a different value on your server.

Next, run the following commands to upgrade all installed packages on your server:

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

Once your system is up-to-date, you can proceed to the next step.

2. Install Required Dependencies

First, you will need to install Python and other packages required to build and set up ERPNext. You can install them using the following command:

apt-get install libffi-dev python3-pip python3-dev  python3-testresources libssl-dev wkhtmltopdf gcc g++ make -y

Once all of the packages are installed, you can proceed to the next step.

3. Install Node.js

ERPNext uses Node.js for its frontend, therefore you will need to install it on your server.

First, add the Node.js version 14 repository using the following command:

curl -sL https://deb.nodesource.com/setup_14.x | bash -

Once the repository is added, run the following command to install Node.js and Redis server in your system.

apt-get install nodejs redis-server -y

Once both packages are installed, you can verify the Node.js version using the following command:

node --version

You should get the following output:

v14.17.1

Next, install the Yarn package by running the following command:

npm install -g yarn

Once the package is installed, you can proceed to the next step.

4. Install and Configure MariaDB Server

First, install the MariaDB server by running the following command:

apt-get install mariadb-server mariadb-client -y

Once installed, secure the MariaDB and set the MariaDB root password with the following command:

mysql_secure_installation

Answer all the questions as shown below to set the MariaDB root password and secure the installation:

Enter current password for root (enter for none): Press your [Enter] key, there is no password set by default
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Once the MariaDB is secured, log in to the MariaDB console with the following command:

mysql -u root -p

After login, change the MariaDB authentication plugin with the following command:

MariaDB [(none)]>USE mysql;
MariaDB [(none)]>UPDATE user SET plugin='mysql_native_password' WHERE User='root';

Next, flush the privileges and exit from the MariaDB shell with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Next, you will need to change MariaDB Innodb file format to Barracuda. You can configure it by editing the file /etc/mysql/mariadb.conf.d/50-server.cnf:

nano /etc/mysql/mariadb.conf.d/50-server.cnf

Add/Modify the following lines:

[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unipre_ci

[mysql]

default-character-set = utf8mb4

Save and close the file, then restart the MariaDB service to implement the changes:

systemctl restart mariadb

5. Create a User for ERPNext

Before starting, you will need to create a user to run the ERPNext.

Create a new user named erpnext by running the following command:

useradd -m -s /bin/bash erpnext

Next, set the password with the following command:

passwd erpnext

Next, add the erpnext user to the sudo group so that it can run the superuser command:

usermod -aG sudo erpnext

Next, log in to the ERPNext user and set up the environment variables with the following command:

su - erpnext
nano ~/.bashrc

Add the following line:

PATH=$PATH:~/.local/bin/

Save and close the file, then activate the environment variable with the following command:

source ~/.bashrc

6. Install ERPNext

Next, you will need to install a bench tool to install and manage ERPNext on your system.

First, log in with the ERPNext user and create a new directory for ERPNext setup with the following command:

su - erpnext
sudo mkdir /opt/bench

Next, change the ownership to the erpnext user:

sudo chown -R erpnext:erpnext /opt/bench

Next, change the directory to /opt/bench and clone the bench repository from Git:

cd /opt/bench
git clone https://github.com/frappe/bench bench-repo

Next, install the bench repo using the pip3 command:

pip3 install -e bench-repo

Once installed, initialize the bench directory with Frappe framework using the following command:

bench init erpnext

You should see the following output:

✔ Built js/frappe-web.min.js
✔ Built css/web_form.css
✔ Built css/desk.min.css
✔ Built js/control.min.js
✔ Built css/frappe-web-b4.css
✔ Built js/form.min.js
✔ Built js/data_import_tools.min.js
✔ Built js/report.min.js
INFO:bench.utils:setting up backups
SUCCESS: Bench erpnext initialized

Next, change the directory to erpnext and create a new frappe site with the following command:

cd erpnext
bench new-site erpnext.example.com

Make sure to replace example.com with your registered domain name. ou will be asked to provide your MariaDB root password, as shown below:

WARN: bench is installed in editable mode!
This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`
MySQL root password:

Provide your password and hit Enter to create a new Frappe site:

Installing frappe...
Updating DocTypes for frappe        : [========================================] 100%
Updating country info               : [========================================] 100%

Next, you will be asked to set an administrator password, as shown below:

Set Administrator password:
Re-enter Administrator password:

Provide your desired password and hit Enter to finish the process.

*** Scheduler is disabled ***
Current Site set to erpnext.example.com

A new frappe site has been created. In order to install the ERPNext modules we need to run the following commands:

bench get-app erpnext https://github.com/frappe/erpnext.git

bench --site erpnext.example.com install-app erpnext

Next, start the bench service with the following command:

bench start

You should see the following output:

13:51:25 web.1            |  * Running on http://0.0.0.0:8000/ (Press CTRL+C to quit)
13:51:25 web.1            |  * Restarting with inotify reloader
13:51:25 watch.1          | yarn run v1.22.10
13:51:25 watch.1          | $ node rollup/watch.js
13:51:26 web.1            |  * Debugger is active!
13:51:27 web.1            |  * Debugger PIN: 154-374-187
13:51:27 watch.1          |
13:51:27 watch.1          | Rollup Watcher Started

At this point, ERPNext is installed and listening on port 8000. However, this is not the recommended way to set up the production environment.

Press CRTL+C to stop the bench process and proceed to the next step.

7. Set up ERPNext for a Production Environment

In this section, we will install Supervisor to manage the ERPNext process and Nginx as a reverse proxy to access the ERPNext without using port 8000.

First, change the user to ERPNext and install Supervisor and Nginx with the following command:

su - erpnext
sudo apt-get -y install supervisor nginx

Next, install the frappe-bench add-on with the following command:

sudo pip3 install frappe-bench

Next, run the following command to configure ERPNext for a production environment:

sudo /home/erpnext/.local/bin/bench setup production erpnext

You should see the following output:

Site erpnext.example.com assigned port: 80
$ sudo /usr/bin/supervisorctl reread
erpnext-redis: available
erpnext-web: available
erpnext-workers: available
$ sudo /usr/bin/supervisorctl update
erpnext-redis: added process group
erpnext-web: added process group
erpnext-workers: added process group
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl reload nginx

8. Access ERPNext Web Interface

At this point, ERPNext is installed and configured to run on port 80. Now, open your web browser and type the URL http://erpnext.example.com. You will be redirected to the following page:

installing erpnext on ubuntu 20.04

Provide username as Administrator and the password that you provided during installation and click on the Sign in button. You should see the language selection page:

erpnext install ubuntu 20.04

Select your desired language and click on the Next button. You should see the following page:

Provide your country name, time zone, currency and then click on the Next button. You should see the following page:

Add your first user, email, password and click on the Complete Setup button. You should see the ERPNext dashboard in the following page:

install erpnext on ubuntu 20.04 step by step

Congratulations! you have successfully installed ERPNext on your Ubuntu 20.04 VPS. Now you can use this platform to expand and help your business.


erpnext installation on ubuntu 20.04

Of course, you don’t have to install ERPNext on Ubuntu 20.04 if you have a Managed Hosting with us. You can simply ask our support team to install ERPNext on Ubuntu 20.04 for you. They are available 24/7 and will be able to help you with the installation.

If you enjoyed reading this blog post on How to Install ERPNext on Ubuntu 20.04, feel free to share it on social networks, or simply leave a comment in the comments section. Thanks.

46 thoughts on “How to Install ERPNext on Ubuntu 20.04”

  1. I did everything up to end of step 4 successfully, but when I tried to restart mariadb it failed:
    root@ip-172-26-9-113:/home/ubuntu# journalctl -xe
    Sep 08 16:17:20 ip-172-26-9-113 mysqld[45951]: 2020-09-08 16:17:20 0 [ERROR] Aborting
    Sep 08 16:17:20 ip-172-26-9-113 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
    — Subject: Unit process exited
    — Defined-By: systemd
    — Support: http://www.ubuntu.com/support

    — An ExecStart= process belonging to unit mariadb.service has exited.

    — The process’ exit code is ‘exited’ and its exit status is 1.
    Sep 08 16:17:20 ip-172-26-9-113 systemd[1]: mariadb.service: Failed with result ‘exit-code’.
    — Subject: Unit failed
    — Defined-By: systemd
    — Support: http://www.ubuntu.com/support

    — The unit mariadb.service has entered the ‘failed’ state with result ‘exit-code’.
    Sep 08 16:17:20 ip-172-26-9-113 systemd[1]: Failed to start MariaDB 10.3.22 database server.
    — Subject: A start job for unit mariadb.service has failed
    — Defined-By: systemd
    — Support: http://www.ubuntu.com/support

    — A start job for unit mariadb.service has finished with a failure.

    Reply
  2. in reference to my last comment, I think this is the issue that I didn’t notice before.
    when I issue the UPDATE user… command I get this response:
    ERROR 1356 (HY000): View ‘mysql.user’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

    Any ideas?

    Reply
    • Have you tried to purge mariadb-server and mariadb-client, in prior of installing them?

      The issue seems to be with the permissions within your MariaDB instance.

      Reply
  3. Hi,
    I followed your procedure to the letter, created user ‘erpnext’ Everthing went ok up to “bench init erpnext” which finished very well. then it all went downhill from there. maybe because my domain was set to erp.mydomain.com. I tried all night to fix, with my limited knowledge as a newbee, all to no avail. Also, I think some github comits have changed. could you please help?

    Martin

    Reply
    • If you followed the instructions carefully, EPRNext should be running on port 8000 on your server and you should be able to access it at your_domain:8000 in your browser (or only with your_domain if you also completed the reverse proxy setup with Supervisor in section 7 of the tutorial).

      Reply
  4. I followed all the steps up to step 4 , it going fine
    When I run the command “mysql -u root -p”
    I got the following
    MariaDB [(none)]>
    then I run MariaDB [(none)]>USE mysql;
    then it changes to
    MariaDB [(mysql)]>, then i run the next command as
    MariaDB [(mysql)]>UPDATE user SET plugin=’mysql_native_password’ WHERE User=’root’;

    the I change the file “nano /etc/mysql/mariadb.conf.d/50-server.cnf ” as stated above.
    But after that when i run the following command I got error

    systemctl restart mariadb
    Job for mariadb.service failed because the control process exited with error code.
    See “systemctl status mariadb.service” and “journalctl -xe” for details.

    now even whe i run mysql -u root -p it doesn’t connect
    I need your help

    Reply
      • I followed as stated above
        the only difference is when I run MariaDB [(none)]>USE mysql;

        it give me MariaDB [(mysql)] the I run the “UPDATE user SET plugin=’mysql_native_password’ WHERE User=’root’; ” as

        MariaDB [(mysql)] > UPDATE user SET plugin=’mysql_native_password’ WHERE User=’root’;
        of course on the step above it shows as
        MariaDB[(none)]> UPDATE user SET plugin=’mysql_native_password’ WHERE User=’root’;
        /
        is that create a problem

        Reply
    • Hello all,

      collation_server = utf8mb4_unipre_ci

      is not correct, change to:

      collation_server = utf8mb4_unicode_ci

      you see the error if you start mysql dirctly with

      /usr/sbin/mysqld

      2022-03-29 19:30:08 0 [Note] /usr/sbin/mysqld (mysqld 10.3.34-MariaDB-0ubuntu0.20.04.1) starting as process 21087 …
      2022-03-29 19:30:08 0 [ERROR] Unknown collation: ‘utf8mb4_unipre_ci’
      2022-03-29 19:30:08 0 [ERROR] Aborting

      Reply
  5. erpnext@ubuntuserver:/opt/bench$ bench init erpnext
    WARN: bench is installed in editable mode!

    This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

    INFO: Path erpnext already exists!
    erpnext@ubuntuserver:/opt/bench$

    why it give that?

    Reply
  6. Dear Admin,
    I have got this problem while I am trying to initialized the bench? can you suggest something to have solution for this problem.

    Installing frappe
    $ erpnext/env/bin/pip install -q -U -e erpnext/apps/frappe
    ERROR: Exception:
    Traceback (most recent call last):
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py”, line 437, in _error_catcher
    yield
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py”, line 519, in read
    data = self._fp.read(amt) if not fp_closed else b””
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_vendor/cachecontrol/filewrapper.py”, line 62, in read
    data = self.__fp.read(amt)
    File “/usr/lib/python3.8/http/client.py”, line 454, in read
    n = self.readinto(b)
    File “/usr/lib/python3.8/http/client.py”, line 498, in readinto
    n = self.fp.readinto(b)
    File “/usr/lib/python3.8/socket.py”, line 669, in readinto
    return self._sock.recv_into(b)
    File “/usr/lib/python3.8/ssl.py”, line 1241, in recv_into
    return self.read(nbytes, buffer)
    File “/usr/lib/python3.8/ssl.py”, line 1099, in read
    return self._sslobj.read(len, buffer)
    socket.timeout: The read operation timed out

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_internal/cli/base_command.py”, line 216, in _main
    status = self.run(options, args)
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_internal/cli/req_command.py”, line 182, in wrapper
    return func(self, options, args)
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_internal/commands/install.py”, line 324, in run
    requirement_set = resolver.resolve(
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py”, line 183, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py”, line 388, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py”, line 340, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_internal/operations/prepare.py”, line 467, in prepare_linked_requirement
    local_file = unpack_url(
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_internal/operations/prepare.py”, line 255, in unpack_url
    file = get_http_url(
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_internal/operations/prepare.py”, line 129, in get_http_url
    from_path, content_type = _download_http_url(
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_internal/operations/prepare.py”, line 282, in _download_http_url
    for chunk in download.chunks:
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_internal/network/utils.py”, line 64, in response_chunks
    for chunk in response.raw.stream(
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py”, line 576, in stream
    data = self.read(amt=amt, decode_content=decode_content)
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py”, line 541, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
    File “/usr/lib/python3.8/contextlib.py”, line 131, in __exit__
    self.gen.throw(type, value, traceback)
    File “/srv/bench/erpnext/env/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py”, line 442, in _error_catcher
    raise ReadTimeoutError(self._pool, None, “Read timed out.”)
    pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Read timed out.

    Reply
  7. When I create a new site using command after it request the Mysql root password it throws the following error.

    pymysql.err.OperationalError: (2003, “Can’t connect to MySQL server on ‘127.0.0.1’ ([Errno 111] Connection refused)”)

    I tried to figure out it but I couldn’t. I have passed all the steps well and reached that point. I am installing the ERPNext on virtual box Ubuntu server 20.04

    Reply
  8. Dear Admin,

    When I create a new site using command after it request the Mysql root password it throws the following error.

    pymysql.err.OperationalError: (2003, “Can’t connect to MySQL server on ‘127.0.0.1’ ([Errno 111] Connection refused)”)

    I tried to figure out it but I couldn’t. I have passed all the steps well and reached that point. I am installing the ERPNext on virtual box Ubuntu server 20.04

    Reply
  9. for me;
    there wore two probs
    1. when I run “bench new-site erpnext.example.com“
    asking me to enter db password after I enter the password i get this error
    “For key collation_server. Expected value utf8mb4_unicode_ci, found value latin1_swedish_ci“
    I solved this by changing `collation-server = utf8mb4_general_ci` to `collation-server = utf8mb4_unicode_ci` in `50-server.cnf` file

    2. in the production steps;
    when I run “sudo /home/erpnext/.local/bin/bench setup production erpnext“
    i get nginx default page in the browser
    instead of above i run “sudo bench setup production erpnext“

    its working now,
    just shared my experience if anyone face to same problem in Ubuntu 20.04

    Reply
  10. At the end of Step 4, ‘Install and Configure MariaDB Server’, running the command, ‘systemctl restart mariadb’, mariadb would not start with the message “… Could not increase number of max_open_files to more than ….”
    I followed the steps outlined in https://stackoverflow.com/questions/60248748/could-not-increase-number-of-max-open-files-to-more-than-4096-request-4214 (purge mariadb and reinstall) and was able to start up mariadb.

    I repeated Step 4 from here starting with the mysql_secure_installation command.

    Reply
  11. bench new-site erpnext.example.com
    errored for me as well – just as for commenter zia

    I needed to make the same changes as advised zia to 50-server.cnf
    I restarted mariadb “sudo systemctl restart mariadb”

    (replace example.com with your domain below)

    This allowed me to move further – however running “bench new-site erpnext.example.com” reported that the site already exists.

    Since the first attempt has resulted in an error – I thought it best to remove the site and retry. I needed to use “bench drop-site erpnext.exmple.com –force”
    I needed to use –force because drop-site reproted that it was unabel to create a back up

    I reran “bench new-site erpnext.example.com” and it seems to be working

    Reply
  12. After following the instructions in this post. You will be able to run frappe app.
    but it doesnt install the erpnext. to install erpnext app and run it.
    follow these instructions.
    1. install frappe-bench using the following command
    bench init frappe-bench
    2. go inside frappe-bench
    cd frappe-bench
    3. install erpnext app
    bench –site site.local install-app erpnext
    4. run erpnext app
    bench use erpnext
    bench start

    Reply
  13. i manage to install it, thank you!!!

    now im trying to configure LDAPS but getting error:
    (“(‘socket ssl wrapping error: [SSL] internal error (_ssl.c:1123)’,)”,)

    any idea ?

    Reply
  14. erpnext@test:/opt/bench/erpnext$ bench new-site erpnext.demo2.com
    WARN: bench is installed in editable mode!

    This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

    MySQL root password:
    Traceback (most recent call last):
    File “/opt/bench/erpnext/env/lib/python3.8/site-packages/pymysql/connections.py”, line 613, in connect
    sock = socket.create_connection(
    File “/usr/lib/python3.8/socket.py”, line 808, in create_connection
    raise err
    File “/usr/lib/python3.8/socket.py”, line 796, in create_connection
    sock.connect(sa)
    ConnectionRefusedError: [Errno 111] Connection refused

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File “/usr/lib/python3.8/runpy.py”, line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
    File “/usr/lib/python3.8/runpy.py”, line 87, in _run_code
    exec(code, run_globals)
    File “/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py”, line 104, in
    main()
    File “/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
    click.Group(commands=commands)(prog_name=’bench’)
    File “/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py”, line 829, in __call__
    return self.main(*args, **kwargs)
    File “/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py”, line 782, in main
    rv = self.invoke(ctx)
    File “/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py”, line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py”, line 610, in invoke
    return callback(*args, **kwargs)
    File “/opt/bench/erpnext/apps/frappe/frappe/commands/site.py”, line 38, in new_site
    _new_site(db_name, site, mariadb_root_username=mariadb_root_username,
    File “/opt/bench/erpnext/apps/frappe/frappe/installer.py”, line 59, in _new_site
    install_db(
    File “/opt/bench/erpnext/apps/frappe/frappe/installer.py”, line 106, in install_db
    setup_database(force, source_sql, verbose, no_mariadb_socket)
    File “/opt/bench/erpnext/apps/frappe/frappe/database/__init__.py”, line 14, in setup_database
    return frappe.database.mariadb.setup_db.setup_database(force, source_sql, verbose, no_mariadb_socket=no_mariadb_socket)
    File “/opt/bench/erpnext/apps/frappe/frappe/database/mariadb/setup_db.py”, line 37, in setup_database
    if force or (db_name not in dbman.get_database_list()):
    File “/opt/bench/erpnext/apps/frappe/frappe/database/db_manager.py”, line 60, in get_database_list
    return [d[0] for d in self.db.sql(“SHOW DATABASES”)]
    File “/opt/bench/erpnext/apps/frappe/frappe/database/database.py”, line 112, in sql
    self.connect()
    File “/opt/bench/erpnext/apps/frappe/frappe/database/database.py”, line 65, in connect
    self._conn = self.get_connection()
    File “/opt/bench/erpnext/apps/frappe/frappe/database/mariadb/database.py”, line 71, in get_connection
    conn = pymysql.connect(
    File “/opt/bench/erpnext/env/lib/python3.8/site-packages/pymysql/connections.py”, line 353, in __init__
    self.connect()
    File “/opt/bench/erpnext/env/lib/python3.8/site-packages/pymysql/connections.py”, line 664, in connect
    raise exc
    pymysql.err.OperationalError: (2003, “Can’t connect to MySQL server on ‘127.0.0.1’ ([Errno 111] Connection refused)”)

    I receive the above error when I try to create a new site. could you please help me??

    Reply
    • According to the error, it seems that there is a problem with your MySQL server connection.

      Check and make sure that your MySQL database server is running and accepting local connections on your server.

      Reply
  15. I have followed the proceedure and everything is fine. However I was expecting to see all modules of erpnext like selling, buying and so forth. How do I activate those modules

    Reply
    • You need to install the erpnext app inside the site if the modules are missing:
      bench drop-site (site name)
      bench new-site (site name)
      bench get-app erpnext
      bench –site (site name) install-app erpnext

      Reply
  16. I’m currently on step 5 and i keep getting this error.
    -what could i possibly do to fix it?
    -can i continue without it?

    erpnext@jamal-VirtualBox:~$ sudo mkdir /opt/bench
    [sudo] password for erpnext:
    erpnext is not in the sudoers file. This incident will be reported.
    erpnext@jamal-VirtualBox:~$ sudo chown -R erpnext:erpnext /opt/bench
    [sudo] password for erpnext:
    erpnext is not in the sudoers file. This incident will be reported.

    Reply
  17. I cant seem to figure out what is causing this error: “erpnext is not in the sudoers file. This incident will be reported.” in the 6th step.

    It happens right after I input those command lines: “sudo mkdir /opt/bench” and/or “sudo mkdir /opt/bench”.

    I don’t know what am I doing wrong.

    Reply
  18. I am struck at this point When init erpnext
    throws expected single character argument
    /opt/bench$ init erpnext
    Expected single character argument

    Reply
  19. Hey Thank you very much for this wonderful article. I managed to run it completely but first, the output of last command “sudo /home/erpnext/.local/bin/bench setup production erpnext” in 7th step was different, mine asked for Yes/No to continue and restarted supervisor instead of nginx.

    And, the main problem, it accesses the Nginx’s default webpage by the URL instead of opening the ERPNext. Can you help me in this?

    Reply
  20. Hi,
    at the last I got error while I am trying to open my url its opening Nginx home page.
    I cant understand why I am facing this as I am a newbee.
    Please help with code.
    Thanks.

    Reply
    • Did you encounter issues when setting up the production? You should check /etc/nginx/conf.d/ if the configuration file “frappe-bench.conf” is present.

      Reply
  21. After all set…not a single error faced…at last:

    Site erp.alsus.in assigned port: 80
    ERROR: “getpwnam(): name not found: ‘bench'”
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 8, in
    sys.exit(cli())
    File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 121, in cli
    raise e
    File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 111, in cli
    bench_command()
    File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in __call__
    return self.main(*args, **kwargs)
    File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
    rv = self.invoke(ctx)
    File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
    return callback(*args, **kwargs)
    File “/usr/local/lib/python3.8/dist-packages/bench/commands/setup.py”, line 67, in setup_production
    setup_production(user=user, yes=yes)
    File “/usr/local/lib/python3.8/dist-packages/bench/config/production_setup.py”, line 50, in setup_production
    fix_prod_setup_perms(bench_path, frappe_user=user)
    File “/usr/local/lib/python3.8/dist-packages/bench/utils/system.py”, line 184, in fix_prod_setup_perms
    uid = pwd.getpwnam(frappe_user).pw_uid
    KeyError: “getpwnam(): name not found: ‘bench'”
    erpnext@ip-172-31-95-175:/opt/bench/erpnext$

    Reply
  22. Just a current update change during the 50-server.cnf edit. I had to change the line
    collation-server = utf8mb4_unipre_ci to utf8mb4_unicode_ci

    Reply

Leave a Comment