LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   postgresql on slackware 10 (https://www.linuxquestions.org/questions/slackware-14/postgresql-on-slackware-10-a-217067/)

dublinclontarf 08-13-2004 05:18 AM

postgresql on slackware 10
 
im running slackware 10 and installed the tgz package of postgresql that i got from linux packages.net
installed it using installpkg postgres*
when i try to create a database with the command "createdb mydatabase"
i get:

createdb: could not connect to database template1: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

how do i start up the database at boot time? or even without having to reboot?

Mephisto 08-13-2004 06:03 AM

You will probably need to make some adjustments but this is my postgre start script. Make a fie called rc.postgre in /etc/rc.d and add a call to "rc.postgre start" in your rc.local and "rc.postgre stop" in rc.K

One thing that will almost definitely be wrong for you is the log location. I made my own package but I am pretty sure I left everything else at the default locations.

Code:

#!/bin/sh
#
# /etc/rc.d/rc.postgres
#

case "$1" in
  'start')
      su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data -l /var/log/postgres/postgres -o '-i'" ;;
  'stop')
      su - postgres -c "/usr/local/pgsql/bin/pg_ctl stop -D /usr/local/pgsql/data" ;;
  'restart')
      su - postgres -c "/usr/local/pgsql/bin/pg_ctl restart -D /usr/local/pgsql/data" ;;
  *)
      echo "usage $0 start|stop|restart" ;;
esac


Mephisto 08-13-2004 06:09 AM

Note though that you do need to set up postgre before the script will work. Try reading the postgre manual for install instructions: It is possible the package from linuxpackages.net automated it but I doubt it. I would offer more precise advice but I don't know what you have done beyond installing the package.

Taken from the said manual at http://www.postgresql.org/docs/7.4/s...tallation.html
Quote:

adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

dublinclontarf 08-13-2004 11:25 AM

well i coulnt get it working with the slackware tgz file so i went to the source:p
got the latest postgresql.tar.gz unpackaged it.
then as a non root user cd into the directory, did a ./configure then a make.
didnt take long about 3 mins.
then su and then make install.
everything seemed to go smooth.
then still as root user.

mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
then this command which seemed to start the database.
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data

now to create databases i had to su postgres again from root, this is i suppose where you would add users and everything.

Mephisto 08-13-2004 11:34 AM

If I am following your statements correctly then yes. If you can open up a SQL command line for the server then you are good to go for the instllation and you can add users/dbs/tables.

dublinclontarf 08-13-2004 12:01 PM

thanks for the help.
just one more thing
how do i go about doing this? " add /usr/local/pgsql/bin to your PATH environment variable and /usr/local/pgsql/lib to your LD_LIBRARY_PATH environment variable."

Cedrik 08-13-2004 12:04 PM

add that to /etc/profile if you want it system wide or just in the ~/.bashrc of an user :

PATH="$PATH:/usr/local/pgsql/bin"
export PATH

and in /etc/ld.so.conf add :
/usr/local/pgsql/lib

and run ldconfig


All times are GMT -5. The time now is 02:41 AM.