Content

Setup Free Open Source ERP application for Centos 6 [ ERPNext]

ERPNext is a free open source ERP software developed by Frappé Technologies Pvt. Ltd. and is built on MariaDB database system using a Python based server-side framework.The pre-requsite for installing ERPNext is to install the Frappe Bench, the command-line package manager and site manager for Frappe Framework. Once you have installed Frappe Bench navigate to the bench folder to setup erpnext.

Preparation:

Disable SELINUX

Edit the file /etc/sysconfig/selinux and set SELINUX=disabled

[root@demohost ~]# vi /etc/sysconfig/selinux
..............
..............
#  disabled - No SELinux policy is loaded.
SELINUX=disabled
..............
..............

Now, configure firewall to allow traffic to port no 80 or 8000 depending on which port you are using for the ERPNext site. Edit /etc/sysconfig/iptables and add the following two lines.

[root@demohost ~]# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8000 -j ACCEPT
[root@demohost ~]# service iptables restart

Also check if you have already an instance of MySQL and httpd is running in your system. You can either stop or remove these two items as the installer script will install MariaDB and NGINX. If you keep these two (MySQL/httpd) running and proceed with the installation, the installer will exit in the middle of installation process while trying to configure MariaDB and NGINX.

1. Setup frappe for Open Source ERP

Create a directory by the name erpnext inside /opt and download the installer script there. The important point to remember is that we will run the installer script as root and it will create a new user “frappe” for future configuration/maintenance and updates.

[root@demohost ~]# mkdir /opt/erpnext
[root@demohost ~]# cd /opt/erpnext
[root@demohost erpnext]# wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
--2016-09-02 16:04:41--  https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
Resolving raw.githubusercontent.com... 151.101.100.133
Connecting to raw.githubusercontent.com|151.101.100.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14251 (14K) [text/plain]
Saving to: `setup_frappe.sh'
100%[======================================================================================>] 
14,251 45.3K/s   in 0.3s
2016-09-02 16:04:42 (45.3 KB/s) - `setup_frappe.sh' saved [14251/14251]
[root@demohost erpnext]# chmod u+x setup_frappe.sh
[root@demohost erpnext]# bash setup_frappe.sh --setup-production
Installing for centos 6 amd64
In case you encounter an error, you can post on https://discuss.frappe.io
Adding centos mariadb repo
Installing packages for centos. This might take time...
Installing wkhtmltopdf
Installing supervisor
Starting supervisord:
Configuring CentOS services
Starting services
Adding frappe user
Installing frappe-bench
Setting up first site
frappe-bench-redis: available
frappe-bench-web: available
frappe-bench-workers: available
frappe-bench-redis: added process group
frappe-bench-web: added process group
frappe-bench-workers: added process group
..........................
..........................
Port configuration list:
Site site1.local assigned port: 80
Frappe password: LoFDBjfV7HDnClP
MariaDB root password: Hl7gelGrPUTJ3zFW
Administrator password: JFRbku5aPkRJXub9
The passwords are also stored at ~/frappe_passwords.txt
You can remove this file after making a note of the passwords.

 

Next we need to configure the sites using the user “frappe”  that requires sudo privileges and do it by adding “frappe” in the wheel group.

[root@demohost erpnext]# usermod -aG wheel frappe

 

2. Install Open Source ERP [ERPNext]

The installer script will create a default site by the name site1.local. To create a new site that matches with your domain copy site1.local to your new site. The advantage of copying site1.local to your desired site name is that it will not create a new database.

[root@demohost ]# su frappe
[frappe@demohost ~]$ cd ~/frappe-bench
[frappe@demohost frappe-bench]$ mv sites/site1.local sites/demohost.hostingwikipedia.com
[frappe@demohost frappe-bench]$ bench --site demohost.hostingwikipedia.com install-app erpnext
[frappe@demohost frappe-bench]$ sudo bench setup production frappe
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:
Site demohost.hostingwikipedia.com assigned port: 80
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Restarted supervisord

Note: At this point you may get this error –

nginx: [emerg] unknown directive “proxy_http_version” in /etc/nginx/conf.d/frappe-bench.conf:42
nginx: configuration file /etc/nginx/nginx.conf test failed

To remove this error, comment the line.

[root@demohost ]# vi /etc/nginx/conf.d/frappe-bench.conf
......................
......................
location /socket.io {
# proxy_http_version 1.1;
......................
......................
}

Now restart NGINX and Supervisor

[root@demohost erpnext]# service nginx restart
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]
[root@demohost erpnext]# /etc/init.d/supervisord restart
Starting supervisord:
frappe-bench-redis:frappe-bench-redis-cache                 STARTING
frappe-bench-redis:frappe-bench-redis-queue                 STARTING
frappe-bench-redis:frappe-bench-redis-socketio              STARTING
frappe-bench-web:frappe-bench-frappe-web                    STARTING
frappe-bench-web:frappe-bench-node-socketio                 STARTING
frappe-bench-workers:frappe-bench-frappe-default-worker-0   STARTING
frappe-bench-workers:frappe-bench-frappe-long-worker-0      STARTING
frappe-bench-workers:frappe-bench-frappe-schedule           STARTING
frappe-bench-workers:frappe-bench-frappe-short-worker-0     STARTING

Change the admin password

[root@demohost opt]# su frappe
[frappe@demohost ~]$ cd frappe-bench/
[frappe@demohost frappe-bench]$ bench use demohost.hostingwikipedia.com
[frappe@demohost frappe-bench]$ bench set-admin-password password

Reload supervisor and check its status.

[root@demohost ~]# su - frappe
[frappe@demohost ~]$ cd frappe-bench/
[frappe@demohost frappe-bench]$ sudo supervisorctl reload
Restarted supervisord
[frappe@demohost frappe-bench]$ sudo supervisorctl status
frappe-bench-redis:frappe-bench-redis-cache                 RUNNING   pid 9903, uptime 0:00:08
frappe-bench-redis:frappe-bench-redis-queue                 RUNNING   pid 9902, uptime 0:00:08
frappe-bench-redis:frappe-bench-redis-socketio              RUNNING   pid 9904, uptime 0:00:08
frappe-bench-web:frappe-bench-frappe-web                    RUNNING   pid 9900, uptime 0:00:08
frappe-bench-web:frappe-bench-node-socketio                 RUNNING   pid 9901, uptime 0:00:08
frappe-bench-workers:frappe-bench-frappe-default-worker-0   RUNNING   pid 9896, uptime 0:00:08
frappe-bench-workers:frappe-bench-frappe-long-worker-0      RUNNING   pid 9898, uptime 0:00:08
frappe-bench-workers:frappe-bench-frappe-schedule           RUNNING   pid 9897, uptime 0:00:08
frappe-bench-workers:frappe-bench-frappe-short-worker-0     RUNNING   pid 9899, uptime 0:00:08

 

3. Configure ERPNext

Type the site’s name in your favorite browser and fill up few forms to complete the configuration process of ERPNext.

 

ERPNext login page

 

Choose your language and click “Next”

 

ERPNext welcom page

 

Select your country, Time Zone and currency and click “Next”

 

ERPNext select region

 

Create a first user who will be system manager. You can change it later. Click “Next”

 

ERPNext create first user

 

Select the domain of your business and click “Next”

 

ERPNext select your domain business

 

Fill up your Organization’s details and click “Next”

 

ERPNext organization details

 

Upload your letter head, logo etc and click “Next”

 

ERPNext attach letter head

 

Add users to your organization and click “Next”

ERPNext add user

 

Add tax rates and click “Next”

 

ERPNext add tax rates

 

Add few customers informations and click “Next”

 

ERPNext add customer

 

Add few suppliers informations and click “Next”

ERPNext add supplier

 

Enter your product informations and click “Complete Setup”

 

ERPNext complete setup

 

Wait for few seconds

 

ERPNext install wait

 

 

You will be redirected to ERPNext “desk” page.

 

ERPNext desk page

 

Once you have logged in to ERPNext, you may get this message “Redis cache server not running. Please contact Administrator / Tech support”.

To debug this error, first check whether Redis Cache server is running or not.

[root@demohost erpnext]# netstat -pltn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:22                  0.0.0.0:*               LISTEN      1701/sshd          
tcp        0      0 127.0.0.1:11000             0.0.0.0:*               LISTEN      12695/redis-server 
tcp        0      0 127.0.0.1:25                0.0.0.0:*               LISTEN      1832/master
tcp        0      0 127.0.0.1:8000              0.0.0.0:*               LISTEN      12702/python2.7 
tcp        0      0 127.0.0.1:12000             0.0.0.0:*               LISTEN      12697/redis-server 
tcp        0      0 0.0.0.0:9000                0.0.0.0:*               LISTEN      12704/node 
tcp        0      0 127.0.0.1:6379              0.0.0.0:*               LISTEN      11208/redis-server
tcp        0      0 0.0.0.0:80                  0.0.0.0:*               LISTEN      11074/nginx  
tcp        0      0 :::22                       :::*                    LISTEN      1701/sshd  
tcp        0      0 ::1:25                      :::*                    LISTEN      1832/master 
tcp        0      0 :::3306                     :::*                    LISTEN      11339/mysqld

In our case redis cache server is running. Let us check the redis logs

[root@demohost ~]# su - frappe
[frappe@demohost ~]$ cd frappe-bench/logs/
[frappe@demohost logs]$ tail redis-cache.error.log 
*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 10
>>> 'save ""'
Bad directive or wrong number of arguments
*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 10
>>> 'save ""'
Bad directive or wrong number of arguments

So according to log there is an offending configuration at line no 10. Edit the redis_cache.conf and remove this line.

[frappe@demohost ~]$ cd frappe-bench/config
[frappe@demohost config]$ cat redis_cache.conf 
dbfilename redis_cache.rdb
dir /home/frappe/frappe-bench/config/pids
pidfile /home/frappe/frappe-bench/config/pids/redis_cache.pid
bind 127.0.0.1
port 13000
maxmemory 50mb
maxmemory-policy allkeys-lru
appendonly no
save "" <------ offending line, Remove it.

Delete the last line, save the file and restart redis cache server. The error message will go-away.

[frappe@demohost ~]$ sudo supervisorctl restart redis-cache

Once you have tested ERPNext and its all features, remove user “frappe” from wheel group.

[root@demohost ~]# sudo usermod -G "" frappe

Conclusion:

 

Congratulation! Your Open Source ERP is now ready

Was this article helpful to you?

DD2016

Comments are closed.