Skip to content

Instantly share code, notes, and snippets.

@kalpesh-fulpagare
Last active August 29, 2015 13:55
Show Gist options
  • Save kalpesh-fulpagare/8688573 to your computer and use it in GitHub Desktop.
Save kalpesh-fulpagare/8688573 to your computer and use it in GitHub Desktop.
Installing postgres in ubuntu
# https://help.ubuntu.com/10.04/serverguide/postgresql.html
$ sudo apt-get install postgresql postgresql-contrib
# To enable TCP/IP connections, edit the file /etc/postgresql/9.1/main/postgresql.conf
# and locate the line #listen_addresses = 'localhost' and
# change it to: listen_addresses = 'localhost'
$ sudo nano /etc/postgresql/9.1/main/postgresql.conf
# Run the following command at a terminal prompt to connect to the default PostgreSQL template database:
$ sudo -u postgres psql template1
# The above command connects to PostgreSQL database template1 as user postgres. Once you connect to the PostgreSQL server, you will # be at a SQL prompt. You can run the following SQL command at the psql prompt to configure the password for the user postgres.
$ ALTER USER postgres with encrypted password 'root';
# To quit, type /q
# After configuring the password, edit the file /etc/postgresql/8.4/main/pg_hba.conf to
# use MD5 authentication with the postgres user:
$ sudo nano /etc/postgresql/9.1/main/pg_hba.conf
#local all postgres md5
# Finally, you should restart the PostgreSQL service to initialize the new configuration
$ sudo /etc/init.d/postgresql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment