Skip to content

Instantly share code, notes, and snippets.

@mikeclarke
Created December 12, 2010 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mikeclarke/738363 to your computer and use it in GitHub Desktop.
Save mikeclarke/738363 to your computer and use it in GitHub Desktop.
Basic PostgreSQL install
# Install the postgres packages
yum install postgresql postgresql-server
# Configure postgresql to start automatically on boot
chkconfig postgresql on
# Stat posgresql
service postgresql start
# Switch to postgres user (required to make initial connection to postgresql with default configuration)
su - postgres
# Make initial connection to the database to test connectivity
psql -d template1 -U postgres
-- Create a new user mingus
createuser -PE mingus
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
-- Create a new schema owned by mingus with UTF8 character set
createdb -O mingus -E UTF8 mingus_db
exit
# Edit the pg_hba.conf to allow md5 connections to localhost and 127.0.0.1/32
vi /var/lib/pgsql/data/pg_hba.conf
---
local all postgres ident sameuser
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
---
# Edit postgresql.conf to listen on localhost, port 5432
vi /var/lib/pgsql/data/postgresql.conf
---
listen_addresses = 'localhost' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
port = 5432
---
# Restart the server for the security / networking changes to take effect
/etc/init.d/postgresql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment