Centos 7 ERPNext Easy Install fix

From vpsget wiki
Revision as of 23:10, 23 June 2020 by Ndi (talk | contribs)
Jump to: navigation, search

How to install ERPNext on Centos 7

Definitely we will show how to install erpnext on Centos 7 on a VPS.

This should be really easy as per git info :https://github.com/frappe/bench#easy-install-script But for sure you may face many issues so we will show how to handle them easily.

Create user frappe and add to a wheel group first. If you on Centos mininal you'll require packages that may be already installed on non-mininal setup.

yum install sudo which nano

reLogin under user frappe and act via sudo.

su - frappe

Edit env:

nano /etc/environment
LANG=en_US.utf-8
LC_ALL=en_US.utf-8

Install depencies:

sudo yum groupinstall "Devevlopment Tools"
sudo yum install  python3  python3-devel python3-wheel ansible

Install nodejs:

sudo curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -
sudo yum install nodejs
#check:
node -v 
 v10.21.0

Run EasySetup sctipt. Please note during easy setup script you may also face issues. Using --verbose will show you more details - you'll be able to view in details which exactly ansible playbook caused an issue and fix/edit or remove part of playbook in order to skip error and handle it manually.

sudo python3 install.py --production --site erp.domain.com --user frappe  --verbose --container

I'll provide issues and troubleshoot experience/example:

First error I got about selinux policy even it was disabled on my vps so I've simply edited the corresponding book from the error:

nano /tmp/.bench/playbooks/roles/frappe_selinux/tasks/main.yml  

remove lines regarding selinux policy commands and init so file looks like:

---
- name: Install deps
  yum:
    name:
      - policycoreutils-python
      - selinux-policy-devel
    state: present
  when: ansible_distribution == 'CentOS' 

...

Restarted the easyinstall script and got the next issue:

TASK [bench : Create a new site] **********************************************************************************************
task path: /tmp/.bench/playbooks/roles/bench/tasks/setup_erpnext.yml:17
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /var/tmp `"&& mkdir /var/tmp/ansible-tmp-1592951572.4-31249-46029726533419 && echo ansible- 
tmp-1592951572.4-31249-46029726533419="` echo /var/tmp/ansible-tmp-1592951572.4-31249-46029726533419 `" ) && sleep 0' 
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-27698mrm95R/tmpeU0Goi TO /var/tmp/ansible-tmp-1592951572.4-31249-46029726533419/AnsiballZ_command.py
<127.0.0.1> EXEC /bin/sh -c 'setfacl -m u:frappe:r-x /var/tmp/ansible-tmp-1592951572.4-31249-46029726533419/ /var/tmp/ansible-tmp-1592951572.4-31249- 
46029726533419/AnsiballZ_command.py && sleep 0' 
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n  -u frappe /bin/sh -c '"'"'echo BECOME-SUCCESS-csgzmunubmeoqogldsmljkmyudingcit ; /usr/bin/python2 
/var/tmp/ansible-tmp-1592951572.4-31249-46029726533419/AnsiballZ_command.py'"'"' && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1592951572.4-31249-46029726533419/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "changed": true, 
    "cmd": [
        "bench", 
        "new-site", 
        "erp.domain.net", 
        "--admin-password", 
        "PASSWORD", 
        "--mariadb-root-password", 
        "DBPASSWORD"
    ], 
    "delta": "0:00:02.269755", 
    "end": "2020-06-23 18:32:54.889770", 
    "invocation": {
        "module_args": {
            "_raw_params": "bench new-site erp.domain.net --admin-password 'PASSWORD' --mariadb-root-password 'DBPASSWORD'", 
            "_uses_shell": false,   
 </ommited>

Googling the error will point us that most likely there was no bench init issued. let's do it manually:

cd /home/frappe/frappe-bench/
bench init erp.ikrok.net