zeissoctopus
November 22nd, 2009, 11:19
The postgresql84-server maintainer is not active recently.
I want to use PostgreSQL 8.4.1 so that I try to install it
from offical tarball.
I am a beginner level of FreeBSD. I have not any kownledge to
contribute to postgresql84-server port. I use postgresql in
my website cms in a freebsd jail. I start to learn postgreSQL
for personal use, too. Hence, I create one more freebsd jail to
install 2nd copy of PostgreSQL. After reading online doc of
postgresql, I think I could install it from tarball.
Create jail for 2nd copy postgresql
===================================
Read FreeBSD Handbook chapter 15
http://www.freebsd.org/doc/en/books/handbook/jails.html
Install require port before compiling postgreSQL
in the new jail
portaudit-0.5.14 (for own use , not for postgresql)
portmaster-2.12 (for own use , not for postgresql)
gmake-3.81_3
gettext-0.17_1
libiconv-1.13.1
libtool-2.2.6a_1
perl-threaded-5.10.1
libxml2-2.7.6
libxslt-1.1.26
Get the tarball
$ cd ~/download
$ fetch ftp://ftp.postgresql.org/pub/source/v8.4.1/postgresql-8.4.1.tar.gz
$ cd
$ tar zxvf ~/download/postgresql-8.4.1.tar.gz
Configure
$ cd postgresql-src
$ ./configure \
--prefix=/usr/local \
--bindir=/usr/local/bin \
--sysconfdir=/usr/local/etc \
--libdir=/usr/local/lib/postgresql \
--enable-nls \
--with-perl \
--with-openssl \
--with-libxml \
--with-libxslt \
--with-segsize=4 \
--enable-thread-safety \
--with-system-tzdata=/usr/share/zoneinfo \
CFLAGS='-O2 -pipe'
Compile and install
$ gmake
$ gmake install
The tarball installs files to directories
Some file locations are different from port version
/usr/local/share/doc/postgresql
/usr/local/share/man
/usr/local/share/locale
/usr/local/lib/postgresql
/usr/local/share/postgresql/timezonesets
/usr/local/include/libpq
/usr/local/include
/usr/local/include/postgresql
/usr/local/bin
Create a user for postgresql daemon.
According to http://wiki.freebsd.org/Jails#head-3aa93fc3135c717c33437e7e13515fb802bbebbd
multiple postgresql servers in multiple jails, please use different uid in each jail, so I
user name=postgres (diff from port)
group name=postgres (diff from port)
uid=170 (diff from port)
gid=170 (diff from port)
home=/usr/local/postgres
$ su root
# mkdir /usr/local/postgres
# vi /etc/group (add postgres:*:170)
# adduser (name:postgres, group:postgres uid:170 home:/usr/local/postgres, shell:/bin/sh)
Creating a Postgres Database Cluster
$ su root
# mkdir /usr/local/postgres/data
# chown postgres /usr/local/postgres/data
# su postgres
postgres$ initdb -D /usr/local/postgres/data -E utf8
The startup script
$ su root
# cp postgresql-src/contrib/start-scripts/freebsd /usr/local/etc/rc.d/postgresql
# vi /usr/local/etc/rc.d/postgresql ( following the inside instructions to modify some parameters )
# chmod 555 /usr/local/etc/rc.d/postgresql
# vi /etc/rc.local ( add line /usr/local/etc/rc.d/postgresql start )
I want to use PostgreSQL 8.4.1 so that I try to install it
from offical tarball.
I am a beginner level of FreeBSD. I have not any kownledge to
contribute to postgresql84-server port. I use postgresql in
my website cms in a freebsd jail. I start to learn postgreSQL
for personal use, too. Hence, I create one more freebsd jail to
install 2nd copy of PostgreSQL. After reading online doc of
postgresql, I think I could install it from tarball.
Create jail for 2nd copy postgresql
===================================
Read FreeBSD Handbook chapter 15
http://www.freebsd.org/doc/en/books/handbook/jails.html
Install require port before compiling postgreSQL
in the new jail
portaudit-0.5.14 (for own use , not for postgresql)
portmaster-2.12 (for own use , not for postgresql)
gmake-3.81_3
gettext-0.17_1
libiconv-1.13.1
libtool-2.2.6a_1
perl-threaded-5.10.1
libxml2-2.7.6
libxslt-1.1.26
Get the tarball
$ cd ~/download
$ fetch ftp://ftp.postgresql.org/pub/source/v8.4.1/postgresql-8.4.1.tar.gz
$ cd
$ tar zxvf ~/download/postgresql-8.4.1.tar.gz
Configure
$ cd postgresql-src
$ ./configure \
--prefix=/usr/local \
--bindir=/usr/local/bin \
--sysconfdir=/usr/local/etc \
--libdir=/usr/local/lib/postgresql \
--enable-nls \
--with-perl \
--with-openssl \
--with-libxml \
--with-libxslt \
--with-segsize=4 \
--enable-thread-safety \
--with-system-tzdata=/usr/share/zoneinfo \
CFLAGS='-O2 -pipe'
Compile and install
$ gmake
$ gmake install
The tarball installs files to directories
Some file locations are different from port version
/usr/local/share/doc/postgresql
/usr/local/share/man
/usr/local/share/locale
/usr/local/lib/postgresql
/usr/local/share/postgresql/timezonesets
/usr/local/include/libpq
/usr/local/include
/usr/local/include/postgresql
/usr/local/bin
Create a user for postgresql daemon.
According to http://wiki.freebsd.org/Jails#head-3aa93fc3135c717c33437e7e13515fb802bbebbd
multiple postgresql servers in multiple jails, please use different uid in each jail, so I
user name=postgres (diff from port)
group name=postgres (diff from port)
uid=170 (diff from port)
gid=170 (diff from port)
home=/usr/local/postgres
$ su root
# mkdir /usr/local/postgres
# vi /etc/group (add postgres:*:170)
# adduser (name:postgres, group:postgres uid:170 home:/usr/local/postgres, shell:/bin/sh)
Creating a Postgres Database Cluster
$ su root
# mkdir /usr/local/postgres/data
# chown postgres /usr/local/postgres/data
# su postgres
postgres$ initdb -D /usr/local/postgres/data -E utf8
The startup script
$ su root
# cp postgresql-src/contrib/start-scripts/freebsd /usr/local/etc/rc.d/postgresql
# vi /usr/local/etc/rc.d/postgresql ( following the inside instructions to modify some parameters )
# chmod 555 /usr/local/etc/rc.d/postgresql
# vi /etc/rc.local ( add line /usr/local/etc/rc.d/postgresql start )