car*_*ope 9 postgresql homebrew postgis postgresql-9.5 postgresql-9.6
我已经通过Homebrew安装了Postgresql@9.6和Postgis.但是,通过Homebrew安装Postgis会将最新版本的Postgresql安装在10作为依赖,并将Postgresql固定在9.6.5阻止通过Homebrew安装Postgis.
执行'CREATE EXTENSION postgis;' 收益:
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.
这类似于如何使用Homebrew将Postgis安装到Postgres @9.5的Keg安装中?但后来的桶配方
经过多次组合,我设法做到了。简而言之,解决方案是安装原始程序包的旧版本postgres,切换到它,然后安装的旧版本postgis。
1 /安装当前版本postgres(正在讲10.1)
brew install postgres
Run Code Online (Sandbox Code Playgroud)
2 /使用旧公式安装旧版本的postgres。可以使用github或git logTap repo(/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/)找到正确的链接。
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/d014fa223f77bee4b4097c5e80faa0954e28182f/Formula/postgresql.rb
Run Code Online (Sandbox Code Playgroud)
这将安装版本9.6.5(10.x系列之前的最后一个)。
3 /切换到它,因此链接默认为postgres 9.6
brew switch postgres 9.6.5
Run Code Online (Sandbox Code Playgroud)
4 /安装旧版本的postgis(2.3)。这使用的是同一Formula版本的sha版本,因此所有链接均正确连接(使用当前的postgis将使用postgresql 10,因此初始化扩展名时最终会导致版本不匹配)。
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/d014fa223f77bee4b4097c5e80faa0954e28182f/Formula/postgis.rb
Run Code Online (Sandbox Code Playgroud)
5 /如果需要初始化数据库
initdb /usr/local/var/postgres
Run Code Online (Sandbox Code Playgroud)
6 /创建和使用您的数据库
createdb mydb
psql mydb
mydb=# CREATE EXTENSION postgis;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2762 次 |
| 最近记录: |