configure: WARNING:
configure: WARNING: | You are building using --with-projdir. This option isn't standard and |
configure: WARNING: | might be incompatible with future releases of PROJ. |
configure: WARNING: | You can instead adjust the PKG_CONFIG_PATH environment variable if you |
configure: WARNING: | installed software in a non-standard prefix. |
configure: WARNING: | Alternatively, you may set the environment variables PROJ_CFLAGS and |
configure: WARNING: | PROJ_LIBS to avoid the need to call pkg-config.
编译安装 pgrouting
下载源码包
git clone https://github.com/pgRouting/pgrouting.git
或下载压缩包
https://github.com/pgRouting/pgrouting/releases
配置编译参数
export PATH=/usr/local/pgsql/bin:$PATH
export LD_LIBRARY_PATh=/usr/local/pgsql/lib:$LD_LIBRARY_PATh
tar xf pgrouting-3.6.0.tar.gz
cd pgrouting-3.6.0
mkdir build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/pgsql \
-DPOSTGRESQL_EXECUTABLE=/usr/local/pgsql/bin/pg_config
编译安装
make -j$(nproc)
make install
ldconfig
初始化数据库
useradd -m postgres
chown -R postgres:postgres /usr/local/pgsql
su - postgres
cd /usr/local/pgsql
./bin/initdb -U postgres -E UTF8 -D ./data
建表并检查列是否使用了 lz4 压缩算法
drop table if exists test_lz4;
CREATE TABLE test_lz4 (txt text COMPRESSION lz4);
INSERT INTO test_lz4 SELECT repeat('abcd',10000);
\d+ test_lz4
select pg_column_compression(txt) from test_lz4;
postgres=# select pg_column_compression(txt) from test_lz4;
pg_column_compression
-----------------------
lz4
(1 row)
drop table if exists test;
CREATE TABLE test (txt text);
INSERT INTO test SELECT repeat('abcd',10000);
\d+ test
select pg_column_compression(txt) from test;
postgres=# select pg_column_compression(txt) from test;
pg_column_compression
-----------------------
lz4
(1 row)
检查 postgis 与 pgrouting 是否可以成功创建
create extension fuzzystrmatch;
create extension pgrouting;
create extension plpgsql;
create extension postgis;
create extension postgis_raster;
create extension postgis_tiger_geocoder;
create extension postgis_topology;
postgres=# \dx
List of installed extensions
Name | Version | Schema | Description
------------------------+---------+------------+------------------------------------------------------------
fuzzystrmatch | 1.1 | public | determine similarities and distance between strings
pgrouting | 3.6.0 | public | pgRouting Extension
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
postgis | 3.4.2 | public | PostGIS geometry and geography spatial types and functions
postgis_raster | 3.4.2 | public | PostGIS raster types and functions
postgis_tiger_geocoder | 3.4.2 | tiger | PostGIS tiger geocoder and reverse geocoder
postgis_topology | 3.4.2 | topology | PostGIS topology spatial types and functions