Jelkner's
Weblog


About me

Blog Posts Blog Tags

2021 2020 2019 2018 2017

Log in

Copyright © 2020
Jeffrey Elkner

Ubuntu 18.04 KVM Dev Server Setup II


PostGIS Logo

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:

System Message: ERROR/3 (<string>, line 56)

Unknown directive type "highlight".

.. highlight:: none

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

and changed 'localhost' to '*', so the line became:

System Message: ERROR/3 (<string>, line 64)

Unknown directive type "highlight".

.. highlight:: none

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

Next:

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

and change line 92 from:

System Message: ERROR/3 (<string>, line 76)

Unknown directive type "highlight".

.. highlight:: none

host    all             all             127.0.0.1/32            md5

to:

System Message: ERROR/3 (<string>, line 84)

Unknown directive type "highlight".

.. highlight:: none

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:

System Message: ERROR/3 (<string>, line 94)

Unknown directive type "highlight".

.. highlight:: none

$ 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:

System Message: ERROR/3 (<string>, line 107)

Unknown directive type "highlight".

.. highlight:: none

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

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

System Message: ERROR/3 (<string>, line 118)

Unknown directive type "highlight".

.. highlight:: none

$ 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.