The Build


WordPress to Django+PostgreSQL: Part 1, Installing PostgreSQL

16 October 2009

This is part 1 of my migration of my blog from WordPress to Django and PostgreSQL. I’m starting with a bare Centos 5.3 slice from Slicehost, and setting it up bit by bit.

In this part, I’m installing PostgreSQL. First, an idiosyncrasy warning: I very much prefer building PostgreSQL from source, even on package-based systems like Centos. I like the extra bit of control, and knowing just what is going into my binary.

I’ve already created a user account (‘xof’), as I much prefer to do everything through sudo (assuming root access is required) rather than logging in as root.

So, let’s get the development environment set up.

Step one, of course, is the base development tools group:

[xof@blog ~]$ sudo yum groupinstall 'Development Tools'

Some of the pieces that PostgreSQL needs to build aren’t in that group, so let’s install those.

[xof@blog ~]$ sudo yum install readline-devel
[xof@blog ~]$ sudo yum install zlib-devel

I’m planning to build PostgreSQL with OpenSSL support, so let’s install that as well:

[xof@blog ~]$ sudo yum install openssl-devel

In addition, I’m going to be building PostgreSQL with OSSP-UUID support, so we’ll need the packages for those. They’re not in the standard repository set, so we’ll need to find them elsewhere. (Many thanks to Devrim Gündüz for pointing me in the right place.)

[xof@blog ~]$ sudo rpm --install
[xof@blog ~]$ sudo rpm --install

And now we’re ready to build! I created a directory “builds” to hold source tarballs, and downloaded the PostgreSQL source from the appropriate place:

[xof@blog builds]$ tar xvfz postgresql-8.4.1.tar.gz
[xof@blog builds]$ cd postgresql-8.4.1
[xof@blog postgresql-8.4.1]$ ./configure --with-ossp-uuid --with-openssl
[xof@blog postgresql-8.4.1]$ make

And away it goes! The configure and make worked cleanly on the first try. So, time to install it:

[xof@blog postgresql-8.4.1]$ sudo make install

Since I’ll be using the uuid-ossp contrib module, I’ll build and install that now:

[xof@blog postgresql-8.4.1]$ cd contrib/uuid-ossp
[xof@blog uuid-ossp]$ make
[xof@blog uuid-ossp]$ sudo make install

For the convenience of building other things that might depend on the PostgreSQL library, I like to include the PostgreSQL libraries in ldconfig:

[xof@blog ~]$ sudo sh
sh-3.2# cat >> /etc/
sh-3.2# /sbin/ldconfig
sh-3.2# exit
[xof@blog ~]$ 

And PostgreSQL is installed. In part 2, I’ll configure the database.

WordPress to Django+PostgreSQL: Introduction at 12:27, 16 October 2009:

[…] Onwards to step 1: Installing PostgreSQL on the slice. […]

WordPress to Django+PostgreSQL: Part 2, Configuring PostgreSQL at 10:03, 17 October 2009:

[…] October 2009In part 1, we installed PostgreSQL on the VPS. In this part, it’s time to get the database server up […]