Re: - Mailing list pgsql-general
From | Mike Mascari |
---|---|
Subject | Re: |
Date | |
Msg-id | 392A426E.E5F834B9@mascari.com Whole thread Raw |
In response to | ("Janet" <janet@chinasystems-cn.com>) |
List | pgsql-general |
Janet wrote: > > Hello! > > I don't know if there is the right place to ask my question. If not, > please accept my apology. > > I'm totally new to Linux. And I have troubles using the PostgreSQL. > > I installed Redhat 6.0 and find there is postgresql already installed > on my computer. > Running the following command I get: > //////////////////////////////////////////////////// > $rpm -ql postgresql > /etc/rc.d/init.d/postgresql > /usr/bin/cleardbdir > /usr/bin/createdb > /usr/bin/createuser > /usr/bin/destroydb > /usr/bin/destroyuser > /usr/bin/initdb > /usr/bin/initlocation > /usr/bin/pg_passwd > /usr/bin/pg_version > /usr/bin/postgres > /usr/bin/postmaster > /usr/doc/postgresql-6.4.2 6.4 is particularly old. So I would do the following: 1. Become the root user: su 2. Uninstall the old packagaes: rpm -e postgresql rpm -e postgresql-clients rpm -e postgresql-devel 3. Ftp the new rpms from ftp.postgresql.org: ftp://ftp.postgresql.org/pub/binary/v7.0/redhat-RPM/RPMS/redhat-6.x/ At a minimum, you'll want to download: postgresql-7.0-2.i386.rpm -- this includes clients and shared code postgresql-devel-7.0-2.i386.rpm -- this is for development postgresql-server-7.0-2.i386.rpm -- this is the actual server 4. Install the rpms: rpm -i postgresql-7.0-2* 5. Start the server: cd /etc/rc.d/init.d ./postgresql start The newer RPMS, thanks to Lamar Owen, will *automatically* create the appropriate postgres user and group when installed, and initialize the database system for you the first time you start the server using the script above. Once the database starts, you can create users and a non-template database: 6. Become user postgres from root: su postgres 7. Connect to the template database: psql template1 bash$ psql template1 Welcome to psql, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit template1=# 8. Create a database user. Your normal unix account would be appropriate: template1=# CREATE USER mascarj CREATEDB; CREATE USER 9. Disconnect from the database as user postgres and reconnect as your normal unix account: template1=# \q bash$ exit exit [root@ferrari init.d]# exit exit [mascarj@ferrari init.d]$ 10. Reconnect to template1 using your normal unix account and create a database: [mascarj@ferrari mascarj]$ psql template1; Welcome to psql, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit template1=> CREATE DATABASE example; CREATE DATABASE template1=> You'll notice that the psql prompt is a '>' instead of a '#' to denote that you are not the postgres DBA user. 11. Disconnect from the template1 database and connect to the database you've just created: template1=> \q [mascarj@ferrari mascarj]$ psql example; Welcome to psql, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit example=> Now your ready to create tables, views, sequences and all that other good stuff. Hope that helps, Mike Mascari
pgsql-general by date: