How to Install PostgreSQL and phpPgAdmin in Ubuntu
To Install PostgreSQL and phpPgAdmin in Ubuntu
PostgreSQL is a powerful high-performance, object-relational database management system (ORDBMS). It is well suited for large databases and has a quite large advanced features. It supports many OS that includes Linux, FreeBSD, Solaris and Microsoft Windows.
PhpPgAdmin is a PHP-based web application, used for managing PostgreSQL databases. It is easy to create a database, create a role and create tables in Postgres.
In this tutorial will learn how to install PostgreSQL and phpPgAdmin in Ubuntu.
To install PostgreSQL, phpPgAdmin and Apache2
PostgreSQL and PhpPgAdmin are available in the Ubuntu repository, just install them by using the following command.
root@linuxhelp:~# apt-get install postgresql postgresql-contrib phppgadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
apache2 apache2-bin apache2-data apache2-utils javascript-common libapache2-mod-php libapache2-mod-php7.0
libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libjs-jquery liblua5.1-0 libphp-adodb libpq5
php-common php-pgsql php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-pgsql php7.0-readline
postgresql-9.5 postgresql-client-9.5 postgresql-client-common postgresql-common postgresql-contrib-9.5
postgresql-doc postgresql-doc-9.5 sysstat
Suggested packages:
.
.
.
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.3) ...
To configure PostgreSQL user, Apache
Now its time to start PostgreSQL. Set the database and database username as and like Unix. To do so, login to the " postgres" account by running the following command.
root@linuxhelp:~# su &ndash postgres
Now you can access the PostgreSQL prompt with the command.
postgres@linuxhelp:~$ psql
psql (9.5.4)
Type " help" for help.
postgres=#
Execute the following command to change the password for postgres.
postgres=# password postgres
Enter new password:
Enter it again:
postgres=#
Then enter q to leave the psql command line.
postgres=# q
Leave the postgres user to switch over as root user.
postgres@linuxhelp:~$ exit
logout
To configure the Apache for phpPgAdmin, edit the phppgadmin.conf as shown below.
root@linuxhelp:~# cd /etc/apache2/conf-available/ root@linuxhelp:/etc/apache2/conf-available# vim phppgadmin.conf
Enter ' #' in front of the line ' Require local' and add the new line " allow from all" to access the browser.
To configure phpPgAdmin, edit the file /etc/phppgadmin/config.inc.php with the following command.
root@linuxhelp:/etc/apache2/conf-available# cd /etc/phppgadmin/
root@linuxhelp:/etc/phppgadmin# vim config.inc.php
Find the line $conf[' extra_login_security' ] = true and change the value to ' false' so that you can login to phpPgAdmin with user postgres.
Now its time to restart PostgreSQL and Apache2.
root@linuxhelp:/etc/phppgadmin# systemctl restart postgresql
root@linuxhelp:/etc/phppgadmin# systemctl restart apache2
Open the browser and enter http://yourip/phppgadmin/ to access phppgadmin.
Login with user postgres and password.
Now its time to create a database, a role and tables in Postgres.
Comments ( 0 )
No comments available