Install ERPNext ERP Platform on Ubuntu 16.04 / 18.04 LTS with Nginx, MariaDB Support

ERPNext is simple and intuitive open-source ERP platform that supports manufacturing, distribution, retail, trading, services, education, non profits and other sectors…. It also includes human resources and accounting components to help manage the business employees and finances….

ERPNext is probably the best open source ERP management software to run your company…. used by thousands of businesses worldwide to manage their ERP processes…

ERPNext is a good place to start when you’re looking for a enterprise resource planning… this open source ERP software is built with open source tools and offer features that help you run your business and collaborate with your customers ane employees…

ERPNext is designed for ease of use to allow enterprises and business owners to collaborate and automate engaging experiences with customers through out the entire process…

This brief tutorial is going to show students and new users how to install ERPNext on Ubuntu 16.04 and 18.04 LTS…..

To install ERPNext, follow the steps below:

Step 1: Install ERPNext Requirements

To install ERPNext, you’ll have to install some python and other packages… as prerequisites… To get these packages installed on Ubuntu, please run the commands below:

sudo apt update
sudo apt install libffi-dev python-pip python-dev libssl-dev wkhtmltopdf curl git

Step 2: Install Node Js and Redis

You’ll also need to install these two packages as well… Node js and Redis.. To install them, run the commands below:

sudo curl --silent --location https://deb.nodesource.com/setup_8.x | sudo bash -
sudo apt-get install gcc g++ make
sudo apt-get install -y nodejs redis-server
sudo npm install -g yarn

Step 3: Install Nginx / MariaDB

You’ll also need Nginx and and database server… MariaDB is great open source database you can use with this setup…

To install Nginx HTTP on Ubuntu server, run the commands below…

sudo apt install nginx

After installing Nginx, the commands below can be used to stop, start and enable Nginx service to always start up with the server boots.

sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl enable nginx.service

To install MariaDB run the commands below…

sudo apt-get install mariadb-server mariadb-client

After installing MariaDB, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots..

Run these on Ubuntu 16.04 LTS

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service

Run these on Ubuntu 18.04 and 18.10 LTS

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

After that, run the commands below to secure MariaDB server by creating a root password and disallowing remote root access.

sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat 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

Next, open MariaDB config file and make the highlighted changes below… then save the file..

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

On Ubuntu 16.04:

sudo nano /etc/mysql/my.cnf

Add the lines in the file and save…

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

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_unicode_ci

[mysql]
default-character-set = utf8mb4

Now that MariaDB is installed and configure, run the commands below to create a new blank database for ERPNext….

To logon to MariaDB database server, run the commands below.

sudo mysql -u root -p

Then create a database called erpnext

CREATE DATABASE erpnext;

Create a database user called erpnextuser with new password

CREATE USER 'erpnextuser'@'localhost' IDENTIFIED BY 'new_password_here';

Then grant the user full access to the database.

GRANT ALL ON erpnext.* TO 'erpnextuser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

Finally, save your changes and exit.

FLUSH PRIVILEGES;
EXIT;

Step 4: Install / Configure ERPNext

At this time, your system is ready for ERPNext… First create a new system user called erpnextuser…. the create a password and add the user to the sudo group….

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

After that, create a directory in /opt called erpnext…

sudo mkdir -p /opt/erpnext
sudo chown -R erpnextuser /opt/erpnext/

Then change into the directory and install ERPNext…

su - erpnextuser
cd /opt/erpnext
git clone https://github.com/frappe/bench bench-repo
sudo pip install -e bench-repo
bench init erpnext && cd erpnext

Finally, create a new site for example.com domain…

bench new-site example.com
bench start

Step 3: Accessing ERPNext Portal

Now that ERPNext and PostgreSQL are installed, open your browser and browse to the server hostname or IP address followed by 8000

http://example.com:8000

You should then see ERPNext setup page… Follow the wizard and install ERPNext…

After that you’re all set!

Enjoy!

You may also like the post below:

Install Monit System Monitor on Ubuntu 18.04 / 16.04 LTS