A quick Google search brought me to this Ask Ubuntu link:
http://askubuntu.com/questions/201537/pgadmin-iii-doesnt-work-due-to-the-server-lacks-instrumentation-functionswhich says I need to install postgresql-contrib. Here goes:
$ sudo aptitude install postgresql-contribIt installed a single package without incident. After clicking the "Fix It!" button, I can now connect to the remote server without warning.
To install pgAdmin on my desktop at home, I ran:
$ sudo aptitude install pgadmin3it returned that:
The following NEW packages will be installed:While it is no surprise that pgAdmin would depend on postgresql-client (which has the command line psql program), it is convenient. For one thing, it makes it easier to test out the connection to the remote database server, since the psql command:
pgadmin3 pgadmin3-data{a} pgagent{a} postgresql-client{a}
postgresql-client-9.3{a} postgresql-client-common{a}
$ psql -h [server name] [database name]Is easy to remember. I still don't know off the bat how to fill in the fields of the pgAdmin connection screen without looking things up. Here is a screen shot of the New Server Registration screen:
I know what to put in the Host, Username, and Password fields, but I'm not sure about Name and Maintenance DB. Is Name the name of the database, or is that Maintenance DB?
This documentation page proved most helpful:
http://www.pgadmin.org/docs/dev/connect.htmlI put "nyc" (the name of the database we are using for class) in both the Name and Maintenance DB fields, and it connected to the server without incident.
Setting Up the Local Virtual Database Server for Testing
My next task, assigned to me at our last Code for NoVA meet up, is to look into loading OpenStreetMap (OSM) data into a PostGIS database. As cool as it is having a remote server out on the web running a database server 24/7 that I can connect to whenever I want, I'm not going run new "experiments" on that machine. That's where local VirtualBox VMs come in handy.I described my first attempt at setting up a PostGIS server in a previous post. As I've learned since, starting out with the command:
$ sudo aptitude install postgresql-9.3-postgis-2.1is the best way to get going, since it installs postgresql itself and most everything else you need to get started. I still have the VM I made back then, so now I'm going to copy over the nyc database to it and configure it for remote access.
I'll repeat the process I used to move the nyc database from the VirtualBox VM we were given in our Web-based GIS class, described in my previous post, only this time I'll export it from my database server, so that I can skip the steps where I had to rename the owner of the database.
Here is what I did:
username@local_machine:~$ ssh [database server name]I could export the database as me, since I've been setup as a database user. I don't remember whether I did that on the VirtualBox VM, so now is a good time to learn some more PostgreSQL administration. Here is a documentation page which has what I need:
username@dbserver:~$ pg_dump -c nyc > nyc.sql
username@dbserver:~$ exit
username@local_machine:~$ scp [database server name]:nyc.sql .
http://www.postgresql.org/docs/9.3/static/database-roles.htmlTrying to start psql on the VirtualBox server shows that I didn't add my user as a database user:
$ psqlTime to fix that:
psql: FATAL: role "[username]" does not exist
username@postgis:~$ sudo -iIt successfully ran the script and populated the nyc database. I could then run:
[sudo] password for username:
root@postgis:~# su - postgres
postgres@postgis:~$ createuser --superuser username
postgres@postgis:~$ exit
logout
root@postgis:~# exit
logout
username@postgis:~$ createdb nyc
username@postgis:~$ psql nyc < nyc.sql
username@postgis:~$ psql nycand connect to the nyc database and run queries.
Now to enable remote connections:
username@postgis:~$ sudo vi /etc/postgresql/9.3/main/pg_hba.confand changed this line:
host all all 127.0.0.1/32 md5to:
host all all 0.0.0.0/0 md5then:
username@postgis:~$ sudo vi /etc/postgresql/9.3/main/postgresql.confand changed this line:
#listen_addresses = 'localhost'to:
listen_addresses = '*'
username@postgis:~$ psql nycThis is mostly a repetition of information in my previous post, but since I want to learn it, it bares repeating.
nyc=# alter user [user] with password '[password]';
ALTER ROLE
nyc=#
Finally, I'll connect from my desktop machine to the "remote" VirtualBox server, which has IP address 10.0.0.131 on my home network:
username@localmachine:~$ psql -h 10.0.0.131 nycExcellent! I'm all set to explore importing OSM data into my database.
Password:
psql (9.3.9)
SSL connection (cipher: DHE-RSA-AES256-GCM-SHA384, bits: 256)
Type "help" for help.
nyc=#
Hello Mr.Author,
ReplyDeleteThank you very much for sharing the massive explosion with us. It is very useful and informative.
Keep blogging for new updates.
DedicatedHosting4u.com
I can set up my new idea from this post. It gives in depth information. Thanks for this valuable information for all,.. this
ReplyDelete