using the -install command, psql can't be found, even though it is sitting right there at ~/Postgres841/bin/psql
It looks like the code assumes that psql is in $PATH. psql should probably be given a variable in the code, then redefined if the -install option is given, then changing all instances of psgl to $psgl_bin, then asking the user to add $installdir/bin to his $PATH.
Alternatively, for an install, you may wish to append $installdir/bin to the $PATH, but then osm2postgresql_02.sh would need to check for the existence of psql in the $PATH and in the hardcoded $installdir.
Or, osm2postgresql_02.sh can check for the existence of , and create if necessary, a .osm2postgres file in the user's $HOME which would contain the path to psql and osmosis the database name, host, port, and any other options that would need to be remembered from one run to the next.
Keep up the good work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks a lot for your comment! Indeed, I have another psql installed which is in the path on my machine, so the script did not complained. I'm not using much the one-click installer because of this bug: http://forums.enterprisedb.com/posts/list/2616.page (enterprisedb is not very responsive).
[in the help:]-b, --bash_init_script the name of the file (e.g. your bash init script) where to add a command that will add the path to 'psql' if using the --installdir option. Default is ~/.bashrc[in the option parsing part:] -b | --bash_init_script ) shift bash_init_script=$1 ;;
#Addnewpsqltothepath.Thankstahongawakaforpointingtheneedforthis.#Seediscussionathttps://sourceforge.net/projects/osm2postgresql/forums/forum/1683571/topic/4507607if[-z"$bash_init_script"];thenbash_init_script=~/.bashrc#usedefaultvaluefiecho"Postgres server installed. Adding the path to '$installdir/bin/psql' in $bash_init_script"touch$bash_init_script#makesurethefileexistsecho"">>$bash_init_script#addanemptylineecho"PATH=$installdir/bin:\$PATH; export PATH">>$bash_init_scriptecho"The file '$bash_init_script' now contains the following code related to the PATH:"cat$bash_init_script|grepPATH
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had the same problem with psql not being found. I\m using the _03 version of the script, recently downloaded. I manually exported the PATH and then it worked fine :)
I hit the next issue, though:
You will be asked the current postgres password now.
Please type 'postgres' (without quotes).
Password for user postgres:
ALTER USER ubuntu WITH PASSWORD 'ubuntu' ;
ERROR: role "ubuntu" does not exist
CREATE DATABASE "OSM2011-06-05_00:06:12" WITH OWNER ubuntu TEMPLATE template_postgis;
ERROR: role "ubuntu" does not exist
\connect: FATAL: database "OSM2011-06-05_00:06:12" does not exist
I'm using an ubuntu 11.04 EC2 instance in case that helps to find the issue!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Let's say you run the script with linux user named "ubuntu". The script assumes this postgresql user exists and it's password is 'ubuntu'.
You can create the user by doing one of the following:
# as ubuntu user:
echo "CREATE USER `whoami`; ALTER USER `whoami` SUPERUSER;" > psql
# or:
echo "CREATE USER ubuntu; ALTER USER ubuntu SUPERUSER;" > psql
# or: uncomment (read: remove "-" in line 336 of the script
Please tell me if this works or if you need more helps.
For the psql not being found, version 03 contains new code that should fixe this, see code near "Postgres server installed. Adding the path to '$installdir/bin/psql' in $bash_init_script"
However, this might not work on some settings (depending on where your psql is and what bash config files you use). May I ask you to say precisely what you did to manually export the PATH ?
I'm using the script in production on Kubuntu 10.10 and 11.04.
Regards,
Mayeul
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately I terminated that EC2 instance after getting frustrated with it, so I can't give you an exact bash history, but I believe I simply ran "export PATH=$installdir/bin:\$PATH", after which the installation continued (and stopped on the ubuntu role issues).
using the -install command, psql can't be found, even though it is sitting right there at ~/Postgres841/bin/psql
It looks like the code assumes that psql is in $PATH. psql should probably be given a variable in the code, then redefined if the -install option is given, then changing all instances of psgl to $psgl_bin, then asking the user to add $installdir/bin to his $PATH.
Alternatively, for an install, you may wish to append $installdir/bin to the $PATH, but then osm2postgresql_02.sh would need to check for the existence of psql in the $PATH and in the hardcoded $installdir.
Or, osm2postgresql_02.sh can check for the existence of , and create if necessary, a .osm2postgres file in the user's $HOME which would contain the path to psql and osmosis the database name, host, port, and any other options that would need to be remembered from one run to the next.
Keep up the good work.
Thanks a lot for your comment! Indeed, I have another psql installed which is in the path on my machine, so the script did not complained. I'm not using much the one-click installer because of this bug: http://forums.enterprisedb.com/posts/list/2616.page (enterprisedb is not very responsive).
After this:
Add this:
I had the same problem with psql not being found. I\m using the _03 version of the script, recently downloaded. I manually exported the PATH and then it worked fine :)
I hit the next issue, though:
You will be asked the current postgres password now.
Please type 'postgres' (without quotes).
Password for user postgres:
ALTER USER ubuntu WITH PASSWORD 'ubuntu' ;
ERROR: role "ubuntu" does not exist
CREATE DATABASE "OSM2011-06-05_00:06:12" WITH OWNER ubuntu TEMPLATE template_postgis;
ERROR: role "ubuntu" does not exist
\connect: FATAL: database "OSM2011-06-05_00:06:12" does not exist
I'm using an ubuntu 11.04 EC2 instance in case that helps to find the issue!
Let's say you run the script with linux user named "ubuntu". The script assumes this postgresql user exists and it's password is 'ubuntu'.
You can create the user by doing one of the following:
# as ubuntu user:
echo "CREATE USER `whoami`; ALTER USER `whoami` SUPERUSER;" > psql
# or:
echo "CREATE USER ubuntu; ALTER USER ubuntu SUPERUSER;" > psql
# or: uncomment (read: remove "-" in line 336 of the script
Please tell me if this works or if you need more helps.
For the psql not being found, version 03 contains new code that should fixe this, see code near "Postgres server installed. Adding the path to '$installdir/bin/psql' in $bash_init_script"
However, this might not work on some settings (depending on where your psql is and what bash config files you use). May I ask you to say precisely what you did to manually export the PATH ?
I'm using the script in production on Kubuntu 10.10 and 11.04.
Regards,
Mayeul
Unfortunately I terminated that EC2 instance after getting frustrated with it, so I can't give you an exact bash history, but I believe I simply ran "export PATH=$installdir/bin:\$PATH", after which the installation continued (and stopped on the ubuntu role issues).
I got set up happily using http://weait.com/content/build-your-own-openstreetmap-server on a fresh EC2 instance, though, so no problem!