My notes: Install postgresql 8.4.1 from tarball

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

Code:
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

Code:
$ cd ~/download
$ fetch [url]ftp://ftp.postgresql.org/pub/source/v8.4.1/postgresql-8.4.1.tar.gz[/url]
$ cd
$ tar zxvf ~/download/postgresql-8.4.1.tar.gz

Configure

Code:
$ 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

Code:
$ gmake
$ gmake install

The tarball installs files to directories
Some file locations are different from port version

Code:
/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
Code:
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

Code:
$ 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

Code:
$ 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

Code:
$ 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 )
 
zeissoctopus, if i were you, i would use /usr/local/pgsql-8.4.1 as the prefix. But maybe it just my preference/habit.
 
@zeissoctopus, i concur,
PostgreSQL, JBoss are the *only* packages i wouldn't build from ports.

At job, We have been running a production postgresql installation, since 7.3->8.3 (no 8.4 yet tho, although 8.4.1 in my new Fbsd-8.0-RELEASE box outperforms 8.3.1 on linux supermicro 16 CPUs, 64GB MEM) on FreeBSD/Debian/Suse for some 8 years now. Not a single crash or failure, all compiled by hand.

Data is too precious to leave it to automated procedures like portupgrade, etc...

On the other hand, if postgresql to some is a dummy DB engine seating behind (lets say) php, then be it, use ports.
 
I start the postgres with /usr/local/pgsql/bin/postmaster -S -B 326 -N 32 -i -D /usr/local/pgsql/data -o -F
and I need to increment the -B to 1024 or more and -N 32 to more for example:
/usr/local/pgsql/bin/postmaster -S -B 1024 -N 512 -i -D /usr/local/pgsql/data -o -F
but don't start
i have:
Code:
┌─(postgres@nw)(11:06:25)
└─(~)->ulimit -a
socket buffer size       (bytes, -b) unlimited
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) 33554432
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 4095
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 524288
cpu time               (seconds, -t) unlimited
max user processes              (-u) 4024
virtual memory          (kbytes, -v) unlimited
swap size               (kbytes, -w) unlimited
and

Code:
┌─(root@nw)(11:51:28)
└─(~)->sysctl -a | grep shm
kern.ipc.shm_allow_removed: 0
kern.ipc.shm_use_phys: 0
kern.ipc.shmall: 8192
kern.ipc.shmseg: 128
kern.ipc.shmmni: 192
kern.ipc.shmmin: 1
kern.ipc.shmmax: 67108864
kern.features.posix_shm: 1
same ideea to tune and make work how i need?
the postmaster dont make more than 32 conections, and I need to much more

thanks
 
Back
Top