To install and run PostgreSQL in FreeBSD jail you’ll need to enable allow.sysvipc system tuneable on that specific jail:
-
List jails: jls
-
Note jail ID and use following command to enable it for that running jail: jail -m jid=JAILID allow.sysvipc=1
This can also be accomplished by changing ezjail jail configuration file /usr/local/etc/ezjail/JAILNAME, ensure it contains:
export jail_JAILNAME_parameters="allow.sysvipc=1"
Install appropriate version of PostgreSQL. There are many different versions but I’ll use 9.6. To install it use:
pkg install postgresql96-server
After install is finished enable it to start “at boot”:
sysrc postgresql_enable=YES
postgresql_enable: -> YES
Then initialize database:
service postgresql initdb
And finally, start the service:
service postgresql start
You sould now have running PostgreSQL within FreeBSD jail:
service postgresql status
pg_ctl: server is running (PID: 35208)
/usr/local/bin/postgres "-D" "/var/db/postgres/data96"