DataBase/PostGIS

Ubuntu 18.04 PostgreSQL10.04 + PostGIS 2.4 설치

범데이 2022. 1. 23. 03:02
728x90
sudo apt-get install binutils libproj-dev gdal-bin

 

$ sudo apt-get update
$ sudo apt-get install -y binutils postgresql postgresql-contrib
# Password for the database
$ sudo su - postgres
$ psql
> CREATE USER myprojectuser WITH PASSWORD 'password';
> CREATE DATABASE myproject OWNER myprojectuser;
> ALTER ROLE myprojectuser SET client_encoding TO 'utf8';
> ALTER ROLE myprojectuser SET default_transaction_isolation TO 'read committed';
> ALTER ROLE myprojectuser SET timezone TO 'UTC';
> GRANT ALL PRIVILEGES ON DATABASE myproject TO myprojectuser;
# Test conection, quit with \q or ctrl+d
$ psql -h localhost -U myprojectuser myproject

# Install 
$ sudo apt-get install binutils libproj-dev gdal-bin 
# Check package version, searching with command
# sudo apt-cache search postgresql | grep gis
$ sudo apt-get install -y postgis postgresql-10-postgis-2.4 python-psycopg2
$ sudo -u postgres psql -c "CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology;" myproject

 

 

위의 커맨드를 따라 설치를 한 후, 아래와 같이 설치된 버전을 확인할 수 있다.

 

PostgreSQL version check
PostGIS version check

 


#References

Installing Geospatial libraries: GDAL

반응형