Installation of PostgreSQL Database in Arch Linux
- Install the package
postgresql
pacman -S postgresql
- Installation also adds a new user called
postgres
to the system. Ensure this by running the following command
cat /etc/passwd
- Set password for the user
postgres
sudo passwd postgres
- Login to
postgres
user
su postgres
- Initiate DB
initdb -D /var/lib/postgres/data --data-checksums
You CANNOT use a sub-directory under your $USER home directory as postgres directory afaik.
- Start PostgreSQL service by running
systemctl start postgresql.service