The following examples assumed you had Homebrew and (homebrew-services|https://github.com/gapple/homebrew-services) installed.
brew install postgres
- Stop the server
brew services stop postgresql
- Delete the cluster created by homebrew by default since it might be created with arbitrary locale
rm -rf /usr/local/var/postgres
- Create a new cluster with correct locale
initdb --pgdata=/usr/local/var/postgres --locale=en_US.UTF-8
- Now start the postgres server
brew services start postgresql
- Create a default database to avoid
psql
complainingcreatedb
- Verify database is created correctly w.r.t cluster locale
psql
, then;\l
... Name | Owner | Encoding | Collate | Ctype | Access privileges limouren | limouren | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
- Now create a new database for Skygear
createdb skygear
- Done!
Precise
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.5 pgadmin3
- Done!
See (Apt|https://wiki.postgresql.org/wiki/Apt) in the Postgresql's wiki for more information.
Trusty
sudo apt-get install postgresql-9.5 pgadmin3
- Done!
After postgresql installed:
Let's say we are running skygear server under the user account named skyuser
sudo su postgres
createuser --superuser skyuser
exit
sudo su skyuser
createdb
; stop psql from complainingcreatedb skygear
psql
\l
; verify that the database is created correctly
Name | Owner | Encoding | Collate | Ctype | Access privileges
--------+----------+----------+-------------+-------------+-----------------------
skygear | skyuser | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
- Done!
Skygear uses PostGIS extension to handle geometry stroage and query.
To install:
$ brew install postgis
$ sudo apt-get postgis-2.2