23. DBサーバ構築 – PostgreSQL [さくらのVPS/CentOS7]

・PostgreSQLの用途

  1. Mastodon

・PostgreSQLのインストール

yum install -y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
yum install -y postgresql11-{server,contrib,devel}

export PGSETUP_INITDB_OPTIONS="--encoding=UTF-8 --no-locale"
/usr/pgsql-11/bin/postgresql-11-setup initdb

cp -p /var/lib/pgsql/11/data/pg_hba.conf{,.org}

sed -i -e 's/^local.*/local all all trust/' \
	-e "s/ident$/trust/" /var/lib/pgsql/11/data/pg_hba.conf

systemctl enable postgresql-11
systemctl start postgresql-11