Today I installed one more PostgreSql on one more Ubuntu. That’s why I decided to memorize my steps here for quick reference.
Install postgresql and related packages
Type in terminal:
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install pgadmin3
Setting password for postgres user
To set password for postgres user, open psql command prompt:
sudo -u postgres psql postgres
Type command
\password postgres
type password twice when prompted and please don’t forget it 🙂
press ctrl-D to exit
Create database
Database creation command:
1 |
sudo -u postgres createdb mydatabase |
Connect database and check installation
In terminal
1 |
psql -h localhost -p 5432 -U myuser -W mypassword mydatabase |
With pgadmin
Run pgadmin, for example typing in terminal
pgadmin3
press button Add a connection, fill window New Server Registration with data:
Name: my server
Host: localhost
Port: 5432
Password: your postgres user password you entered earlier
Now you can expand localhost server in pgAdmin object browser and go to your database