On Sat, May 21, 2016 at 08:55:39AM +0200, J. Roeleveld wrote
> Longer answer:
> 
> On Friday, May 20, 2016 10:36:41 PM waltd...@waltdnes.org wrote:
> >   Yes, I did RTFM at https://wiki.gentoo.org/wiki/PostgreSQL/QuickStart
> > and that's part of my problem. <G>  I figured it would be a simple
> > search and replace "9.3" ==> "9.5" in the wiki, but...
> 
> A quick scan should indicate that.
> However:
> PG_INITDB_OPTS="--locale=en_US.UTF-8 --lc-messages=sv_SE.UTF-8"
> is wrong. See below.
> 
> > 1) The wiki recommends...
> > PG_INITDB_OPTS="--locale=en_US.UTF-8"
> 
> Where did you configure this?
> 
> I did the following:
> # cat /etc/conf.d/postgresql-9.5 | grep -i utf
> PG_INITDB_OPTS="--encoding=UTF8"
> 
> 
> Did you run 
> emerge --config dev-db/postgresql:9.5

  Yes.

> succesfully?

  Obviously not.  I think I've finally figured it out.  I edited
/etc/conf.d/postgresql-9.5 to PG_INITDB_OPTS="--encoding=UTF8" and ran
"emerge --config dev-db/postgresql:9.5".  I got an error message about
the data directory not be empty (probably from my first attempt).  I ran

rm /var/lib/postgresql/9.5/data/*
emerge --config dev-db/postgresql:9.5

and got a bit further.  I did get error messages as follows


#######################################################################
The database cluster will be initialized with locale "en_US.iso88591".
initdb: encoding mismatch
The encoding you selected (UTF8) and the encoding that the
selected locale uses (LATIN1) do not match.  This would lead to
misbehavior in various character string processing functions.
Rerun initdb and either do not specify an encoding explicitly,
or choose a matching combination.
mv: cannot stat '/var/lib/postgresql/9.5/data/pg_hba.conf': No such file or 
directory
mv: cannot stat '/var/lib/postgresql/9.5/data/pg_ident.conf': No such file or 
directory
mv: cannot stat '/var/lib/postgresql/9.5/data/postgresql.conf': No such file or 
directory
#######################################################################

  I fixed that.  In /etc/conf.d/postgresql-9.5 I set
PG_INITDB_OPTS="--encoding=iso88591"  and ran

rm /var/lib/postgresql/9.5/data/*
emerge --config dev-db/postgresql:9.5

and got the following.  Does it look OK?  Do I understand correctly...

config files are located in /etc/postgresql-9.5/
the actual databases are located in /var/lib/postgresql/9.5/data

#######################################################################
[i3][root][~] emerge --config dev-db/postgresql:9.5

Configuring pkg...

 * You can modify the paths and options passed to initdb by editing:
 *     /etc/conf.d/postgresql-9.5
 * 
 * Information on options that can be passed to initdb are found at:
 *     http://www.postgresql.org/docs/9.5/static/creating-cluster.html
 *     http://www.postgresql.org/docs/9.5/static/app-initdb.html
 * 
 * PG_INITDB_OPTS is currently set to:
 *     --encoding=UTF8
 * 
 * Configuration files will be installed to:
 *     /etc/postgresql-9.5/
 * 
 * The database cluster will be created in:
 *     /var/lib/postgresql/9.5/data
 * 
 * Are you ready to continue? (y/n)
y
 * Creating the data directory ...
 * Initializing the database ...
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.iso88591".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/9.5/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
creating template1 database in /var/lib/postgresql/9.5/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/lib64/postgresql-9.5/bin/pg_ctl -D /var/lib/postgresql/9.5/data -l 
logfile start

 * The autovacuum function, which was in contrib, has been moved to the main
 * PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled
 * by default. You can disable it in the cluster's:
 *     /etc/postgresql-9.5/postgresql.conf
 * 
 * The PostgreSQL server, by default, will log events to:
 *     /var/lib/postgresql/9.5/data/postmaster.log
 * 
 * You should use the '/etc/init.d/postgresql-9.5' script to run PostgreSQL
 * instead of 'pg_ctl'.
#######################################################################

  There's still one apparent internal contradiction in the output...

#######################################################################
Success. You can now start the database server using:

    /usr/lib64/postgresql-9.5/bin/pg_ctl -D /var/lib/postgresql/9.5/data -l 
logfile start
#######################################################################

...but it also says...

#######################################################################
 * You should use the '/etc/init.d/postgresql-9.5' script to run PostgreSQL
 * instead of 'pg_ctl'.
#######################################################################

-- 
Walter Dnes <waltd...@waltdnes.org>
I don't run "desktop environments"; I run useful applications

Reply via email to