Problem with setting up server during creating database

musicbrainz-server
Tags: #<Tag:0x00007f30a2245660>

#1

I’ve trying to install MetaBrainz server following the instructions at https://github.com/metabrainz/musicbrainz-server/blob/master/INSTALL.md.

However, I encountered a problem when running:
./admin/InitDb.pl --createdb --import /tmp/dumps/mbdump*.tar.bz2 --echo

Here’s the error message:
Failed query:
‘SELECT current_setting(‘server_version_num’)’
()
08006 DBI connect(‘dbname=template1’,‘postgres’,…) failed: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?
at /mnt/c/Users/jirui/Desktop/musicbrainz-server/admin/…/lib/Sql.pm line 460.
Sql::catch {…} (MusicBrainz::Server::Exceptions::DatabaseError=HASH(0x3093f48)) called at /usr/share/perl5/Try/Tiny.pm line 115
Try::Tiny::try(CODE(0x169a620), Try::Tiny::Catch=REF(0x280ea98), Try::Tiny::Finally=REF(0x1a54b70)) called at /mnt/c/Users/jirui/Desktop/musicbrainz-server/admin/…/lib/Sql.pm line 466
Sql::_select_list(Sql=HASH(0x280b5d8), “SELECT current_setting(‘server_version_num’)”, ARRAY(0x2e69df0), “arrayref”, CODE(0x2e53370)) called at /mnt/c/Users/jirui/Desktop/musicbrainz-server/admin/…/lib/Sql.pm line 485
Sql::select_list_of_lists(Sql=HASH(0x280b5d8), “SELECT current_setting(‘server_version_num’)”) called at /mnt/c/Users/jirui/Desktop/musicbrainz-server/admin/…/lib/Sql.pm line 416
Sql::select_single_column_array(Sql=HASH(0x280b5d8), “SELECT current_setting(‘server_version_num’)”) called at /mnt/c/Users/jirui/Desktop/musicbrainz-server/admin/…/lib/Sql.pm line 431
Sql::select_single_value(Sql=HASH(0x280b5d8), “SELECT current_setting(‘server_version_num’)”) called at ./admin/InitDb.pl line 73
main::RequireMinimumPostgreSQLVersion() called at ./admin/InitDb.pl line 521
08006 DBI connect(‘dbname=template1’,‘postgres’,…) failed: could not connect to server: No such file or directory
Is the server running locally and accepting

Since I’m totally new to all of this, I suspect I probably did something wrong.
Thanks a lot!


#2

How are your skills with postgres?
Do you have a database installed? has it been started?
You need postgres 9.5, 9.6 or 10 installed and running.
Just have the one version installed if possible as it makes it easier.

The in ubuntu config files for postgres are under /etc/postgresql/9.5/main/
You want to edit pg_hba.conf to allow you to use the os authentication feature of postgres.
This will allow you to just use psql and connect to the database without being prompted for a password.
For dev the following will let anyone who has an account on your server to be able to connect to the database.
local all all trust
This make things easy but is a huge security hole so be careful, the other example in the install document just gives just the www-user this power (and assumes you are installing the musicbrainz server under that user) adjust as needed.

For ubuntu 16.4 the preferred way to start postgres is to use systemctl once you have changed the config files.
postgresql@9.5-main.service


#3

Thanks a lot! Sorry for the late replay. I’ve been trying to figure out what’s wrong. It seems that in the previous steps, the DBDefs.pm file was not set correctly. There is a sub called WEB_SERVER, whose default value is { “www.musicbrainz.example.com” }. Do I need to change it?


#4

That parameter is used to change the url’s to match the domain you are running under.
You would be using something like apache or nginx as your web server and would set up a host name where the server is running.
For testing you could add an entry in your hosts file to get this to work.

You can ignore this until later if all you care about is a replicated database.

You could try running the vm as a new version has been built.