LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 08-13-2004, 05:18 AM   #1
dublinclontarf
Member
 
Registered: Jan 2004
Location: dublin ireland
Distribution: Ubuntu PPC
Posts: 39

Rep: Reputation: 15
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?
 
Old 08-13-2004, 06:03 AM   #2
Mephisto
Member
 
Registered: Oct 2002
Location: Washington D.C, USA
Distribution: Slack 12, Etch, Gutsy
Posts: 453

Rep: Reputation: 30
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
 
Old 08-13-2004, 06:09 AM   #3
Mephisto
Member
 
Registered: Oct 2002
Location: Washington D.C, USA
Distribution: Slack 12, Etch, Gutsy
Posts: 453

Rep: Reputation: 30
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
 
Old 08-13-2004, 11:25 AM   #4
dublinclontarf
Member
 
Registered: Jan 2004
Location: dublin ireland
Distribution: Ubuntu PPC
Posts: 39

Original Poster
Rep: Reputation: 15
well i coulnt get it working with the slackware tgz file so i went to the source
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.
 
Old 08-13-2004, 11:34 AM   #5
Mephisto
Member
 
Registered: Oct 2002
Location: Washington D.C, USA
Distribution: Slack 12, Etch, Gutsy
Posts: 453

Rep: Reputation: 30
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.
 
Old 08-13-2004, 12:01 PM   #6
dublinclontarf
Member
 
Registered: Jan 2004
Location: dublin ireland
Distribution: Ubuntu PPC
Posts: 39

Original Poster
Rep: Reputation: 15
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."
 
Old 08-13-2004, 12:04 PM   #7
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use PostgreSQL on slackware (10.1) tuamtium Linux - Newbie 1 08-14-2005 01:46 AM
postgresql-7.4 no workie in slackware 9.1 digital bots Linux - Software 6 06-11-2004 08:22 AM
Slackware Postgresql and PHP squirreldogger Slackware 2 11-21-2003 05:19 PM
slackware 9.0 -- no postgresql... alixx Slackware 1 07-12-2003 12:12 PM
postgresql -odbc & postgresql-jdbc installation kjsubbu Linux - Software 0 06-19-2003 02:50 AM


All times are GMT -5. The time now is 06:28 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration