I am using the following link to install openstreetmap server on my ubuntu 14.04 server. I have followed their tutorial line by line and installed most of the dependencies and everything. When I try to import the North America's map data into my PostgreSQL database it is throwing an error. I am using this command to load all the data

osm2pgsql --slim  -d gis -C 16000 --number-processes 1 /usr/local/share/maps/planet/north-america-latest.osm.pbf

but it is throwing an error as you see on image.

Osm2pgsql failed due to ERROR: Error: Connection to database failed: FATAL: role 'azureuser' does not exist.

enter image description here

azureuser is the username of my terminal and when configuring my postgresSQL database I created a user 'openstreet' and database 'gis'. If you open the link you can also see the command to import data under the section Importing data into the database but that is not working for me. Could anyone help me with this error? I am not able to move forward from here

1 Answer 1


I have resolved this error:

The problem is still your pg_hba.conf file (/etc/postgresql/9.3/main/pg_hba.conf). This line:

local   all             postgres                                peer

Should be

local   all             postgres                                trust

After altering this file, don't forget to restart your PostgreSQL server. If you're on Linux, that would be sudo service PostgreSQL restart.

Once you have done this you need to change the Osm2pgql command. In this command my database name is gis and username is openstreet.

osm2pgsql --slim -U openstreet -d gis -C 16000 --number-processes 1 /usr/local/share/maps/planet/north-america-latest.osm.pbf 
  • 3
    I'm glad you found a pragmatic solution for a dev box, but I'd also recommend that you read this page on OWASP for info on postgres security. Also, read section 19.3.1 in the Postgres manual.
    – Steven Kay
    Commented Aug 11, 2015 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.