Skip to content

Instantly share code, notes, and snippets.

@semihozkoroglu
Forked from jourdein/gist:5412399
Last active December 24, 2015 15:39
Show Gist options
  • Save semihozkoroglu/6822573 to your computer and use it in GitHub Desktop.
Save semihozkoroglu/6822573 to your computer and use it in GitHub Desktop.
# STEP 1: VERIFY THAT YOU DO NOT ALREADY HAVE POSTGRESQL INSTALLED ON YOUR SYSTEM
ps ax | grep postgres
# STEP 2: INSTALL POSTGRESQL ON YOUR SYSTEM
sudo apt-get update
sudo apt-get install postgresql-9.1
# List All Postgres related packages
dpkg -l | grep postgres
# * No PostgreSQL clusters exist; see "man pg_createcluster"
# STEP 2.1: CREATES A NEW POSTGRESQL SERVER CLUSTER START SERVER
# http://serverfault.com/a/234993
pg_lsclusters
pg_createcluster 9.1 main --start
sudo service postgresql start
# STEP 2.2: change user to the PostgreSQL user
sudo su - postgres
# STEP 3: CONFIGURE YOUR POSTGRESQL PASSWORD
#IF changed to user Postgre already
psql -d postgres -U postgres
#ElSE
sudo -u postgres psql template1
#ENDIF
OR
sudo -u postgres psql postgres
# set password
\password postgres
# ALTER USER postgres with encrypted password 's0meth1ng'; ALTER ROLE
# \q OR ctrl-d
# install other optional packages
# apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
# -----------------
# Create database
# sudo -u postgres createdb mydb
sudo -u postgres createuser -D -A -P <user> # Full permission
sudo -u postgres createdb -O <user> <db>
# -----------------
# References:
# 1. https://help.ubuntu.com/community/PostgreSQL
# 2. http://hendrelouw73.wordpress.com/2012/11/14/how-to-install-postgresql-9-1-on-ubuntu-12-10-linux/
# 3. http://www.howtoforge.com/installing-nginx-with-php5-and-php-fpm-and-mysql-support-lemp-on-ubuntu-12.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment