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 /home/bench $ sudo chown -R erpnext /home/bench
Next switch to erpnext user and install the application:
$ sudo su - erpnext $ cd /home/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 --frappe-branch version-13
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
62 comments
Hi,
Thanks for this great tut, i followed your instructions, everything seems fine but when i connect nginx says 404 not found; 192.168.1.53 does not exist. after bench start it shows me ip address and the port, i tried but no hope can you help me?
kinds.
You really make it appear so easy with your presentation however I find this topic to be really one thing that I think I would by no means understand. It sort of feels too complicated and very broad for me. Im taking a look ahead for your subsequent put up, I will attempt to get the grasp of it!
hello Karani;
erpnext is work fine but when i use the data import and try downloading a template for a doctype for example journal entry template, nothing comes up. can you please help me with this please.
am using the administrator as a login user which has the full access of the software but its not working please. when i click on the download template nothing actually opens up. please assist me.
i used your instructions here to set up erpnext on ubuntu 20.04.
Installed it as per instructions. I only get welcome to nginx page, ERPNEXT doesn’t start
Ensure your server is running, then remember to add port number at the end of the URL if you are on development mode.
i have an error while installing
An error occurred while installing erpnext: (1146, “Table ‘_02de4f380077fc44.tabDefaultValue’ doesn’t exist”)
Hi
Thanks for providing such tutorial. I have followed ur instruction and got result 100% as per your instruction.
But…
the domain which I set did not opening the erpnext website…it is opening as below…..;
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
Now please suggest what to do?
Thanks
Deploy production
Hi Karani,
Thanks for this this video. every thing going fantastic before this error .
can you please help
erpnext@3ree:/opt/bench$ bench init erpnext
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/click/termui.py”, line 372, in style
bits.append(‘\033[%dm’ % (_ansi_colors.index(fg) + 30))
ValueError: tuple.index(x): x not in tuple
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/bench/commands/make.py”, line 83, in init
verbose=verbose,
File “/usr/local/lib/python3.6/dist-packages/bench/utils/render.py”, line 95, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.6/dist-packages/bench/utils/system.py”, line 64, in init
bench.setup.env(python=python)
File “/usr/local/lib/python3.6/dist-packages/bench/utils/render.py”, line 110, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.6/dist-packages/bench/bench.py”, line 249, in env
self.run(f”{virtualenv} {quiet_flag} env -p {python}”)
File “/usr/local/lib/python3.6/dist-packages/bench/bench.py”, line 43, in run
return exec_cmd(cmd, cwd=cwd or self.cwd)
File “/usr/local/lib/python3.6/dist-packages/bench/utils/__init__.py”, line 116, in exec_cmd
click.secho(f”$ {cmd}”, fg=”bright_black”)
File “/usr/lib/python3/dist-packages/click/termui.py”, line 420, in secho
return echo(style(text, **styles), file=file, nl=nl, err=err, color=color)
File “/usr/lib/python3/dist-packages/click/termui.py”, line 374, in style
raise TypeError(‘Unknown color %r’ % fg)
TypeError: Unknown color ‘bright_black’
ERROR: There was a problem while creating erpnext
Do you want to rollback these changes? [y/N]:
successfully installed thank you, but what are my login credentials!
Username: Administrator
Password: [YOU SET IT UP DURING INSTALLATION]
Karani,
I’ve been trying to follow along with your blog post with everything going good until i get to the
” UPDATE user SET plugin=’mysql_native_password’ WHERE User=’root’;”
I’m getting the following errors
“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
MariaDB [mysql]> ”
This is were things come to a halt. I see other posts from back in August with similar issues but no work around. Any help you can give to get past this point would be much appreciated. I using this in a virtual machine with Ubuntu 20.10 just to try it out and see what all the modules can do.
johnm@Ubuntu-ERPnext:~$ sudo mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 49
Server version: 10.5.13-MariaDB-0ubuntu0.21.10.1 Ubuntu 21.10
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> USE mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> UPDATE user SET plugin=’mysql_native_password’ WHERE User=’root’;
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
MariaDB [mysql]>
Hi Karani,
I have been trying to use your guide to install ERPNext as localhost, but I have been unsuccessful. I have been install all steps but when im trying to use localhost 127.0.01:8000 it shows 127.0.0.1 does not exist or not found.Would you able to help me?
Hi;
Thanks for your quality teaching. I installed this application on Hyper-V, it works fine. However, when I restart the pc, I have to go to the terminal page and run the “bench start” manually again. How can I start the “bench start” automatically after reboot.
Hello Sener, just deploy the instance for production.
https://codewithkarani.com/2021/09/16/setup-erpnext-for-production/
Hi Karani,
I have been trying to use your guide to install ERPNext as localhost, but I have been unsuccessful. Would you be able to assist me?
Thanks…
How do I help? Please write to me on email.
plesae check
please check
Hello Bro,
Please help me to install a property management module in erpnext. Rental Property Units are there.
Hello, I will get back to you on this item in a couple of hours.
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
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
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
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$
Hi Karani,
Excellent tutorial; I just wanted to know if there is a way to add Erpnext to the startup applications as a script or something?
Thanks
Thank you. You don’t need to do that. Just enable production mode for your instance and it will come on with your machine. Follow this article https://codewithkarani.com/2021/09/16/setup-erpnext-for-production/
Hi Karani,
I have been trying to use your guide to install ERPNext as localhost, but I have been unsuccessful. Would you be able to assist me?
Thanks
Hello Francois,
Sure. Please make a request to my email, geoffrey.kamundi@gmail.com for planning
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.
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..
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
I can take a quick look into the issue. Please drop me an email from https://codewithkarani.com
best erpnext install guide on the internet IMO, one thing please show how to enable bench to start on bootup and how to run bench a deamon flag.
Thank you for Ridro. To enable bench start on boot, you just need to put your instance to production mode. Please refer to this article https://codewithkarani.com/2021/09/16/setup-erpnext-for-production/
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’;
Hello Karani. Please address this question. I’ve experienced the same problem
Thank-you “Veere” Nice
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
Hello, please follow the steps in this post and let me know if you have further questions => https://frappeframework.com/docs/user/en/bench/guides/setup-production
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.
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.
Maybe you need a bench start
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
Hi,
You forgot your password?
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.
Is your server running? As in did you already bench start
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:~$
Please make sure you are using bench as a bench user. So you may need to do sudo su – [YOUR BENCH USER], then navigate to the directory that contains your installation
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:~$
Please allow me about 2 hours, I will get back to you with help. Just make sure you have TeamViewer or AnyDesk installed on your machine.
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 !
hello
even me i get this problem too.
before running bench start you have to type following.
cd /opt/bench/erpnext
bench start
This should resolve the issue you are having
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
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!
Hello Jorge. Do you have all the requirements, including hardware requirements?
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 –
Your site didn’t install correctly. I recommend a re-install; please check that your system also meets all requirements.
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)
“””
change gedit for nano
Maybe you hadn’t installed gedit. Am glad you found a workaround.