YuChun's Blog
Published on

How to install osm2pgsql on ubuntu 18.04?

Authors
  • avatar
    Name
    YuChun Tsao
    Twitter

Environment

  • Ubuntu 18.04
  • CMake 3.24.1

With apt

You can easily install osm2pgsql with apt, but the version is not the latest version.

sudo apt install osm2pgsql

Check version

osm2pgsql --version
# osm2pgsql version 0.94.0

You can uninstall with sudo apt remove osm2pgsql

Install the latest version from source

If you want to install the latest version of osm2pgsql, you can complie from source code.

Download source code

Download or clone the latest release source code from GitHub.

git clone https://github.com/openstreetmap/osm2pgsql.git --branch 1.7.2

(2023/01/01) The version 1.7.2 released on 2022-11-10.
You can also download the latest release from release page

Complie and install

# ./osm2pgsql
mkdir build && cd build
cmake ..
sudo make install

Check version

osm2pgsql --version
# osm2pgsql version 1.7.2

Referneces