dwyl / learn-postgresql

🐘 Learn how to use PostgreSQL and Structured Query Language (SQL) to store and query your relational data. 🔍
212 stars 23 forks source link

Refactor Linux instructions #41

Open macintoshhelper opened 7 years ago

macintoshhelper commented 7 years ago

I've created a more copy/paste friendly Linux install script that removes the need for using whoami:

(
  # Update package list
  sudo apt-get update

  # Install postgresql and postgresql-contrib (additional modules such as UUID)
  sudo apt-get -y install postgresql postgresql-contrib

  # Set a shell variable to currently logged in user
  PSQL_MY_USERNAME=$(whoami)

  # Create a new postgres user for the currently logged in user
  sudo -u postgres createuser $PSQL_MY_USERNAME

  # Create a new postgres user for the currently logged in user
  sudo -u postgres createdb $PSQL_MY_USERNAME
);

Maybe PSQL_MY_USERNAME=$(whoami) could be added to the existing instructions, or the Linux section could be replaced with a single code block to be more copy/paste friendly?