Skip to content

Instantly share code, notes, and snippets.

@sainak
Created May 7, 2021 20:48
Show Gist options
  • Save sainak/6bc6db3557771b8e74a3789916473d73 to your computer and use it in GitHub Desktop.
Save sainak/6bc6db3557771b8e74a3789916473d73 to your computer and use it in GitHub Desktop.
setup postgres in arch linux
##############################################################
#setup postgresql
sudo pacman -S postgresql && \
sudo mkdir /var/lib/postgres/data && \
sudo chown -c -R postgres:postgres /var/lib/postgres && \
sudo -i -u postgres
initdb -D '/var/lib/postgres/data'
logout
sudo systemctl start postgresql
createuser -s -U postgres --interactive
Enter name of role to add: myUsualArchLoginName
#Now you can create databases and access them as an Arch user. Here's an example:
createdb myDatabaseName
#Use the psql command to access the PostgreSQL database shell, psql. (-d specifies the database to connect to.)
psql -d myDatabaseName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment