title: postgresql-10 : The program "initdb" is needed by pg_ctl but was not found in the same directory as "pg_ctl" Check your Installation
body: <p>I am new to this forum,  i am facing this issue, where i get the below error.</p>
  
  <pre><code>sudo -u shahid ./pg_ctl -D /root/pgsql10x/data/ initdb
  invalid binary "/root/pgsql10x/bin/pg_ctl"
  invalid binary "/root/pgsql10x/bin/pg_ctl"
  invalid binary "/root/pgsql10x/bin/pg_ctl"
  
  The program "initdb" is needed by pg_ctl but was not found in the same directory as "pg_ctl".
  
  Check your installation.
  </code></pre>
  
  <p>I am trying to run this from root. </p>
  
  <p>I have built from the source. I am trying version 10. on CentOS7.
  I downloaded direct from postgres site.</p>
  
  <p>I am not facing this problem when I run as non-root user.</p>
  
  <p>I have all the files in the bin directory, as shared in image here:</p>
  
  <p><img src="https://i.stack.imgur.com/Tb3HF.jpg" alt="bin directory files"></p>