16 October 2009
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 http://download.fedora.redhat.com/pub/epel/5/x86_64/uuid-1.5.1-3.el5.x86_64.rpm [xof@blog ~]$ sudo rpm --install http://download.fedora.redhat.com/pub/epel/5/x86_64/uuid-devel-1.5.1-3.el5.x86_64.rpm
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
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
[xof@blog ~]$ sudo sh sh-3.2# cat >> /etc/ld.so.conf.d/usr-local-pgsql-lib.conf /usr/local/pgsql/lib sh-3.2# /sbin/ldconfig sh-3.2# exit [xof@blog ~]$
And PostgreSQL is installed. In part 2, I’ll configure the database.