Re: Getting Started newbie questions) - Mailing list pgsql-novice

From Jason Earl
Subject Re: Getting Started newbie questions)
Date
Msg-id 87adiamczo.fsf@npa01zz001.simplot.com
Whole thread Raw
In response to Getting Started newbie questions)  (Steve_Miller@sil.org)
List pgsql-novice
Steve_Miller@sil.org writes:

> I'm new to both Linux and Postgres

Welcome to the club

> I installed Red Hat 8 on a stand-alone test machine yesterday. I did
> a custom install, and installed everything. So my assumption is that
> everything Red Hat 8 could install was installed, including
> Postgresql.

You will soon find out that in Linux installing *everything* gets a
lot of stuff installed.  That's handy when you are first learning to
use Linux (you don't have to worry about installing things later), but
it's probably not a good idea on a production machine.

> I went into Server Settings, Services, and in Service Configuration found
> postgresql. I checked it, so that it would start on reboot. The machine has
> since been rebooted
>
> The tutorial says the Postgresql is stored in /usr/local/pgsql/ and
> /usr/local/pgsql/data. I don't see either one, either as me (Steve) or as
> root. I do see files under /usr/lib/, usr/share/, and usr/include.

The tutorial supposes that you installed from source code.  /usr/local
is where you should install packages that you install from source code
instead of via RPM.  On my Debian machine the actual database is
stored in /var/lib/postgres, and the various binaries are somewhere in
the /usr diretories RedHat is probably similar.  Learning the hows,
whys, and wheres of the Linux filesystem is pretty useful stuff, but
it isn't necessary for running PostgreSQL.

> The tutorial says to try to create a new database with
>
>       $ createdb mydb
>
> I get the error:
>
>
>       psql: FATAL 1:  user "Steve" does not exist
>       createdb: database creation failed.

That's actually a good sign.  It would appear that PostgreSQL is up
and running, the problem is that you don't have a PostgreSQL user
named "Steve" yet.  What you need to do is create such a user.  To do
so you will need to change to the postgres user.  Since the postgres
user probably doesn't have a password (for security reasons) this is a
two step process.

1. Change to the root user using the `su' command:

su

(you will need to type in the root password).

2. Change to the postgres user using the su command again.  I usually
   do this by typing:

su - postgres

You can read the su man page by typing `man su' to see why it is that
I called it that way.

Once you are logged in as the postgres user you should be able to run
all of the createdb and createuser commands that you want.

> This sounds to me like postmaster is running. But what do I know?
>
> The tutorial says to try the command with the absolute path:
>
>       /usr/local/pgsql/bin/createdb mydb
>
> I get the error:
>
>       No such file or directory
>
> No surprise there. I already saw that I couldn't find a /usr/local/pgsql
>
> Steve

Yes, PostgreSQL isn't installed in that directory.  Try typing:

which createdb

this should show you where createdb is actually installed.  You also
might want to play with the `locate' command.

Good Luck,

Jason

pgsql-novice by date:

Previous
From: "Devinder K Rajput"
Date:
Subject: Re: Getting Started newbie questions)
Next
From: Ron Peck
Date:
Subject: Re: Getting Started newbie questions)