After attending an awesome hackathon last weekend, I realized quite a few things; the most prevalent being the necessity of having popular databases like PostgreSQL and MongoDB ready to go on your system. For those using Linux system, specifically of the Debian or Ubuntu flavors; this quick and (should be) easy guide is here for you.
Typically you’d need both the production software and the development client headers for the server on your system. Running the following should help:
That’d swiftly install the packages and set up the server for automatically
starting up on system start. To ensure that everything is fine, try checking
the version of PostgreSQL’s command line utility,
Setting up a User
Now, the more tricker aspect of things might be setting up a new user. Coming from a MySQL background, the commands aren’t that different (if not at all). The only problem after installing is that your user account on your system won’t be recognized as a valid user account in Postgres. The following will help you log in and set up an account to use with Postgres.
You might get a warning about
psqlnot being able to switch its working directory to the directory you’re working from. That’s a permission issue since your user account isn’t in the
Ctrl+D and enter the following commands to get Postgres to recognize you
as a user.
Now, within the PostgreSQL shell, create a password to be used with said account.
Typically, when an application connects to Postgres on Ubuntu, it’d try to
find a user AND database with the user name that’s currently logged in. This’ll
also help with making the starting of
psql easier too so by running the
following you should be able to do so:
That’s all there is to it! For more information, check out the community Wiki page on Postgres.