如何使用Homebrew将Postgis安装到Postgres@9.6的Keg安装中? [英] How to install Postgis to a Keg installation of Postgres@9.6 using Homebrew?

查看:148
本文介绍了如何使用Homebrew将Postgis安装到Postgres@9.6的Keg安装中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过Homebrew安装了Postgresql@9.6和Postgis.但是,通过Homebrew安装Postgis会以10的依赖关系安装最新版本的Postgresql,而将Postgresql固定为9.6.5会阻止通过Homebrew的Postgis安装.

I have installed Postgresql@9.6 and Postgis via Homebrew. However, installing Postgis via Homebrew installs the latest version of Postgresql at 10 as dependency and pinning Postgresql at 9.6.5 blocks the install of Postgis via Homebrew.

执行创建扩展帖子";返回:

Performing 'CREATE EXTENSION postgis;' returns:

ERROR: could not open extension control file "/usr/local/Cellar/postgresql@9.6/9.6.5/share/postgresql@9.6/extension/postgis.control": No such file or directory

我也尝试过卸载Postgresql(在10点)并编辑Postgis公式,使其依赖于Postgres@9.6而不是Postgresql.

I've also tried uninstalling the Postgresql (at 10) and editing the Postgis formula to depend on Postgres@9.6 instead of Postgresql.

这类似于如何使用Homebrew将Postgis安装到Postgres@9.5的Keg安装中?,但具有更高的keg公式

This is similar to How to install Postgis to a Keg installation of Postgres@9.5 using Homebrew? but with a later keg formula

推荐答案

经过多次组合,我设法做到了. 简而言之,解决方案是安装原始软件包postgres的旧版本,切换到它,然后安装postgis的旧版本.

I managed to do it after many combinations. In a nutshell, solution is to install the old version of the original package postgres, switch to it, and install the old version of postgis.

1/安装当前版本的postgres(说的是10.1)

1/ Install the current version of postgres (10.1 as speaking)

brew install postgres

2/使用旧公式安装旧版本的postgres.可以使用 github git log找到正确的链接在Tap repo(/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/)上.

2/ Install the old version of postgres using its old formula. Proper link can be found using github or git log on the Tap repo (/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/).

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/d014fa223f77bee4b4097c5e80faa0954e28182f/Formula/postgresql.rb

这将安装版本9.6.5(10.x系列之前的最后一个版本).

This will install the version 9.6.5 (last one before 10.x series).

3/切换至该链接,以便默认将链接设置为postgres 9.6

3/ Switch to it so links are defaulted to postgres 9.6

brew switch postgres 9.6.5

安装postgis

4/安装旧版本的postgis(2.3).这是使用相同的Formula版本的sha版本,因此所有链接都正确链接(使用当前的postgis会期望使用postgresql 10,因此初始化扩展名时最终会导致版本不匹配).

Install postgis

4/ Install old version of postgis (2.3). This is using the same sha version of the Formula so everything is linked correctly (using the current postgis will expect postgresql 10, so it will end up to a version mismatch when initializing extension).

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/d014fa223f77bee4b4097c5e80faa0954e28182f/Formula/postgis.rb

使用它们

5/如果需要,初始化数据库

Use them

5/ If required initialise the DB

initdb /usr/local/var/postgres

6/创建并使用您的数据库

6/ Create and use your DB

createdb mydb
psql mydb
mydb=# CREATE EXTENSION postgis;

这篇关于如何使用Homebrew将Postgis安装到Postgres@9.6的Keg安装中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆