Difference between revisions of "Centos 7 ERPNext Easy Install fix"
Line 166: | Line 166: | ||
Ok, Restart EasyInstall once again: | Ok, Restart EasyInstall once again: | ||
sudo python3 install.py --production --site erp.ikrok.net --user frappe --verbose --container | sudo python3 install.py --production --site erp.ikrok.net --user frappe --verbose --container | ||
+ | |||
+ | Next we can face again SeLinux policy related error: | ||
+ | TASK [frappe_selinux : Check enabled SELinux modules] ************************************************************************* | ||
+ | task path: /tmp/.bench/playbooks/roles/frappe_selinux/tasks/main.yml:10 | ||
+ | |||
+ | fatal: [localhost]: FAILED! => { | ||
+ | "changed": true, | ||
+ | "cmd": "semanage module -l", | ||
+ | "delta": "0:00:02.268645", | ||
+ | "end": "2020-06-23 19:53:43.270595", | ||
+ | "invocation": { | ||
+ | "module_args": { | ||
+ | "_raw_params": "semanage module -l", | ||
+ | "_uses_shell": true, | ||
+ | "argv": null, | ||
+ | "chdir": null, | ||
+ | "creates": null, | ||
+ | "executable": null, | ||
+ | "removes": null, | ||
+ | "stdin": null, | ||
+ | "stdin_add_newline": true, | ||
+ | "strip_empty_ends": true, | ||
+ | "warn": true | ||
+ | } | ||
+ | }, | ||
+ | "msg": "non-zero return code", | ||
+ | "rc": 1, | ||
+ | "start": "2020-06-23 19:53:41.001950", | ||
+ | "stderr": "ValueError: SELinux policy is not managed or store cannot be accessed.", | ||
+ | "stderr_lines": [ | ||
+ | "ValueError: SELinux policy is not managed or store cannot be accessed." | ||
+ | |||
+ | Remove all steps except - name: Install deps from /tmp/.bench/playbooks/roles/frappe_selinux/tasks/main.yml like we did it earlier |
Revision as of 23:58, 23 June 2020
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
Edit locale:
nano /etc/locale.conf LC_ALL=en_US.utf-8 LC_CTYPE=en_US.utf-8 LANG=en_US.utf-8 LC_COLLATE="C" #LANG=C
Relogin!
exit su - frappe
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. manually you can do it with cd /home/frappe/frappe-bench/&&bench init erp.example.net command . But we will add it to playbook.
- However please note that at this point erpnext is installed you may continue manual action to add site and generate nginx config
So modify corresponding playbook File [from error]: /tmp/.bench/playbooks/roles/bench/tasks/setup_erpnext.yml and add Init Bench step:
--- - name: Check if ERPNext App exists stat: path="{{ bench_path }}/apps/erpnext" register: app - name: Get the ERPNext app command: bench get-app erpnext {{ erpnext_repo_url }} --branch {{ erpnext_branch }} args: creates: "{{ bench_path }}/apps/erpnext" chdir: "{{ bench_path }}" when: not app.stat.exists and not without_erpnext - name: Check whether the site already exists stat: path="{{ bench_path }}/sites/{{ site }}" register: site_folder - name: Init bench command: "bench init {{ site }}" args: chdir: "{{ bench_path }}" - name: Create a new site command: "bench new-site {{ site }} --admin-password '{{ admin_password }}' --mariadb-root-password '{{ mysql_root_passwor$ args: chdir: "{{ bench_path }}" when: not site_folder.stat.exists - name: Install ERPNext to default site command: "bench --site {{ site }} install-app erpnext" args: chdir: "{{ bench_path }}" when: not without_erpnext ...
OK relogin for any case and restar easyinstall:
cd /home/<whete install.py exisst> sudo python3 install.py --production --site erp.ikrok.net --user frappe --verbose --container
And we got failed on the supervisorctl playbook:
TASK [Restart the bench] ****************************************************************************************************** task path: /tmp/.bench/playbooks/roles/bench/tasks/setup_bench_production.yml:24 "stderr_lines": [], "stdout": "unix:///var/run/supervisor/supervisor.sock no such file\n\u001b[90m$ sudo supervisorctl restart frappe:\u001b[0m", "stdout_lines": [ "unix:///var/run/supervisor/supervisor.sock no such file", "\u001b[90m$ sudo supervisorctl restart frappe:\u001b[0m"
Ok. that's simple - just start supervisord service manually :
sudo systemctl start supervisord sudo systemctl status supervisord #should be ok. otherwise go to supervisord logs or check if it's installed and install if missed.
Check supervisord socket for any case:
sudo lsof -c supervisord | egrep 'COMMAND|sock' $output: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME superviso 9874 root mem REG 182,492801 83872 524594 /usr/lib64/python2.7/lib-dynload/_socketmodule.so superviso 9874 root 4u unix 0xffff881ff9d0a840 0t0 2609143405 /var/run/supervisor/supervisor.sock.9871 superviso 9874 root 37w REG 182,492801 21 39588217 /home/frappe/frappe-bench/logs/node-socketio.log superviso 9874 root 38w REG 182,492801 0 39588218 /home/frappe/frappe-bench/logs/node-socketio.error.log superviso 9874 root 52w REG 182,492801 2162 39588223 /home/frappe/frappe-bench/logs/redis-socketio.log superviso 9874 root 53w REG 182,492801 0 39588224 /home/frappe/frappe-bench/logs/redis-socketio.error.log
Ok, Restart EasyInstall once again:
sudo python3 install.py --production --site erp.ikrok.net --user frappe --verbose --container
Next we can face again SeLinux policy related error:
TASK [frappe_selinux : Check enabled SELinux modules] ************************************************************************* task path: /tmp/.bench/playbooks/roles/frappe_selinux/tasks/main.yml:10 fatal: [localhost]: FAILED! => { "changed": true, "cmd": "semanage module -l", "delta": "0:00:02.268645", "end": "2020-06-23 19:53:43.270595", "invocation": { "module_args": { "_raw_params": "semanage module -l", "_uses_shell": true, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "stdin_add_newline": true, "strip_empty_ends": true, "warn": true } }, "msg": "non-zero return code", "rc": 1, "start": "2020-06-23 19:53:41.001950", "stderr": "ValueError: SELinux policy is not managed or store cannot be accessed.", "stderr_lines": [ "ValueError: SELinux policy is not managed or store cannot be accessed."
Remove all steps except - name: Install deps from /tmp/.bench/playbooks/roles/frappe_selinux/tasks/main.yml like we did it earlier