Mac
Homebrew を使って以下で入ります。
brew update
brew install postgres
バージョンを確認
バージョンが表示されれば大丈夫です。
psql --version
# psql (PostgreSQL) 11.3
バージョンがでない場合
サービスが起動しているか確認します。brew services list
でpostgresql stoped
になっていると起動してあげる必要があります。
# 正常
brew services list
# postgresql started . .
起動するにはbrew services start
コマンドを使います。
brew services start postgresql
Ubuntu
環境。
cat /etc/lsb-release
# DISTRIB_ID=Ubuntu
# DISTRIB_RELEASE=18.04
# DISTRIB_CODENAME=bionic
# DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
apt
を使ってインストールします。
sudo apt update
sudo apt install postgresql postgresql-contrib --yes