I want to install postgres and psql via a Slackbuild and I did so. After installing it I tried running the command as suggested in the readme of the Slackbuild but I get an error upon running it as stated.
su postgres -c "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"
Should be one line, it looks like from what you copied and pasted you have su on one line and then the rest of the command on anther line. I'm not sure if that is just a formatting issue on your part, but it really doesn't look like that is the case. Also the error message you report seems to support the idea that your not giving the command on one line, and as such not running the command as the right user etc. I ran it on one file. I tried installing it via the source code and it was very complex so I went back to installing it via the Slackbuild. All is good until I need to run: Code:
su postgres -c "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"
This is what I get when I try to run the above command in multiple manners. It does not execute and I believe this is why Postgres is not working. I decided to ride this one out and learn how to use Slackware, Linux, PSQL and Full Stack so as to maximize my knowledge base and contribute to the Slackware project. I noticed while installing postgres via this blog that certain important yet archiac programs aren't in the Sbo website which I plan on adding. This guy has some interesting blogs on Slackware:http://www.pmoghadam.com/homepage/HT...esql-epkg.html Below is my attempts to execute the commands, what do you think is going on?
bash-5.1$ su postgres -c "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"
Password:
su: Authentication failure
bash-5.1$ sudo postgres -c "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"
"root" execution of the PostgreSQL server is not permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromise. See the documentation for
more information on how to properly start the server.
bash-5.1$ su - postgres -c "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"
Password:
su: Authentication failure
bash-5.1$ su - postgres -c "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"
Password:
su: Authentication failure
bash-5.1$ su postgres -c "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"
Password:
su: Authentication failure
bash-5.1$ su postgres -c "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"
Password:
su: Authentication failure
bash-5.1$ su postgres -c init -D /var/lib/pgsql/14/data --locale-en_US.UTF-8 -A md5 -W
su: invalid option -- 'D'
Usage: su [options] [-] [username [args]]
Options:
-c, --command COMMAND pass COMMAND to the invoked shell
-h, --help display this help message and exit
-, -l, --login make the shell a login shell
-m, -p,
--preserve-environment do not reset environment variables, and
keep the same shell
-s, --shell SHELL use SHELL instead of the default in passwd
If no username is given, assume root.
bash-5.1$ su
Password:
bash-5.1# postgres -c "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"
"root" execution of the PostgreSQL server is not permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromise. See the documentation for
more information on how to properly start the server.
bash-5.1# su - postgres
We are upping our standards ... so up yours.
-- Pat Paulsen for President, 1988
postgres@Bern:~$ postgres -c "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"
2022-03-27 14:57:17.257 GMT [32152] FATAL: unrecognized configuration parameter "initdb _D /var/lib/pgsql/14/data __locale"
postgres@Bern:~$ postgres -c initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W
2022-03-27 14:57:30.413 GMT [32155] FATAL: -c initdb requires a value
postgres@Bern:~$
I don't know why this is not working given the fact I listened to and followed the holy read me. I trust in the Linux way and more importantly Slackware as a deity and magical piece of software. I will continue to search for results.
6.0 / import_db.sh
#!/usr/bin/env sh
dropdb sqlzoo
createdb sqlzoo
psql sqlzoo < data/create_tables.sql
ls
In the directory of a project file that needs to use psql. I receive the following errors:
bash-5.1# cd skeleton
bash-5.1# ls
Gemfile Gemfile.lock data database import_db.sh lib logfile spec
bash-5.1# ./import_db.sh
dropdb: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
createdb: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Gemfile Gemfile.lock data database import_db.sh lib logfile spec
bash-5.1# startdb
bash: startdb: command not found
bash-5.1# initdb
initdb: error: no data directory specified
You must identify the directory where the data for this database system
will reside. Do this with either the invocation option -D or the
environment variable PGDATA.
bash-5.1# psql
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
bash-5.1#
bash-5.1# nano import_db.sh
Why is this error occurring? Why can't I use psql?
sudo
instead ofsu
:sudo -u postgres "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"