Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm following these instructions, however I can only get to step 17.2.

Despite installing postgresql successfully via the

sudo apt-get install postgresql

command, upon running

initdb -D /usr/local/pgsql/data

Ubuntu tells me that it 'initdb' isn't installed. The instructions tell me this command is installed by

sudo apt-get install postgresql

so what's going on? I can make initdb available by installing postgres-xc, but I think postgres-xc is just some weird third party rubbish, and it's not detailed in the instructions. Any ideas?

share|improve this question

3 Answers 3

up vote 0 down vote accepted

initdb is intended to be run under the postgres user account that is created during the install. After installing postgresql you can do:

sudo su - postgres

Then you should be able to run initdb.

share|improve this answer
    
Quoting from /usr/share/doc/postgresql-common/README.Debian.gz: Please note that you can of course also use the upstream tools for creating clusters, such as initdb(1). However, please note that in this case you cannot expect *any* of above pg_* tools to work, since they use different configuration settings and file locations. If in doubt, then do *not* use initdb, but only pg_createcluster. Since merely installing postgresql-X.Y will already set up a default cluster which is ready to work, most people do not need to bother about initdb or pg_createcluster at all. –  cdaddr May 14 at 7:56

You will find initdb under /usr/lib/postgresql/x.y/bin/. See also /usr/share/doc/postgresql-common/README.Debian.gz for more information on the setup on Debian and Ubuntu.

share|improve this answer
    
This really should be the accepted answer. initdb is the underlying command but Debian and Ubuntu users should be using pg_createcluster and its related suite of commands. Furthermore you normally do not need to initdb OR pg_createcluster after apt-get install postgresql because the standard install already creates a default cluster, with a server and default/template databases, for you. The README Peter mentions above is worth your time to read. –  cdaddr May 14 at 7:52

foll the following steps from root 1.passwd postgres your password then 2.su postgres 3.psql 4. create user of your user name like "CREATE USER SAM ;" 5.create database sam; now log out 6.type psql to your user

share|improve this answer
    
This answer does not address the question directly at all. –  cdaddr May 14 at 7:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.