Last active
January 8, 2019 16:14
-
-
Save vubon/568af244ba56bd7500b36cfb43406f45 to your computer and use it in GitHub Desktop.
Install PostgreSQL in Ubuntu 16.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Update your apps by below command and install | |
$ sudo apt-get update | |
$ sudo apt-get install postgresql postgresql-contrib | |
#Connect to PostgreSQL | |
$ sudo su - postgres | |
$ psql | |
#Checking connection with user information | |
postgres-# \conninfo | |
#Leave the connection | |
postgres-# \q | |
Now Install a web interface admin for the PostgreSQL database. It is called phpPgAdmin . | |
Firstly run this command | |
$ sudo apt-get update | |
Then | |
$ sudo apt-get install phppgadmin | |
For accessing the interface | |
http://localhost/phppgadmin hit on your browser :P | |
Now you need to password and username for login purpose :D | |
So your default username is postgres now need to add a password for security purpose. let's create a password | |
for creating password you need to run below commands step by step | |
#Connect to PostgreSQL | |
$ sudo su - postgres | |
$ psql | |
Now enter below command | |
\password postgres | |
you will see like this | |
Enter your new password and enter again your password . Hope you can understand what you need to do now . :P | |
and finlly logout from the connection . | |
Now you need to edit two files of PostgreSQL . | |
One is called phppgadmin.conf . You can find this file on this path | |
/etc/apache2/conf-available/phppgadmin.conf | |
Now you need to do below task . | |
One put a comment on Require local (you can comment the text by using #) | |
and add this code below the Require local text | |
order deny,allow | |
deny from all | |
allow from 127.0.0.0/255.0.0.0 ::1/128 | |
Another file is called config.inc.php . You can find this file on etc/phppgadmin/config.inc.php | |
Now edit the file and find the below line | |
$conf['extra_login_security'] = true; | |
replace the true to false . then you can access the postgresql server by phppgadmin :D | |
By the way lastly you should restart the appach server by this command | |
$ sudo service apache2 reload | |
That's all my friends :D | |
Happy Coding | |
Source: 1. https://tecadmin.net/install-postgresql-server-on-ubuntu/# | |
2. https://www.howtoforge.com/tutorial/ubuntu-postgresql-installation/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment