What to do when i get “../setenvDefaults.sh’: No such file or directory” when reattempting to install Xray on RHEL?

Subject 

When reattempting to install Xray on RHEL system after a failed attempt, and you have removed Xray data folders such as "/opt/jfrog/xray" and "/var/opt/jfrog/" the installation script will not try to reattempt the installation from scratch which can lead to the installation script trying to copy "setenvDefaults.sh" file which was already deleted when trying to delete all related Xray folders.
 

Resolution

To resolve this error and be able to start a new installation, please take the following steps to properly delete the Xray installation along with all related data:

1. Remove services (Might not be able to execute this steps since you have deleted the /op/.. folder):
/opt/jfrog/xray/scripts/uninstallService.sh server
 
2. Uninstall the Xray RPM packages:
rpm -ev –noscripts $(rpm -qa | grep xray)
rpm -ev –noscripts $(rpm -qa | grep mongodb)
rpm -ev –noscripts $(rpm -qa | grep rabbitmq)
rpm -e  esl-erlang
 
3. Uninstall Postgres:
/opt/PostgreSQL/9.5/uninstall-postgresql
rm /usr/lib/systemd/system/postgresql-9.5.service
systemctl daemon-reload
 
3. Remove the data directories and system users (** If present ** with a privileged user):
userdel -rf postgres
userdel -rf mongod
userdel -rf rabbitmq
rm -rf /var/opt/jfrog
rm -rf /opt/jfrog/xray
rm -rf /var/opt/jfrog/postgres
rm -rf /home/xray
rm -rf /var/log/rabbitmq
rm -rf /var/lib/rabbit*
rm -rf /var/lib/mongo*