How to setup PostgreSQL on Arch Linux
Arch Linux is great; you should check it out. This how-to
exists mainly as an external memory for me. I hope this could be useful for someone else.
Suppose you are trying to set up PostgreSQL for a Django project you are working on. Setting up PostgreSQL on Arch linux can be a little tricky.
To set up follow the following:
- Upgrade your system:
$ sudo pacman -Syu
- Install PostgreSQL:
$ sudo pacman -S postgresql
- Initialize postgresql database:
$ sudo -u postgres initdb --locale en_US.UTF-8 -D /var/lib/postgres/data
- Start postgres service with
sytemctl
:
$ sudo systemctl start postgresql
- Enable the postgresql service:
$ sudo systemctl enable postgresql
- Type the following:
$ su - postgres
and if you get the error Authentication failure then type:
$ sudo passwd postgres
and type your password.
- Type the following again:
$ su - postgres
and finally:
$ psql