Skip to content

Instantly share code, notes, and snippets.

@ponkore
Created February 25, 2014 01:53
Show Gist options
  • Save ponkore/9201144 to your computer and use it in GitHub Desktop.
Save ponkore/9201144 to your computer and use it in GitHub Desktop.
postgis install memo (FreeBSD pkg)
$ sudo pkg install postgis
Updating repository catalogue
The following 6 packages will be installed:
Installing proj: 4.8.0_2
Installing geos: 3.4.2
Installing json-c: 0.11
Installing postgresql90-client: 9.0.15
Installing postgresql90-server: 9.0.15
Installing postgis: 2.1.0_1
The installation will require 48 MB more space
9 MB to be downloaded
Proceed with installing packages [y/N]: y
proj-4.8.0_2.txz 100% 2239KB 559.6KB/s 1.2MB/s 00:04
geos-3.4.2.txz 100% 1065KB 1.0MB/s 1.0MB/s 00:01
json-c-0.11.txz 100% 39KB 38.7KB/s 38.7KB/s 00:00
postgresql90-client-9.0.15.txz 100% 1776KB 443.9KB/s 885.6KB/s 00:04
postgresql90-server-9.0.15.txz 100% 2911KB 727.7KB/s 1.4MB/s 00:04
postgis-2.1.0_1.txz 100% 733KB 733.4KB/s 733.4KB/s 00:00
Checking integrity... done
[1/6] Installing proj-4.8.0_2... done
[2/6] Installing geos-3.4.2... done
[3/6] Installing json-c-0.11... done
[4/6] Installing postgresql90-client-9.0.15... done
[5/6] Installing postgresql90-server-9.0.15...===> Creating users and/or groups.
Using existing group 'pgsql'.
Using existing user 'pgsql'.
=========== BACKUP YOUR DATA! =============
As always, backup your data before
upgrading. If the upgrade leads to a higher
minor revision (e.g. 8.3.x -> 8.4), a dump
and restore of all databases is
required. This is *NOT* done by the port!
Press ctrl-C *now* if you need to pg_dump.
===========================================
done
[6/6] Installing postgis-2.1.0_1...
======================= GEOS Support Notice ========================
In order to use the GEOS support, you may need to specially compile
your version of PostgreSQL to link the C++ runtime library.
To do this, invoke the PostgreSQL Makefile script this way:
on csh shell:
setenv LDFLAGS -lstdc++
make
on sh or bash shell:
export LDFLAGS=-lstdc++
make
The initial LDFLAGS variable is passed through to the Makefile and
adds the C++ library to the linking stage.
====================================================================
done
The PostgreSQL port has a collection of "side orders":
postgresql-docs
For all of the html documentation
p5-Pg
A perl5 API for client access to PostgreSQL databases.
postgresql-tcltk
If you want tcl/tk client support.
postgresql-jdbc
For Java JDBC support.
postgresql-odbc
For client access from unix applications using ODBC as access
method. Not needed to access unix PostgreSQL servers from Win32
using ODBC. See below.
ruby-postgres, py-PyGreSQL
For client access to PostgreSQL databases using the ruby & python
languages.
postgresql-plperl, postgresql-pltcl & postgresql-plruby
For using perl5, tcl & ruby as procedural languages.
postgresql-contrib
Lots of contributed utilities, postgresql functions and
datatypes. There you find pg_standby, pgcrypto and many other cool
things.
etc...
For procedural languages and postgresql functions, please note that
you might have to update them when updating the server.
If you have many tables and many clients running, consider raising
kern.maxfiles using sysctl(8), or reconfigure your kernel
appropriately.
The port is set up to use autovacuum for new databases, but you might
also want to vacuum and perhaps backup your database regularly. There
is a periodic script, /usr/local/etc/periodic/daily/502.pgsql, that
you may find useful. You can use it to backup and perfom vacuum on all
databases nightly. Per default, it perfoms `vacuum analyze'. See the
script for instructions. For autovacuum settings, please review
~pgsql/data/postgresql.conf.
To allow many simultaneous connections to your PostgreSQL server, you
should raise the SystemV shared memory limits in your kernel. Here are
example values for allowing up to 180 clients (configurations in
postgresql.conf also needed, of course):
options SYSVSHM
options SYSVSEM
options SYSVMSG
options SHMMAXPGS=65536
options SEMMNI=40
options SEMMNS=240
options SEMUME=40
options SEMMNU=120
If you plan to access your PostgreSQL server using ODBC, please
consider running the SQL script /usr/local/share/postgresql/odbc.sql
to get the functions required for ODBC compliance.
Please note that if you use the rc script,
/usr/local/etc/rc.d/postgresql, to initialize the database, unicode
(UTF-8) will be used to store character data by default. Set
postgresql_initdb_flags or use login.conf settings described below to
alter this behaviour. See the start rc script for more info.
To set limits, environment stuff like locale and collation and other
things, you can set up a class in /etc/login.conf before initializing
the database. Add something similar to this to /etc/login.conf:
---
postgres:\
:lang=en_US.UTF-8:\
:setenv=LC_COLLATE=C:\
:tc=default:
---
and run `cap_mkdb /etc/login.conf'.
Then add 'postgresql_class="postgres"' to /etc/rc.conf.
======================================================================
To initialize the database, run
/usr/local/etc/rc.d/postgresql initdb
You can then start PostgreSQL by running:
/usr/local/etc/rc.d/postgresql start
For postmaster settings, see ~pgsql/data/postgresql.conf
NB. FreeBSD's PostgreSQL port logs to syslog by default
See ~pgsql/data/postgresql.conf for more info
======================================================================
To run PostgreSQL at startup, add
'postgresql_enable="YES"' to /etc/rc.conf
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment