PostgreSql Server & phppgadmin on Ubuntu

By | Linux, Servers | One Comment

To install PostgreSql Sever, execute

sudo apt-get install postgresql


To start off, we need to change the PostgreSQL postgres user password; we will not be able to access the server otherwise. As the “postgres” Linux user, we will execute the psql command.

In a terminal, type:

sudo -u postgres psql postgres


Set a password for the “postgres” database role using the command:

\password postgres

and give your password when prompted. The password text will be hidden from the console for security purposes.

Type Control+D to exit the posgreSQL prompt.

Since the only user who can connect to a fresh install is the postgres user, here is how to create yourself a database account (which is in this case also a database superuser) with the same name as your login name and then create a password for the user:

sudo -u postgres createuser --superuser $USER
sudo -u postgres psql
postgres=# \password $USER



phpPgAdmin is a web based PostgreSQL software management package. To use it you should install and configure PHP, Apache and postgresql, see PostgreSQL for instructions.

Installing From Package

Install phpPgAdmin From console:

sudo apt-get install phppgadmin

Remote access

By default you can only access phppgadmin from localhost. If you want to be able to use it remotely, do the following:

sudo nano /etc/apache2/conf.d/phppgadmin

Comment out (add # at beginning of line) “allow from ::1/128” and remove # from the line below it, “allow from all”.

Then restart apache

sudo service apache2 reload