Featured Technology

How To Install ERPNext in Ubuntu 20.04 – A Step by Step Guide

ERPNext installation can be a pain in the neck, especially if you are getting started. In this article, I will take a step-by-step approach to configure our newly installed ubuntu 20.04 OS to set up an environment and install ERPNext. We will not leave any stone un-turned here. Let’s get to work!

Prerequisites

Software Requirements

  • Updated Ubuntu 20.04
  • A user with sudo privileges
  • Python 3.6+
  • Node.js 12
  • Redis 5
  • MariaDB 10.3.x / Postgres 9.5.x
  • yarn 1.12+
  • pip 20+
  • wkhtmltopdf (version 0.12.5 with patched qt)
  • cron
  • NGINX

Hardware Requirements

  • 4GB RAM
  • 40GB Hard Disk

 

In our first steps, we will make sure our system is up to date by running below commands:

$ sudo apt update
$ sudo apt -y upgrade

It is recommended to reboot your system whenever you do upgrade:

$ sudo reboot

Step 1: Install Python Tools & wkhtmltopdf

$ sudo apt -y install vim libffi-dev python3-pip python3-dev  python3-testresources libssl-dev wkhtmltopdf

Step 2: Install Curl, Redis and Node.js

$ sudo apt install curl

$ sudo curl --silent --location https://deb.nodesource.com/setup_14.x | sudo bash -

$ curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
$ echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ sudo apt-get update && sudo apt-get install yarn
$ sudo apt -y install gcc g++ make nodejs redis-server

Step 3: Install Nginx web server and MariaDB Database server

$ sudo apt -y install nginx
$ sudo apt install mariadb-server

Change authentication plugin.

$ sudo mysql -u root
USE mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
UPDATE user SET authentication_string=password('your_password') WHERE user='root';
FLUSH PRIVILEGES;
EXIT;

Ensure you have the following settings for mysqld and mysql client as provided. I have put a file on a public github repo, so you can copy and replace the whole file. 

$ sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
$ sudo systemctl restart mariadb

Step 4: Install Bench and ERPNext

A bench is a tool used to install and manage ERPNext on your Ubuntu system. We will create a user that will run the ERPNext system, then configure the system.

$ sudo useradd -m -s /bin/bash erpnext
$ sudo passwd erpnext
$ sudo usermod -aG sudo erpnext

Now it is time to update your PATH.

$ sudo su - erpnext
$ tee -a ~/.bashrc<<EOF
PATH=\$PATH:~/.local/bin/
EOF
$ source ~/.bashrc

Next, you need to create a directory for ERPNext setup and give erpnext user read and write permissions to the directory:

$ sudo mkdir /opt/bench
$ sudo chown -R erpnext /opt/bench

Next switch to erpnext user and install the application:

$ sudo su - erpnext
$ cd /opt/bench

Install frappe bench and git

$ sudo apt install git

$ sudo pip3 install frappe-bench

The next step is to initialize the bench directory with frappe framework installed. Make sure you are still inside the /opt/bench directory:

$ bench init erpnext

Create a new Frappe site.

$ cd erpnext

$ bench new-site erp.codewithkarani.com

Step 5: Get ERPNext application from GitHub

Download the ERPNext application from frappe Github repo. We will get version 13. You can get whichever version you like.

$ bench get-app branch version-13 erpnext https://github.com/frappe/erpnext

Step 6: Install ERPNext App on our Site

$ bench --site erp.codewithkarani.com install-app erpnext

Step 7: Start ERPNext and finish Installation

$ bench start

Navigate to the IP address of your installation and the port number shown on the terminal after running. In the case of a local instance, use 127.0.0.1:8000

 

 

44 thoughts on “How To Install ERPNext in Ubuntu 20.04 – A Step by Step Guide

  1. Good day . I shall try and make this short. Spent past few months getting to know ERPNext. During which I did many installs using this procedure
    https://www.digitalocean.com/community/tutorials/how-to-install-an-erpnext-stack-on-ubuntu-18-04

    Happy to use V12 ( Ubuntu 18 ) but at the point that I was deploying my final “work” server, found an issue that seem to relate to
    my SSL certs “breaking” some reports …Stock Balance report. Sounds crazy I know. I have made some postings on discussion forums but want to limit this message size so I am omitting detail.

    My question:
    Do you have a procedure for V12.26 on Ubuntu 18.04? I would like to try another method other than the one listed further up in my message because I am not sure if there is perhaps a flaw in that procedure.

    Thank you

  2. hi,
    your tutorial is excellent. i have successfully installed it on multiple times. i really appreciate your explanation and document provided.
    i have a doubt, if i restart the local host, i.e Ubuntu machine, i am unable to open erp page.
    please let me know what steps i should perform in this case.
    thank you

    1. Thanks for the complement.

      The inability to access the instance could be because your instance is in development mode, not production mode. If this is the case, you need to do a BENCH START

  3. Hello, after installation, i get this error message that permission denied. See the log below and please advise how to fix.

    ikennabrendan@ubuntu:/opt/bench/erpnext$ bench start
    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 43, in cli
    logger = setup_logging()
    File “/usr/local/lib/python3.8/dist-packages/bench/utils.py”, line 458, in setup_logging
    hdlr = logging.FileHandler(log_file)
    File “/usr/lib/python3.8/logging/__init__.py”, line 1147, in __init__
    StreamHandler.__init__(self, self._open())
    File “/usr/lib/python3.8/logging/__init__.py”, line 1176, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
    PermissionError: [Errno 13] Permission denied: ‘/opt/bench/erpnext/logs/bench.log’
    ikennabrendan@ubuntu:/opt/bench/erpnext$

  4. Hi, i have a issue , if i change the lenguage to any different of english, only i can see the tittle in new lenguage, but the side bar not change and nothing more can see..
    I need some help, please.

  5. Hi, i have a issue , if i change the lenguage to any different of english, only i can see the tittle in new lenguage, but the side bar not change and nothing more can see..

  6. Hi
    While i try to run this command in /opt/bench
    i got this error
    “erpnext@ip-172-31-14-56:/opt/bench$ bench init erpnext
    [Errno 13] Permission denied: ‘erpnext’
    ERROR: There was a problem while creating erpnext
    Do you want to rollback these changes? [y/N]:

    please help me

  7. mariadb has updated to 10.5 and the following commands do not work or am i doing something wrong

    UPDATE user SET plugin=’mysql_native_password’ WHERE User=’root’;
    UPDATE user SET authentication_string=password(‘your_password’) WHERE user=’root’;

  8. hi karani,

    followed your installation above and it is using port 8000 as development and it works, my question is how i can convert it as a production without the port number?

    in v12 i run this command only “bench setup production frappe” and it automatically make it as a production

    in v13 that command is not working.

    thanks

  9. Unable to connect

    Firefox can’t establish a connection to the server at 127.0.0.1:8000.

    The site could be temporarily unavailable or too busy. Try again in a few moments.
    If you are unable to load any pages, check your computer’s network connection.
    If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

  10. i close my computer and i open i can not connection with erpnext?
    this message show
    Unable to connect

    Firefox can’t establish a connection to the server at 127.0.0.1:8000.

    The site could be temporarily unavailable or too busy. Try again in a few moments.
    If you are unable to load any pages, check your computer’s network connection.
    If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

  11. Hello
    Kindly i have followed all the step you gave to Install ERPNext in Ubuntu 20.04, it was so successful and i loged In to set up everything. after me seting up everything , i loged out and restarted the computer but now i can not login. kindly help me with step by step , how to re login..
    what do i need to do to relogin?

    Thank. dearly waiting on you

      1. No. i know the password but its says>

        Unable to connect

        Firefox can’t establish a connection to the server at 127.0.0.1:8000.

        The site could be temporarily unavailable or too busy. Try again in a few moments.
        If you are unable to load any pages, check your computer’s network connection.
        If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

          1. i loged in then after i restarted the computer , when i go to the terminal and type bench start,it bring this error

            timtecs@timtecs:~$ bench start

            Command ‘bench’ not found, did you mean:

            command ‘tbench’ from deb dbench (4.0-2build1)
            command ‘dbench’ from deb dbench (4.0-2build1)

            Try: sudo apt install

            timtecs@timtecs:~$

              1. Am sorry for bothering you this much.
                kindly if there is any step by step way to start bench.
                i have totally failed to start the server .
                help me sir.
                erpnext@timtecs:~$ bench start
                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`

                WARN: Command not being executed in bench directory
                2021-08-06 16:32:47 [2461] [ERROR] Procfile does not exist or is not a file
                erpnext@timtecs:~$

                1. Hi Mr.Karani

                  Me too I had have the same problem !! cant load 127.0.0.1 , firefox return the same message !!! Also for the bench installed editable mode i think i solve it !! i dont know where the mistake !! please , help me !

          2. Hi Mr.Karani
            You can assemble all the system installation requirements in one package as an executable file that is once instead of using the instruction using Termens

  12. Sorry to ask again.

    I solved some errors by installing: express, socket.io, superagent and redis via npm

    Now the bench starts but it stops due to the following error:

    ERROR: [Errno 2] No such file or directory: ‘run’

    please help!

      1. Hi Karani.

        I did run all the steps once again and now the server is running.

        But now my problem is that I get a 404 error when going to “127.0.0.1:8000” or to “http://0.0.0.0:8000/”

        13:03:06 watch.1 | yarn run v1.22.5
        13:03:07 watch.1 | $ node esbuild –watch
        13:03:07 web.1 | * Running on http://0.0.0.0:8000/ (Press CTRL+C to quit)
        13:03:07 web.1 | * Restarting with stat
        13:03:07 web.1 | * Debugger is active!
        13:03:07 web.1 | * Debugger PIN: 266-593-456
        13:03:07 watch.1 | clean: postcss.plugin was deprecated. Migration guide:
        13:03:07 watch.1 | https://evilmartians.com/chronicles/postcss-8-plugin-migration
        13:03:07 watch.1 | clean: postcss.plugin was deprecated. Migration guide:
        13:03:07 watch.1 | https://evilmartians.com/chronicles/postcss-8-plugin-migration
        13:03:07 watch.1 | clean: postcss.plugin was deprecated. Migration guide:
        13:03:07 watch.1 | https://evilmartians.com/chronicles/postcss-8-plugin-migration
        13:03:08 watch.1 | clean: postcss.plugin was deprecated. Migration guide:
        13:03:08 watch.1 | https://evilmartians.com/chronicles/postcss-8-plugin-migration
        13:03:12 web.1 | 127.0.0.1 – – [10/Aug/2021 13:03:12] “GET / HTTP/1.1” 404 –
        13:03:12 web.1 | 127.0.0.1 – – [10/Aug/2021 13:03:12] “GET /favicon.ico HTTP/1.1” 404 –
        13:03:15 watch.1 | Watching for changes…
        13:03:28 web.1 | 127.0.0.1 – – [10/Aug/2021 13:03:28] “GET / HTTP/1.1” 404 –

  13. Hi. Karani, first of all, thanks for this! It is a great resource for those of us who want to start learning about ERPNext.

    I’ve followed all steps, but when running “bench start” I get several errors and the server stops.

    I’d appreciate a lot if you could help me

    “”
    19:59:07 redis_socketio.1 | 10645:M 05 Aug 2021 19:59:07.935 * Ready to accept connections
    19:59:07 system | schedule.1 started (pid=10657)
    19:59:07 system | worker_long.1 started (pid=10683)
    19:59:07 system | watch.1 started (pid=10665)
    19:59:07 system | worker_default.1 started (pid=10686)
    19:59:08 socketio.1 | internal/modules/cjs/loader.js:818
    19:59:08 socketio.1 | throw err;
    19:59:08 socketio.1 | ^
    19:59:08 socketio.1 |
    19:59:08 socketio.1 | Error: Cannot find module ‘express’
    19:59:08 socketio.1 | Require stack:
    19:59:08 socketio.1 | – /opt/bench/erpnext/apps/frappe/socketio.js
    19:59:08 socketio.1 | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    19:59:08 socketio.1 | at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    19:59:08 socketio.1 | at Module.require (internal/modules/cjs/loader.js:887:19)
    19:59:08 socketio.1 | at require (internal/modules/cjs/helpers.js:74:18)
    19:59:08 socketio.1 | at Object. (/opt/bench/erpnext/apps/frappe/socketio.js:1:11)
    19:59:08 socketio.1 | at Module._compile (internal/modules/cjs/loader.js:999:30)
    19:59:08 socketio.1 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    19:59:08 socketio.1 | at Module.load (internal/modules/cjs/loader.js:863:32)
    19:59:08 socketio.1 | at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    19:59:08 socketio.1 | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
    19:59:08 socketio.1 | code: ‘MODULE_NOT_FOUND’,
    19:59:08 socketio.1 | requireStack: [ ‘/opt/bench/erpnext/apps/frappe/socketio.js’ ]
    19:59:08 socketio.1 | }
    19:59:08 system | socketio.1 stopped (rc=1)
    19:59:08 system | sending SIGTERM to redis_cache.1 (pid 10639)
    19:59:08 system | sending SIGTERM to redis_socketio.1 (pid 10640)
    19:59:08 system | sending SIGTERM to redis_queue.1 (pid 10642)
    19:59:08 system | sending SIGTERM to web.1 (pid 10644)
    19:59:08 system | sending SIGTERM to watch.1 (pid 10665)
    19:59:08 system | sending SIGTERM to schedule.1 (pid 10657)
    19:59:08 system | sending SIGTERM to worker_short.1 (pid 10658)
    19:59:08 system | sending SIGTERM to worker_long.1 (pid 10683)
    19:59:08 system | sending SIGTERM to worker_default.1 (pid 10686)
    19:59:08 redis_cache.1 | 10647:signal-handler (1628211548) Received SIGTERM scheduling shutdown…
    19:59:08 redis_socketio.1 | 10645:signal-handler (1628211548) Received SIGTERM scheduling shutdown…
    19:59:08 redis_queue.1 | 10648:signal-handler (1628211548) Received SIGTERM scheduling shutdown…
    19:59:08 system | worker_default.1 stopped (rc=-15)
    19:59:08 system | web.1 stopped (rc=-15)
    19:59:08 system | watch.1 stopped (rc=-15)
    19:59:08 system | worker_short.1 stopped (rc=-15)
    19:59:08 system | worker_long.1 stopped (rc=-15)
    19:59:08 system | schedule.1 stopped (rc=-15)
    19:59:08 redis_cache.1 | 10647:M 05 Aug 2021 19:59:08.035 # User requested shutdown…
    19:59:08 redis_cache.1 | 10647:M 05 Aug 2021 19:59:08.035 * Removing the pid file.
    19:59:08 redis_socketio.1 | 10645:M 05 Aug 2021 19:59:08.035 # User requested shutdown…
    19:59:08 redis_cache.1 | 10647:M 05 Aug 2021 19:59:08.035 # Redis is now ready to exit, bye bye…
    19:59:08 redis_socketio.1 | 10645:M 05 Aug 2021 19:59:08.035 * Removing the pid file.
    19:59:08 redis_queue.1 | 10648:M 05 Aug 2021 19:59:08.035 # User requested shutdown…
    19:59:08 redis_queue.1 | 10648:M 05 Aug 2021 19:59:08.035 * Removing the pid file.
    19:59:08 redis_queue.1 | 10648:M 05 Aug 2021 19:59:08.035 # Redis is now ready to exit, bye bye…
    19:59:08 redis_socketio.1 | 10645:M 05 Aug 2021 19:59:08.035 # Redis is now ready to exit, bye bye…
    19:59:08 system | redis_queue.1 stopped (rc=-15)
    19:59:08 system | redis_cache.1 stopped (rc=-15)
    19:59:08 system | redis_socketio.1 stopped (rc=-15)

    “””

Leave a Reply

Open Chat