By Tom Adelstein.
If you want to use this database follow this procedure
Linux users have enjoyed a good relationship with the BSD
database PostgreSQL over the years. Unfortunately, if you use Red
Hat 5.2 you will discover a documentation discrepancy. The
documentation that comes with PostgreSQL and loads into the
director /usr/doc/postgresql 6.3.x in Red Hat and what you must do
to get it to work differ substantially.
Red Hat Linux 5.2 comes with version 6.3.x of PostgreSQL. During
installation, you will have the option of installing this database.
Also, after the applications have been installed on your hard
drive, you will be given the option of having PostgreSQL start at
boot time. Choose this option, because in order for PostgreSQL to
work, the daemon – postmaster – must run.
After your very first boot and before you start X, login as root
and type “linuxconf”, a menu will appear. Select the option for
‘user accounts’ and press enter. You select options in this utility
by highlighting them.
A screen will appear with user accounts listed. Most of these
accounts are daemon or service accounts such as ftp. You will see
the account ‘postgres’ which will be labeled the PostgreSQL
superuser account.
You need to do two things at this point, give the postgres user a
password and create just a regular user account which will manage
databases. You accomplish the first task by highlighting the
postgres account and pressing enter. The screen will change. Tab
over to the password button and press enter. You will be prompted
twice to enter the password. The first time to just type the
password in the form and the second to verify the password was
typed correctly. If you entered both correctly, then you will
return to the screen listing users.
Next, tab over to the ‘add user’ button. Press enter and add your
first regular user. Type in lower case an eight digit account name.
Then with your cursor key go to the next line and type the full
name of the user. Under type of user type ‘users’. Do not worry
about anything else just tab to accept. Now, as you did with the
postgres user, give the new user a password.
Once you have accepted these changes, you will select the quit
button and then the activate changes button and then you will quit
again and be back at the command line cursor.
At this point you will want to log out of the root account. Once
out, login as the new user and issue the command ‘ls -a’ and you
will see several files. The file .bash_profile needs to be changed.
Regardless of what the PostgreSQL documentation says, you need to
add text to the .bash_profile file. Using the vi editor, open the
file go into the edit mode and add to the end of the ‘PATH=’ line
‘:/var/lib/pgsql’. Don’t type the quotation marks. Now save the
edit by pressing escape two times, then shift colon (:) and w!
enter. Next, press the shift colon and enter q and the return or
enter key and you will be back at your prompt.
Log out of the user account and log into ‘postgres’. At the command
line prompt type ‘createuser’ (without the quotes). You will get a
prompt to enter the user name. Enter your user name and select the
defaults. When finished the user should have the rights to create a
database and give users access to the database.
Finally, logout by typing exit. Login as the user once again. Type
‘createdb’, again without the quotes, and you will see that you
have a database with your user’s name.
If you follow these instructions, you can then begin to use the SQL
statements in the postgresql tutorial. You can start creating
tables and embed commands in HTML and all the other good stuff.
Otherwise, spend days being frustrated and don’t get anything done.
You’ll also miss out on a Linux legend.