PostGIS Logo

Ubuntu 18.04 KVM Dev Server Setup II

I began documenting my current KVM server setup in Setting up an Ubuntu 18.04 KVM Dev Server. In this post I will describe PostGIS installation and the process I use to recreate GIS projects I had running on previous servers.

A Few Things First

I already installed git, but I have several projects hosted on Launchpad, so I will need bzr installed as well:

$ sudo apt install bzr

Note

Launchpad now supports both git and bzr, but my old repositories are all currently in bzr.

I’ll need the Bottle Zoo project for a lesson I’m preparing for school this week, so I ran:

$ sudo apt install python3-bottle
$ bzr branch lp:bottlezoo

to check out the repository, and:

$ bzr launchpad-login [username]
$ bzr whoami "[Fname Lname] <[name@address.domain]>"

to set my launchpad login and whoami. I’m now ready to work with the Bottle Zoo code.

Installing PostGIS

Three years ago I documented PostGIS installation in PostGIS Installation. Let’s see how well that holds up. I ran:

$ sudo apt install postgis
$ sudo vi /etc/postgresql/10/main/postgresql.conf

Then uncommented line 59:

#listen_addresses = 'localhost'        # what IP address(es) to listen on;

and changed ‘localhost’ to ‘*’, so the line became:

listen_addresses = '*'                 # what IP address(es) to listen on;

Next:

$ sudo vi /etc/postgresql/10/main/pg_hba.conf

and change line 92 from:

host    all             all             127.0.0.1/32            md5

to:

host    all             all             0.0.0.0/0               md5

so connections from other machines are allowed.

Restart the server and start the command interpreter as the postgres user:

$ sudo service postgresql restart
$ sudo -u postgres psql
psql (10.3 (Ubuntu 10.3-1))
Type "help" for help.

postgres=#

Set a password for the postgres user:

postgres=# \password postgres
Enter new password: [password]
Entner it again: [password]
postgres=#

Finally login from the host machine to confirm all is working:

$ psql -h rms.local -p 5432 -U postgres
Password for user postgres: [password]
psql (10.3 (Ubuntu 10.3-1))
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

postgres=#

This process in easier than it was three years ago, since the postgis package now appears to have all the dependencies it needs. It looks like I’m ready to rebuild my GIS databases, which I’ll document in a future post.