Thread: help

help

From
Sonika Malhotra
Date:
please help in starting the postmaster and keeping it in the same state
always ..ie started , i'm a beginner, i tried
pg_ctl,postmaster,postgres...
my database is kept in a dir where permission is denied to the user ,
and if i login as the superuser, it doesn't recognize above commands..


Re: help

From
Gunnar Lindholm
Date:
> please help in starting the postmaster and keeping it in the same state
> always ..ie started , i'm a beginner, i tried
> pg_ctl,postmaster,postgres...
Read the INSTALL file with the source, it should tell you alot.

> my database is kept in a dir where permission is denied to the user ,
Which user is not denied?

> and if i login as the superuser, it doesn't recognize above commands..
This might be because you have not included the binaries in your PATH?
Which superuser, by the way?

Best wishes
Gunnar.

Re: help

From
nataraj
Date:
Hi,
I don't know if it's too late to answer this question, but anyway.
Please see the attached text file. In step 11 it tells you how to create
the symbolic link that starts up postgres database server when the system
boots up.

Hope it helps.
Nataraj

Sonika Malhotra wrote:

> please help in starting the postmaster and keeping it in the same state
> always ..ie started , i'm a beginner, i tried
> pg_ctl,postmaster,postgres...
> my database is kept in a dir where permission is denied to the user ,
> and if i login as the superuser, it doesn't recognize above commands..
###############################################################################
#    postgresInstallationInstructions.txt
#    This document was prepared for Installing Postgres on RedhatLinux 6.2
#    Make changes according to the unix, Linux versions you are using.
###############################################################################
Postgres Installation Instructions

1.  Create postgres user account (if it is already not created) by
    editing the password file or using an admin tool. Make the home
    directory for the postgres user "/usr/local/pgsql". Create a
    ".bash_profile" (or ".cshrc" or ".profile" depending on the shell)
    in the /usr/local/pgsql directory. Make sure the following variables
    are set in the start-up file:

    PATH=$PATH:/usr/local/pgsql/bin
    PGLIB=/usr/local/pgsql/lib
    PGDATA=/usr/local/pgsql/data

2. (a) Download Postgress Latest version from www.postgresql.org.
       Follow the 'Software' link to the download page. Download
       the full archive: postgresql.versionNumber.tar.gz
        Example:postgresql.7.0.2.tar.gz
   (b) Untar "postgresql.versionNumber.tar.gz":
       gunzip postgresql.versionNumber.tar.gz
       tar -xvf postgresql.versionNumber.tar

3. (a) The untar creates default directories.
       Change directory: cd postgresql.versionNumber
   (b) Read the 'INSTALL' file for step-by-step instructions for building
       and installing Postgres.

4. (a) Change Directory: cd src.
   (b) Configure the Postgres source code which involves running the
       configure script.
          Syntax: ./configure argument1 argument2 etc.,
            To get help, type: ./configure -- help.
            To run without arguments, type: ./configure .
                This option creates a default configuration.
        use default  : "./configure" for a simple configuration.
         Configure script creates Makefiles, config.h etc.,
   (c) Run make utility to compile postgres. Make sure GNU Make is used to
       build the souce. On Linux systems, the default make is GNU make.
       May need to install or specify GNU make (gmake) on other UNIX
       platforms.

5. If you want to run regression tests, change directory: cd test/regress.
   Log in as the postgres user and run 'make runcheck'. See the README
   file in this directory for more information.

6. (a) Change user to root using the command su root.
   (b) Type password for root.
   (c) Run the command: 'make install' in the Postgres 'src' directory.

7. The path for the Postgres shared libraries should be added to the system
   path so that the programs know where to find them. Edit the /etc/ld.so.conf
   file and add the line: "/usr/local/pgsql/lib". Run ldconfig command as
   'root' to rebuild the shared libraries search paths. (The shared library
   configuration may be different on other Unix systems.)

8. Initialize the Postgres data directory using the following commands.
    i.   cd /usr/local/pgsql.
    ii.  mkdir data.
        Create a directory "data" where databases will be created.
     iii. Change ownership to posgres superuser:
           chown postgres data.
    iv.  Change permisions to be writable only by postgres superuser:
            chmod 700 data

9. Switch user to postgres superuser using 'su - postgres'.

   Run the command: usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
   This command will set up the initial database and config files in the
   "/usr/local/pgsql/data" directory.

10. To start the Postgres server, su to the Postgres user and run the command:
    /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data

11. Set up a script to automatically start Postgres when system boots up.
    The Postgres "INSTALL" file gives examples of how to do this for various
    Unix systems. There is also sample Linux postgres.init file in the
    postgresql-VersionNumber/support/linux directory.
    The file "postgres.init.sh" some times may not be in the specified
    directory. So, run the command "find / -name postgres.init.sh" and
    use that path in step 11(a).
       (a) Copy the support/linux/postgres.init.sh to /etc/rc.d/init.d/postgres
       (b) Edit the file and change the "PGOPTS" variable to:
        PGOPTS="-i -D /usr/local/pgsql/data"
       (c) Create symbolic link named
    /etc/rc.d/rc3.d/S98postgres.init to the /etc/rc.d/init.d/postgres file:
    ln -s /etc/rc.d/init.d/postgres /etc/rc.d/rc3.d/S98postgres.init
    NOTE: (1) Make sure to use "S" not "s"
          (2) Step 11(c) may differ for different falvors of unix, linux.
          This was used in RedHat Linux 6.2

12.  (a) Stopping Postgres Server
     i.  Change user to root using the command:
        su root.
     ii. Run the command "/etc/rc.d/init.d/postgres stop" to stop
         the Postgres server
     (b) Starting Postgres Server
     i.  Change user to root using the command:
        su root.
     ii. Run the command "/etc/rc.d/init.d/postgres start" to
             start the Postgres server
     (c) psql is equivalent to sqlplus command. Use it to run queries.

13. Create a database user if it is not already there for the database you are
    going to create.
     (a) Log in as the postgres super-user
     (a) Type the command: /usr/local/pgsql/bin/createuser dbUserName, hit
     enter.
     (c) Is this user allowed to create databases?: Y/N - "N" if you don't
         want the user to create databases.

     (d) Is this user allowed to create users?:  Y/N - "N" if you don't
         want the user to create users.