You are here: Home / ERPNext 13 install on Debian 10

ERPNext 13 install on Debian 10

Notes on installing ERPNext on Debian 10


apt update
apt upgrade

 Reboot if needed.


Upgrade to Python 3.8

For ERPNext version 13, Python 3.8 is needed (3.9 is not fully compatible). Debian 10 only provide Python 3.7, so it is necessary to upgrade to the latest 3.8.x version of Python.


install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev


ownload the latest release’s source code from the Python download page with wget or curl . At the time of writing this article, the latest release is 3.8.13:

curl -O


Extract the tarball:

tar -xvf
cd Python-3.8.2
./configure --enable-optimizations

The script performs a number of checks to make sure all of the dependencies on your system are present. The --enable-optimizations option will optimize the Python binary by running multiple tests, which will make the build process slower.


Run make to start the build process (Modify the -j to correspond to the number of cores in your processor. You can find the number by typing nproc.):

make -j 2


Once the build is done, install the Python binaries by running the following command as a user with sudo access. Do not use the standard make install as it will overwrite the default system python3 binary:

sudo make altinstall


Python 3.8 is installed on your Debian system and ready to be used. You can verify it by typing:

python3.8 --version

Python 3.8.13


Install Prerequisite packages via apt


apt -y install git vim libffi-dev python-pip python3-distutils python-dev libssl-dev wkhtmltopdf



Patch qt of wkhtmltopdf

apt install wget
apt install libxrender1 libxext6 xfonts-75dpi xfonts-base fontconfig
 # wget
# dpkg -i wkhtmltox_0.12.6-1.buster_amd64.deb
 rm wkhtmltox_0.12.6-1.buster_amd64.deb


apt -y install nodejs npm redis-server

npm install -g yarn


Install nginx

apt -y install nginx



Setup environment

sudo localectl set-keymap us && sudo localectl set-locale LANG=en_US.utf8


sudo vi /etc/environment

add the following content:


save file and reboot system.



Install git, python, and redis

apt install git python-dev python-pip redis-server


Install Supervisor and set it to start automatically:

# apt install supervisor
# systemctl enable --now supervisor



Install MariaDB

apt-get install software-properties-common
apt-get install mariadb-server-10.3


During this installation you'll be prompted to set the MySQL root password. If you are not prompted, you'll have to initialize the MySQL server setup yourself. You can do that by running the command:




root@erpnext1-deb10-stg:/home/erpnextuser# mysql_secure_installation
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!


Mariadb must be 10.3 or newer.

Apt update and install additional Mariadb files if missing:

apt update && apt install mariadb-server libmariadb-dev-compat libmariadb-dev 
also need the MySQL database development files.
apt-get install mariadb-client-10.3



Edit the MariaDB configuration file.

vi /etc/mysql/my.cnf

add this configuration

character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
default-character-set = utf8mb4

 Save file.


Configure MariaDB for use with Frappe-Bench

Edit your mariadb.cnf file to enable the Baracuda engine for innodb:

# vi /etc/mysql/mariadb.conf.d/50-server.cnf
  • Insert the following below the [mysqld] block:
  • [mysqld]

Insert the following below the [mysql] block:

default-character-set = utf8mb4


Save file and exit.


restart the mysql/mariadb service and you are good to go.

service mysql restart


or for mariadb

service mariadb restart


systemctl restart mariadb


Prepare database for ERPNext db

mysql -u root -p


Create a database and grant users all permissions to manage the database.

CREATE USER 'erpnext'@'localhost' IDENTIFIED BY 'yourpasswordhere';
GRANT ALL ON *.* TO 'erpnext'@'localhost' with grant option;






Install curl

apt install curl


Setup erpnuser

useradd -m -s /bin/bash erpnuser
passwd erpnuser
usermod -aG sudo erpnuser


Setup environment

su - erpnuser
export LC_ALL=C.UTF-8


vim ~/.bashrc



Install Node using nvm

curl -o- | bash


After nvm is installed, you may have to close your terminal and open another one.


su - erpnuser


Now run the following command to install node.

nvm install 14



Verify the installation, by running:

node -v
# output

Install yarn using npm

npm install -g yarn




Note about using pip (recommend use within venv)

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 22.1.2 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7)


so instead run:

python3 -m pip --version
pip 22.1.2 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7)



WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead:


Example (don't follow this literally, this is just a general guideline):

create the project directory and switch to it:

mkdir ~/my_app && cd ~/my_app
From inside the project root run the following command to create a virtual environment named my_app_venv:

python3.8 -m venv my_app_venv
Activate the environment:

 source my_app_venv/bin/activate


Further System prep before ERPNext install


Enable redis automatically on startup (unless setting up DEV environment):

systemctl enable --now redis-server.service


as erpnuser:

pip3.8 install ansible


 Double-check that yarn is installed via npm and not otherwise, else may cause problems.

As erpnuser:

npm install -g yarn


Setup erpnext install directory structure

Create a directory for ERPNext setup and provide erpnext User read and write permissions on the directory:

sudo mkdir /srv/bench
sudo mkdir /srv/venv_erpnext
sudo chown -R erpnuser /srv/bench
sudo chown -R erpnuser /srv/venv_erpnext



su - erpnuser
cd /srv/bench


cd /srv/venv_erpnext
python3.8 -m venv venv_erpnext


Install Bench


Install Bench CLI

pip3.8 install frappe-bench


Confirm the bench installation by checking version

bench --version




su - erpnuser


cd /srv/venv_erpnext
source venv_erpnext/bin/activate


Prompt should now look like this:

(venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext$


Make sure pip is up to date

/usr/local/bin/python3.8 -m pip install --upgrade pip


sudo -H /usr/local/bin/python3.8 -m pip install --upgrade pip

Which is better? because latter shows following warning:

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead:


cd /srv


/srv/venv_erpnext/venv_erpnext/bin/python3.8 -m pip install --upgrade pip


pip3.8 install frappe-bench


sudo -H pip3 install frappe-bench 

(but warnings about running as root and permission issues, so what is the correct approach?)

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead:

Why don't any of the erpnext instructions including venv approach?


(venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext$ pip3.8 install frappe-bench



  • To install the standard (Developer) branch:
    • $ bench init frappe-bench


  • To install the stable (version-13) branch:
    • $ bench init --frappe-branch version-13 frappe-bench

 THIS IS BEST (yes?):

(venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext$ bench init --frappe-branch version-13 frappe-bench



  1. Switch to the newly created Bench instance folder, the name you chose at point 1 above will be the name of the bench folder:
    • (venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext$ cd frappe-bench/



 test whether it installed correctly with the following command, which should return the currently installed Bench version, 5.3.0 at the time of updating this how-to:

  • (venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ bench --version


Download the ERPNExt app for Bench


  1. If you chose to go with the standard (Developer) branch during step 5:
    • (venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ bench get-app erpnext
  2. If you chose to go with the stable (version-13) branch during step 5:
    • (venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ bench get-app --branch version-13 erpnext



Create a site which will host your ERPNext instance:

    1. Note that you should use the fqdn (Fully Qualified Domain Name) which you set up in DNS. For this example we will use The MariaDB User you created at point 2 in Step 2 can be substituted if you did not use bench as the username for your instance.
    2. Create the Bench site:
(venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ bench new-site --your-mariadb-root-username erpnext
    • Provide the MariaDB password which you configured at point 2 in Step 2 here. For example "erpnext"
  1. During the installation, the installer will ask you to create an Administrator Password, make a note of the password you choose as you will need it to log in to ERPNext once it is installed.. Note I tried getting this to work with the mysql GRANT erpnext.* but it wouldn't install until I went with more risky *.* instead.


You can now manually start Bench using the command bench start, however we won't be doing that as we want it to start automatically, which is done by setting up Bench for Production Use.


Set up Bench for production use

  1. In order to use your ERPNext installation in a production environment, you should automate starting, maintenance and various other tasks, luckily Bench can do this for you by making use of Supervisor, which we installed during Step 1:
    • (venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ sudo bench setup production erpnext
      [sudo] password for erpnuser:
    • Answer with (y) when asked to replace the default Supervisor and NginX config files.




Enable multi-tenancy for Bench:
(venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ bench config dns_multitenant on

ERROR "getpwnam" name not found: erpnext "erpnext"


Workaround, set dns_multitenant off

If multitenant already on, turn it off with: bench config dns_multitenant off


Otherwise just do the previous command earlier but with dns_multitenant off:

(venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ bench config dns_multitenant off


  1. Enable Bench scheduler:
    • (venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ bench enable-scheduler




Should now be finished.

Now simply point web browser at the site configured: and it should show you the login page. Use Administrator as the username and the password which you configured during earlier.


Bench Command Not Found When Running Bench Setup Production


If sudo breaks the bench command - You'll need to install bench as sudo

(venv_erpnext) erpnuser@ip-172-31-15-101:/srv/venv_erpnext/frappe-bench$ sudo bench setup production erpnext
sudo: bench: command not found
(venv_erpnext) erpnuser@ip-172-31-15-101:/srv/venv_erpnext/frappe-bench$ sudo pip3.10 install frappe-bench


No domains available - drop-site and try again


(venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ bench drop-site --db-root-username erpnext


(venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ bench new-site --mariadb-root-username erpnext


(venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ bench get-app erpnext
A directory for the application 'erpnext' already exists. Do you want to continue and overwrite it? [y/N]: y


(venv_erpnext) erpnuser@erpnext1-deb10-stg-hh-rpgr:/srv/venv_erpnext/frappe-bench$ bench --site install-app erpnext


That failed to work, so removing erpnext app from apps/erpnext:

bench remove erpnext

bench get-app erpnext


Installing erpnext
$ /srv/venv_erpnext/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /srv/venv_erpnext/frappe-bench/apps/erpnext
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
frappe 13.31.0 requires PyJWT~=1.7.1, but you have pyjwt 2.4.0 which is incompatible.
frappe 13.31.0 requires six~=1.15.0, but you have six 1.16.0 which is incompatible



pip install PyJWT==1.7.1
pip install six==1.15.0


bench remove erpnext 


bench new-site --mariadb-root-username erpnext
bench get-app erpnext
bench --site install-app erpnext


 errors, so drop site again

bench drop-site --force --db-root-username erpnext



Trying this:


pip3 install frappe-bench
bench init --frappe-branch version-13 frappe-bench
cd frappe-bench


 bench new-site --mariadb-root-username erpnext

 bench get-app --branch version-13 erpnext

 bench --site install-app erpnext

sudo bench setup production erpnuser


Now, due to recent problems it is important to check for the existence of an important configuration file. Execute the following command:

sudo ls /etc/supervisor/conf.d

If supervisor.conf is listed as a file here, then you can skip to the ‘enable scheduler’ step below. However, If there are no files listed then the supervisor.conf file was not transferred properly. To fix this perform the following command:

sudo cp /srv/venv_erpnext/frappe-bench/config/supervisor.conf /etc/supervisor/conf.d/supervisor.conf 

This should fix the problem of not being able to get to the login screen.  You can now finish the rest of the install.

bench --site enable-scheduler      


Now reboot the server. Once it has rebooted you should be able to open a web browser and type in the ip address of your server to get the ERPNext login screen