In this tutorial, we will show you how to install ERPNext on Ubuntu 20.04 LTS. For those of you who didn’t know, ERPNext is an Enterprise Resource Planning (ERP) is a simple yet free and open source ERP system written using Frappe framework – a full-stack web app framework in Python and JavaScript. 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.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the ERPNext open-source ERP system on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
Prerequisites
- A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint or elementary OS.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install ERPNext on Ubuntu 20.04 LTS Focal Fossa
Step 1. First, make sure that all your system packages are up-to-date by running the following apt
commands in the terminal.
sudo apt update sudo apt upgrade sudo apt install libffi-dev python3-pip python3-dev python3-testresources libssl-dev wkhtmltopdf gcc g++ make
Step 2. Installing Node.js and Redis.
Now we add the Node.js version 12 repository using the following command:
curl -sL https://deb.nodesource.com/setup_12.x | bash -
Once done, run the following command to install Node.js and Redis server on your system:
sudo apt install nodejs redis-server
Next, install the Yarn package by running the following command:
npm install -g yarn
Step 3. Installing MariaDB.
MariaDB is a relational database management system forked from MySQL. It is free and Open-source. Install MariaDB using the following commands:
sudo apt install software-properties-common mariadb-server mariadb-client
Once installing MariaDB, the commands below can be used to stop, start, and enable the MariaDB service to always start up when the server boots:
sudo systemctl status mariadb sudo systemctl enable mariadb sudo systemctl start mariadb
By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation
script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
mysql_secure_installation
Configure it like this:
- Set root password? [Y/n] y - 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
To log into MariaDB, use the following command (note that it’s the same command you would use to log into a MySQL database):
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'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT;
Save and close the file, then restart the MariaDB service to implement the changes:
sudo systemctl restart mariadb
Step 4. Create a User for ERPNext.
Now we create a new user named erpnext
by running the following command:
useradd -m -s /bin/bash erpnext passwd erpnext 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
Step 5. Installing ERPNext on Ubuntu 20.04.
First, log in with the ERPNext user and create a new directory for the 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
After that, 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 successfully installed, initialize the bench directory with the Frappe framework using the following command:
bench init erpnext
Next, change the directory to erpnext
and create a new frappe site with the following command:
bench new-site erpnext.idroot.us
Then, start the bench service with the following command:
bench start
Step 6. Configure Nginx and Supervisord.
Run the following commands to install Nginx and Supervisord:
su - erpnext sudo apt-get -y install supervisor nginx
Then, 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
Step 7. Access ERPNext Web Interface on Ubuntu.
ERPNext is installed and configured to run on port 80. Now, open your web browser and type the URL http://erpnext.idroot.us
.
Congratulations! You have successfully installed ERPNext. Thanks for using this tutorial for installing the ERPNext open-source ERP system on your Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official ERPNext website.