Install PostgreSQL Jail + ports + theBrig
Posted: 03 Oct 2014 20:18
Wanted to share a quick HOWTO for getting postgresql working properly in a jail after encountering a problem with SystemV IPC, as similarly described here: https://dan.langille.org/2013/07/09/fat ... plemented/
Although the article refers to FreeBSD 8.x, I was getting this very problem in my FreeBSD version.
I'm running Nas4Free 9.2.0.1 (x64) Full Installation
1) Created a jail using theBrig, jail called "db", enabling all four tarballs (may not have been necessary but what the hell)
2) From within the "db" jail, fetched and extracted the latest ports then I installed postgresql 9.3:
NOTE: I accepted all defaults during the installation of various packages
3) Enabled SystemV IPC support from within theBrig:
4) From the Nas4Fre host, the /etc/rc.conf.local should contain configuration settings for each of your jails. In my case jail "db". As stated in the article I linked to above, this needs editing to include
jail_<your_jail_name>_parameters="allow.sysvipc=1"
NOTE: Replace <your_jail_name> with, you guessed it, your jail name
so for me, my /etc/rc.conf.local looked like this for the "db" jail:
5) Restart your jail and check SystemV IPC support is enabled from within the jail:
6) Now initialize the postgresql database and you're good to go:
Although the article refers to FreeBSD 8.x, I was getting this very problem in my FreeBSD version.
I'm running Nas4Free 9.2.0.1 (x64) Full Installation
1) Created a jail using theBrig, jail called "db", enabling all four tarballs (may not have been necessary but what the hell)
2) From within the "db" jail, fetched and extracted the latest ports then I installed postgresql 9.3:
Code: Select all
# portsnap fetch extract
# cd /usr/ports/databases/postgresql93-server/
# make install clean3) Enabled SystemV IPC support from within theBrig:
4) From the Nas4Fre host, the /etc/rc.conf.local should contain configuration settings for each of your jails. In my case jail "db". As stated in the article I linked to above, this needs editing to include
jail_<your_jail_name>_parameters="allow.sysvipc=1"
NOTE: Replace <your_jail_name> with, you guessed it, your jail name
so for me, my /etc/rc.conf.local looked like this for the "db" jail:
5) Restart your jail and check SystemV IPC support is enabled from within the jail:
Code: Select all
# sysctl security.jail.sysvipc_allowed
security.jail.sysvipc_allowed: 1Code: Select all
/usr/local/etc/rc.d # ./postgresql initdb
The files belonging to this database system will be owned by user "pgsql".
This user must also own the server process.
The database cluster will be initialized with locale "C".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
/usr/local/bin/postgres -D /usr/local/pgsql/data
or
/usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
root@db:/usr/local/etc/rc.d # cat /etc/rc.conf