Installing PostgreSQL on coLinux[]

Getting PostgreSQL to run in coLinux is a lot easier than I thought. I will write below the full syntax I had to write to get PostgreSQL up and running.

Before you are ready to go you have to configure your coLinux and the linux on it. That includes configuring the network conneciton and the DNS lookup (meaning you can ping Best way to do it is to read GettingStartedLong and coLinuxNetworking.

I used the *Debian* distribution and as a Linux newbie I really don't know if it will work on any other. Here we go:

apt-get -y update
apt-get -y install gcc
apt-get -y install ftp
apt-get -y install make
apt-get -y install libedit-dev
apt-get -y install libperl-dev
apt-get -y install python-dev
apt-get -y install tcl8.3-dev
apt-get -y install tk8.3-dev
apt-get -y install zlib1g
apt-get -y install zlib1
apt-get -y install zlib1g-dev

ln -s /usr/bin/make /usr/bin/gmake

Now when you have FTP download a source of the latest PostgreSQL version, I downloaded the latest today, 7.4.2. Here's a link to the download page. After you download it, you're free to proceed:

gunzip postgresql-7.4.2.tar.gz
tar xf postgresql-7.4.2.tar

cd postgresql-7.4.2
gmake install
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

Now you should have a working PostgreSQL.

(added by Jurgen Defurne 2005-08-11) Wouldn't it have been easier to do

apt-get -y postgresql

since you are using Debian anyway ?


Here are the problems that happened to me, they might not happen to you, or anybody at all:

  • plsql acts very strangely in coLinux after the postmaster is running. First time it ran perfectly but after that I just couldn't execute it at all, it kept complaining about memory allocation :(. It isn't a big problem however, since you'll be working mostly from Windows, using some kind of PostgreSQL gui. You can even run a native win32 psql from windows and connect from there to your coLinux PostgreSQL.
  • Don't just close the coLinux console box, *shutdown -h now* properly before you close your computer. If you do, PostgreSQL will refuse to go up next time and you'll have to shutdown Co Linux especially just to free PostgrSQL files.(added by MattNuzum 2004-06-01: You can probably delete /var/lib/pgsql/data/ and restart postgres just fine after an unclean shutdown.)


PostgreSQL's homepage:

Win32 psql project:

MassTranslated on 25 Dec 2004.

MassTranslated on Sun Apr 23 17:36:41 UTC 2006