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:
[[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 http://download.fedora.redhat.com/pub/epel/5/x86_64/uuid-1.5.1-3.el5.x86_64.rpm [[email protected] ~]$ 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:
[[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
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
[[email protected] ~]$ 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 [[email protected] ~]$
And PostgreSQL is installed. In part 2, I’ll configure the database.