Sunday, April 7, 2013

PostgreSQL update on Debian Linux

PostgreSQL 9.2.4 was released recently. I thought that it was time to update it to apply a security fix. I downloaded the source here: http://www.postgresql.org/ftp/source/

I typed:

userName@debianMachine:~$ su
Password:
root@debianMachine:/path/To/File# tar jxf postgresql-9.2.4.tar.bz2
root@debianMachine:/path/To/File# cd postgresql-9.2.4
root@debianMachine:/path/To/File/postgresql-9.2.4# ls
aclocal.m4  configure      contrib    doc         HISTORY  Makefile    src
config        configure.in  COPYRIGHT  GNUmakefile.in  INSTALL  README

root@debianMachine:/path/To/File/postgresql-9.2.4# ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking which template to use... linux
checking whether to build with 64-bit integer date/time support... yes
checking whether NLS is wanted... no
checking for default port number... 5432
checking for block size... 8kB
checking for segment size... 1GB
checking for WAL block size... 8kB
checking for WAL segment size... 16MB
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
...
config.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking src/backend/port/unix_latch.c to src/backend/port/pg_latch.c
config.status: linking src/backend/port/dynloader/linux.h to src/include/dynloader.h
config.status: linking src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port
root@debianMachine:/path/To/File/postgresql-9.2.4# make
make -C src all
make[1]: Entering directory `/path/To/File/postgresql-9.2.4/src'
make -C port all
make[2]: Entering directory `/path/To/File/postgresql-9.2.4/src/port'
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -I../../src/port -DFRONTEND -I../../src/include -D_GNU_SOURCE   -c -o fls.o fls.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -I../../src/port -DFRONTEND -I../../src/include -D_GNU_SOURCE   -c -o strlcat.o strlcat.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -I../../src/port -DFRONTEND -I../../src/include -D_GNU_SOURCE   -c -o strlcpy.o strlcpy.c
...
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/path/To/File/postgresql-9.2.4/config'
All of PostgreSQL successfully made. Ready to install.
root@debianMachine:/path/To/File/postgresql-9.2.4# checkinstall

checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.


The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs?  [y]: y

Preparing package documentation...OK

Please write a description for the package.
End your description with an empty line or EOF.
>> postgresql-9.2.4.tar.bz2
>>

*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values:

0 -  Maintainer: [ root@debianMachine ]
1 -  Summary: [ postgresql-9.2.4.tar.bz2 ]
2 -  Name:    [ postgresql ]
3 -  Version: [ 9.2.4 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ postgresql-9.2.4 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ postgresql ]
12 - Conflicts: [  ]
13 - Replaces: [  ]

Enter a number to change any of them or press ENTER to continue: 2
Enter new name:
>> postgresql-9.2.4.tar.bz2

This package will be built according to these values:

0 -  Maintainer: [ root@debianMachine ]
1 -  Summary: [ postgresql-9.2.4.tar.bz2 ]
2 -  Name:    [ postgresql-9.2.4.tar.bz2 ]
3 -  Version: [ 9.2.4 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ postgresql-9.2.4 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ postgresql ]
12 - Conflicts: [  ]
13 - Replaces: [  ]

Enter a number to change any of them or press ENTER to continue:

Installing with make install...

========================= Installation results ===========================
make -C src install
make[1]: Entering directory `/path/To/File/postgresql-9.2.4/src'
make -C port install
make[2]: Entering directory `/path/To/File/postgresql-9.2.4/src/port'
make -C ../backend submake-errcodes
make[3]: Entering directory `/path/To/File/postgresql-9.2.4/src/backend'
make[3]: Nothing to be done for `submake-errcodes'.
make[3]: Leaving directory `/path/To/File/postgresql-9.2.4/src/backend'
/bin/mkdir -p '/usr/local/pgsql/lib'
/bin/sh ../../config/install-sh -c -m 644  libpgport.a '/usr/local/pgsql/lib/libpgport.a'
make[2]: Leaving directory `/path/To/File/postgresql-9.2.4/src/port'
make -C timezone install
make[2]: Entering directory `/path/To/File/postgresql-9.2.4/src/timezone'
make -C ../../src/port all
...
/bin/sh ../config/install-sh -c -m 644 Makefile.global '/usr/local/pgsql/lib/pgxs/src/Makefile.global'
/bin/sh ../config/install-sh -c -m 644 Makefile.port '/usr/local/pgsql/lib/pgxs/src/Makefile.port'
/bin/sh ../config/install-sh -c -m 644 ./Makefile.shlib '/usr/local/pgsql/lib/pgxs/src/Makefile.shlib'
/bin/sh ../config/install-sh -c -m 644 ./nls-global.mk '/usr/local/pgsql/lib/pgxs/src/nls-global.mk'
make[1]: Leaving directory `/path/To/File/postgresql-9.2.4/src'
make -C config install
make[1]: Entering directory `/path/To/File/postgresql-9.2.4/config'
/bin/mkdir -p '/usr/local/pgsql/lib/pgxs/config'
/bin/sh ../config/install-sh -c -m 755 ./install-sh '/usr/local/pgsql/lib/pgxs/config/install-sh'
make[1]: Leaving directory `/path/To/File/postgresql-9.2.4/config'
PostgreSQL installation complete.

======================== Installation successful ==========================

Copying documentation directory...
./
./README
./COPYRIGHT
./HISTORY
./INSTALL
./doc/
./doc/src/
./doc/src/Makefile
./doc/src/sgml/
./doc/src/sgml/generate_history.pl
./doc/src/sgml/xtypes.sgml
./doc/src/sgml/seg.sgml
./doc/src/sgml/start.sgml
./doc/src/sgml/docguide.sgml
./doc/src/sgml/pltcl.sgml
./doc/src/sgml/pgtrgm.sgml
./doc/src/sgml/man1/
...
./doc/src/sgml/man7/TABLE.7
./doc/src/sgml/man7/CREATE_SEQUENCE.7
./doc/src/sgml/man7/UPDATE.7
./doc/src/sgml/man7/CREATE_FOREIGN_TABLE.7
./doc/src/sgml/ltree.sgml
./doc/src/sgml/earthdistance.sgml
./doc/src/sgml/nls.sgml
./doc/bug.template
./doc/MISSING_FEATURES
./doc/KNOWN_BUGS
./doc/TODO
./doc/Makefile

Copying files to the temporary directory...OK

Stripping ELF binaries and libraries...OK

Compressing man pages...OK

Building file list...OK

Building Debian package...OK

Installing Debian package...OK

Erasing temporary files...OK

Deleting temp dir...OK


**********************************************************************

 Done. The new package has been installed and saved to

 /path/To/File/postgresql-9.2.4/postgresql-9.2.4.tar.bz2_9.2.4-1_i386.deb

 You can remove it from your system anytime using:

      dpkg -r postgresql-9.2.4.tar.bz2

**********************************************************************

root@debianMachine:/path/To/File/postgresql-9.2.4# adduser postgres
adduser: The user `postgres' already exists.
root@debianMachine:/path/To/File/postgresql-9.2.4# mkdir /usr/local/pgsql/data
mkdir: cannot create directory `/usr/local/pgsql/data': File exists
root@debianMachine:/path/To/File/postgresql-9.2.4# ls -ld /usr/local/pgsql/data
drwx------ 14 postgres staff 4096 Oct 22 10:03 /usr/local/pgsql/data
root@debianMachine:/path/To/File/postgresql-9.2.4# su - postgres
postgres@debian:~$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

initdb: directory "/usr/local/pgsql/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/usr/local/pgsql/data" or run initdb
with an argument other than "/usr/local/pgsql/data".
postgres@debian:~$ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
[1] 12566
postgres@debian:~$ cat logfile
LOG:  database system was shut down at 2012-10-22 10:03:51 HKT
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
postgres@debian:~$ /usr/local/pgsql/bin/psql test
psql: FATAL:  database "test" does not exist
postgres@debian:~$ /usr/local/pgsql/bin/createdb test
postgres@debian:~$ /usr/local/pgsql/bin/psql test
psql (9.2.4)
Type "help" for help.

test=# \q
postgres@debian:~$ exit
logout
root@debianMachine:/path/To/File/postgresql-9.2.4#

That was okay. My update finished.

No comments:

RSS