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:

[[email protected] ~]$ sudo yum groupinstall 'Development Tools'

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

[[email protected] ~]$ sudo yum install readline-devel
[[email protected] ~]$ sudo yum install zlib-devel

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

[[email protected] ~]$ 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.)

[[email protected] ~]$ sudo rpm --install
[[email protected] ~]$ 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:

[[email protected] builds]$ tar xvfz postgresql-8.4.1.tar.gz
[[email protected] builds]$ cd postgresql-8.4.1
[[email protected] postgresql-8.4.1]$ ./configure --with-ossp-uuid --with-openssl
[[email protected] postgresql-8.4.1]$ make

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

[[email protected] postgresql-8.4.1]$ sudo make install

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

[[email protected] postgresql-8.4.1]$ cd contrib/uuid-ossp
[[email protected] uuid-ossp]$ make
[[email protected] 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:

[[email protected] ~]$ sudo sh
sh-3.2# cat >> /etc/
sh-3.2# /sbin/ldconfig
sh-3.2# exit
[[email protected] ~]$ 

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 […]