PostgreSQL is an open source RDBMS which doing fine work.
If you’ll check VMware appliances, you’ll see they use this DB in them.
It has some better features compares to mySQL.
postgresql – the database engine
postgresql-contrib – the database command line tools
echo “Installing PostgreSQL”
sudo apt-get update &> /dev/null
sudo apt-get install postgresql postgresql-contrib -y &> /dev/null
echo “Installing GUI admin tool – pgadmin III”
sudo apt-get install pgadmin3 &> /dev/null
echo “Creating user and database for user $USER”
sudo -i -u postgres bash -c “createuser –superuser $USERĀ && createdb $USER”
echo -n “Enter $USER password: ” && read -s password
psql -c “alter user $USER with password $password”
Tips
General
- default port for postgresql: 5432
- You’ve just installed database instance.
- In this instance you can have several Databases.
- There’s a default database – postgres. I personly don’t use it.
- each database comes defaultly with
- schema called “public”, so each table creation will be under it be default.
- information_schema catalog – schema with tables/views about your database. for example table with list of your tables: information_schema.tables .
File locations for configuration and data
- default location for databases: /var/lib/postgresql/9.1/main
- main configuration file: /etc/postgresql/9.1/main/postgresql.conf
- tables saved in a tablespace. the default is pg_default
- there’s another tablespace – pg_global. don’t know yet what it’s for.
- you can also run commands through psql – command line interface for the database.
Remote Connection
- if you want to connect from another machine, edit /etc/postgresql/9.1/main/postgresql.conf and add the line: “listen_addresses = ‘*'”. restart the service after – sudo service postgresql restart.\
- in addition – add the following line to /etc/postgresql/9.1/main/pg_hba.conf: “host all all x.x.x.x/x md5”. change x.x.x.x/x to your segment. again – restart service.