PDA

View Full Version : Howto: Installing PostgreSQL w/ phpPgAdmin



JakePoz
12-25-2004, 09:42 AM
I have succesfuly installed PostgreSQL 7.4.6 and phpPgAdmin on my hosting account with no problems.

1. Start up an SSH session, and change directories into /home/(username)

cd /home/(username
2. Download the PostgreSQL package

ftp://ftp3.us.postgresql.org/pub/postgresql/latest/postgresql-7.4.6.tar.gz
3. Extract the archive

untarzip postgresql-7.4.6.tar.gz
4. Change into the new directory

cd postgresql-7.4.6
5. (If you haven't already install the GNU compilation utilities in Site Manager)

6. Run the config script

./configure --prefix=/home/(username)
7. Compile

make
8. Install

make install
9. Now create your data directory

mkdir pgsql
mkdir pgsql/data

10. Set up the database system

/home/(username)/bin/initdb -D /home/(username)/pgsql/data
/home/(username)/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
/home/(username)/bin/createdb test
/home/(username)/bin/psql test

PostgreSQL is now running! Now we just need to install phpPgAdmin

1. Change into your default web directory

cd /var/www/html
2. Download the phppgAdmin files

wget http://voxel.dl.sourceforge.net/sourceforge/phppgadmin/phpPgAdmin-3.5.1.tar.gz
3. Extract them

untarzip phpPgAdmin-3.5.1.tar.gz
4. Rename the folder

mv phpPgAdmin-3.5.1 phpPgAdmin

You can now log into phpPgAdmin at http://www.yourdomain.com/phpPgAdmin Your username and password are the same as the ones you use everywhere else.[/code]

JakePoz
12-25-2004, 10:15 AM
I forgot to mention how you start/stop/restart the server.

To stop the server

/home/(username)/bin/pg_ctl stop -D /home/(username)/pgsql/data

To start the server

/home/(username)/bin/pg_ctl start -D /home/(username)/pgsql/data

To restart the server

/home/(username)/bin/pg_ctl restart -D /home/(username)/pgsql/data

wildjokerdesign
12-25-2004, 10:54 AM
Thanks for posting JakePoz! Sounds as if it was pretty painless. :)

<mark />
12-29-2004, 01:12 AM
Anyone else getting errors when they run make? Specifically I get this error:

Gen_fmgrtab.sh: sort: command not found
Gen_fmgrtab.sh failed

and then it exits. Any suggestions?

jalal
12-29-2004, 02:38 AM
The 'sort' command is not installed on Westhost. I guess JakePoz had it from somewhere.
It's in the wh-utils package from my site if you don't find it elsewhere.
ftp.gnomedia.com

<mark />
12-30-2004, 01:23 AM
I got it working. Thanks for your help.

P.S.

/home/&#40;username&#41;/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&amp;1 &amp; didn't work for me--I got errors.

/home/&#40;username&#41;/bin/pg_ctl -D /home/&#40;username&#41;/pgsql/data -l logfile start seemed to work, however.

JakePoz
12-31-2004, 05:07 PM
I am glad you got it working, not sure why that first command didn't work though.

Tom Howard
01-10-2005, 04:18 PM
First of all, thanks again to JakePoz for this post!


I'm guessing that the average WH user doesn't have readline installed, so an alternative step 6:

./configure --prefix=/home/&#40;username&#41; --without-readline

A minor addition (for clarity) to step 8:

cd /home/&#40;username&#41;/
mkdir pgsql
mkdir pgsql/data

jbsarma
08-16-2005, 03:00 AM
I have succesfully installed postgresql with phpPgAdmin. But I needed to add PL/pgSQL (a procedural language) in my database for wich I need to run 'createlang' command. But I get the response 'command not found'. I beleive this is due to the VPS not having sh-utils installed or may be other similar utility. I need PL/pgSQL to be able to install mysourcematrix CMS.

Does anybody come across with this issue and know how to resolve it. The Westhost technical suppot cannot do it (they will only do against fee which cost $80/per hour and 1 hour payment is minimum).

rcrodgers
02-25-2006, 05:50 PM
Having just set up my account with WestHost, I thought I would download and install the latest version of PostgreSQL. I should note that the basic instructions in this thread are good, but you can also get away with doing just ./configure && make && make install.

BUT! You should also be aware that at least with WestHost's New Year's Special VPS system, PostgreSQL 8.0.3 apparently is already installed! I found that out after getting 8.1.3 installed, and struggling to get initdb working. So if you're going to use a version other than 8.0.3, you will need to use the complete path to your PostgreSQL binaries!

Just passing along a tip...
Raymond

Innerdvations
03-03-2007, 12:15 AM
I tried installing 8.2.3, but when I run make, I'm eventually met with the error:
"Parse error in VERSION script"

I actually couldn't even find a VERSION file anywhere. Does anyone know what could be going wrong with that?

I just went ahead and got 8.0.11 installed, and may slowly work my way up through other versions tomorrow and see how high I can get...

EDIT: Ok, another problem I discovered a few days later was that postgres wouldn't start up when the VPS restarted. For some reason, the permissions on the startup script /etc/rc.d/init.d/pgsql had to be changed. Try chmod on that file if you're having problems.

crazyDBA
09-12-2007, 03:40 PM
I tried installing 8.2.3, but when I run make, I'm eventually met with the error:
"Parse error in VERSION script"

I actually couldn't even find a VERSION file anywhere. Does anyone know what could be going wrong with that?

I just went ahead and got 8.0.11 installed, and may slowly work my way up through other versions tomorrow and see how high I can get...

EDIT: Ok, another problem I discovered a few days later was that postgres wouldn't start up when the VPS restarted. For some reason, the permissions on the startup script /etc/rc.d/init.d/pgsql had to be changed. Try chmod on that file if you're having problems.

Hi, I encountered the same problem today and luckily found the solution.

Check this page: http://www.talkaboutdatabases.com/group/pgsql.general/messages/40888.html

I didn't get a chance to check if it is the os / compiler issue, but, it works!

Installed 8.2.4 on WestHost VPS using with php5.1
1. get postgresql source
2. untar the source to a selected working directory
3. cd to the directory, e.g. cd /postgresql-8.2.4
4. follow the instruction in the link above and comment out the section Tom Lane indicated
5. configure && make && make install
6. done installation

Complete the rest of installation instructed in http://www.postgresql.org/docs/8.2/interactive/install-short.html. Postgresql database should be ready to go.

good luck

futurity
02-15-2008, 09:49 AM
Just installed version 8.3.0 without a hitch. Very nice.

I'm up to the step of creating/initializing the cluster, but the documentation recommends creating a postgresql account (http://www.postgresql.org/docs/8.3/interactive/postgres-user.html). If I understand the reasoning correctly, if the account gets cracked through the database, this will "limit" damage to the database and prevent access to other areas of the site.

It doesn't look like the shell offers the 'adduser' or 'useradd' commands, so does anyone know an easy way to this? I don't think I want to do this through the control panel, because I don't want to enable email or ftp. Or am I just being overly paranoid?

wildjokerdesign
02-15-2008, 01:22 PM
You might be able to create a User via the Site Manager that does not have email or FTP enabled but have never tried it. I am also not sure that it would really be the type of user you need. We really only have one "true" user with our VPS and that is your main user for the account. That is why we don't have access to to the two commands you mentioned.

Now I do know that with MySQL we have the abilty to create users that have access only to specific databases and tables and that can be done via phpMyAdmin quite easily.

epicheirimatias
08-06-2008, 10:29 PM
Just how you guys download and install things directly on SSH? I couldn't even find the FTP link to the postgresql file. The only option is to download it once to my computer, and upload it again to my server.

And is there any way to use copied text and paste the lines with SSH tools like Putty? I really wish I could just copy paste the commands listed here, rather than typing the whole long URLs, etc.

epicheirimatias
08-06-2008, 11:19 PM
wow! didn't know right-click would past what I've copied!! That's cool!

btw, by default, phpPgAdmin directory is NOT password protected...

wildjokerdesign
08-07-2008, 07:39 AM
Just how you guys download and install things directly on SSH?

The command:

wget
followed by a url of the download you want. This would download it to the directory that you are in when you run the command.