Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2006

    Exclamation Unanswered: Problem with initdb

    hi, im using Redhat 9 and i have Postgresql 8.0.7 installed. i've checked at that 8.0.7 is supported by redhat 9. i've tried to install many times but im still encountering this error. does anyone knows what is wrong?

    [root@en23-6-147-ws15 local]# su - postgres
    -bash-2.05b$ initdb
    /usr/bin/initdb: line 1: basename: command not found
    /usr/bin/initdb: line 1: sed: command not found
    /usr/bin/initdb: line 1: sed: command not found
    : bug: version number has wrong format <--- what does this mean?

    -bash-2.05b$ echo $PGDATA

    [root@en23-6-147-ws15 local]# echo $POSTGRESQL_HOME

    -bash-2.05b$ echo $PGDATA
    i created a folder(data) in $POSTGRESQL_HOME(/usr/local/pgsql) to store the database.
    Should PGDATA point to /var/lib/pgsql/data? or /usr/local/pgsql/data?

    ***Start the DB***
    -bash-2.05b$ pg_ctl start
    /usr/bin/pg_ctl: line 1: basename: command not found
    /usr/bin/pg_ctl: line 1: sed: command not found
    FATAL: File /var/lib/pgsql/data/PG_VERSION is missing. This is not a valid data directory.
    postmaster successfully started

    What is PG_VERSION? do i have to run initdb for it to appear?

    ***Stop the DB***
    -bash-2.05b$ pg_ctl stop
    /usr/bin/pg_ctl: line 1: basename: command not found
    /usr/bin/pg_ctl: line 1: sed: command not found
    : cannot find /var/lib/pgsql/data/
    Is postmaster running?

    Does this mean that postmaster didnt start?

    can anyone help? i do not know what is going on, and this is my first time using linux. kindly anyone help out. i'm having a grading in 3days time.
    let me know if u need any extra information.
    Thanks alot!

  2. #2
    Join Date
    Nov 2014


    Dear Friend,

    I was also encountered with same issue. I have solved the issue using the below steps:

    After the installation of postgres, you have to follow the below steps:

    1) Create a user for your postgresql service with password.

    eg: #adduser postgres
    #passwd postgres

    2) Then make a directory named data under pgsql folder. If it is already present then take a BACKUP(*very important") and empty that folder

    #mkdir /usr/local/pgsql/data

    3)Now give ownership to this "data" directory

    # chown postgresostgres /usr/local/pgsql/data

    4) Now you have to switch to the user postgres

    #su - postgres

    5) Run the below command to initiate the postgresql data directory

    #/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/

    6) Now all the default contents are created under the data directory including the PG_VERSION.

    7) If you want to change the port setting of postgresql then change the port setting at postgresql.conf available under "data" directory

    8) To start the service run the below command

    eg: /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data

    Hope these steps will help you.

    Wishing you all the best.

    Thanks and Regards,
    Priya Prabhakar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts