Install the open source database PostgreSQL 9.4 and phpPgAdmin on Ubuntu

Source: Internet
Author: User
Tags psql postgres createdb

Install the open source database PostgreSQL 9.4 and phpPgAdmin on Ubuntu
Introduction

phppgadmin postgresql 11

PostgreSQL is a powerful, pgbouncer in postgresql open-source, and Object-based relational database system. It supports all mainstream operating systems, including Linux, Unix (AIX, BSD, HP-UX, sgi irix, Mac OS, Solaris, Tru64) and Windows operating systems.

The following is an evaluation of PostgreSQL by Mark Shuttleworth, the initiator of Ubuntu.

PostgreSQL is a superb database system. When we first used it on Launchpad, we were not sure whether it was competent. But I am wrong. It is strong, fast, postgresql varchar or text and professional in all aspects.

-Mark Shuttleworth.

postgresql update inner join

In this short guide,postgresql synchronous_commit  let's take a look at how to install PostgreSQL 15.10 on the Ubuntu 9.4 server.

 postgresql ui

Install PostgreSQL
PostgreSQL is available in the default repository. Enter the following command in the terminal to install it.

sudoapt-get install postgresql postgresql-contrib
If you need other versions, add the PostgreSQL repository as follows and then install it.

postgresql varchar or text

The PostgreSQL apt repository supports long-term Ubuntu support (10.04, 12.04, and 14.04) for the amd64 and i386 architectures and non-long-term support (14.04 ). This software package does not fully support other non-long-term support versions, but it works normally even if it is similar to the LTS version.
postgresql tutorial pdf
 

Ubuntu 14.10 system:
Create a file/etc/apt/sources. list. d/pgdg. list;

sudovi/etc/apt/sources.list.d/pgdg.list
Use the following line to add a repository:

deb http://apt.postgresql.org/pub/repos/apt/ utopic-pgdg main
Note: The above library can only be used for Ubuntu 14.10. You have not upgraded to Ubuntu 15.04 or 15.10.

For Ubuntu 14.04, add the following line:

deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main
For Ubuntu 12.04, add the following line:

deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
Import signature key:

wget--quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc
sudo apt-key add -
Update the package list:

sudoapt-get update
Then install the required version.

sudoapt-get install postgresql-9.4
 

Access the PostgreSQL command window
The default database name and database user name are both "postgres ". Switch to S to perform postgresql-related operations:

sudo-u postgres psql postgres
 

Sample output:
psql (9.4.5)
Type"help"for help.
postgres=#
To exit the postgresql window, enter \ q In the psql window to exit the terminal.

Set "s" User Password
Log on to the postgresql window,

sudo-u postgres psql postgres
Run the following command to set the password for postgres:

postgres=# \password postgres
Enternew password:
Enter it again:
postgres=# \q
To install the PostgreSQL Adminpack extension, enter the following command in the postgresql window:

sudo-u postgres psql postgres
postgres=# CREATE EXTENSION adminpack;
CREATE EXTENSION
Enter \ q In the psql window and return it from the postgresql window to the terminal.

 

Create new users and databases
For example, let's create a new user named "senthil", the password is "ubuntu", and the database named "mydb.

sudo-u postgres createuser -D -A -P senthil
sudo-u postgres createdb -O senthil mydb
 

Delete users and databases
To delete a database, first switch to postgres User:

sudo-u postgres psql postgres
Enter the following command:

$ drop database <database-name>
To delete a user, enter the following command:

$ drop user <user-name>
 

Configure PostgreSQL-MD5 Verification
MD5 verification requires you to provide an MD5 encrypted password for authentication. First, edit the/etc/postgresql/9.4/main/pg_assist.conf file:

sudovi/etc/postgresql/9.4/main/pg_hba.conf
Add or modify rows as shown below

[...]
# TYPE DATABASE USER ADDRESS METHOD
#"local"isforUnix domain socket connections only
local all all md5
#IPv4local connections:
host all all 127.0.0.1/32 md5
host all all 192.168.1.0/24 md5
#IPv6local connections:
host all all ::1/128 md5
[...]
192.168.1.0/24 is the IP address of my local network. Replace it with your own address.

Restart the postgresql service to make the change take effect:

sudosystemctl restart postgresql
Or,

sudo service postgresql restart
 

Configuring PostgreSQL TCP/IP
By default, TCP/IP connections are not enabled, so users on other computers cannot access postgresql. To allow access by users on other computers, edit the file/etc/postgresql/9.4/main/postgresql. conf:

sudovi/etc/postgresql/9.4/main/postgresql.conf
Find the following line:

[...]
#listen_addresses ='localhost'
[...]
#port =5432
[...]
Uncomment the line, set the IP address of your postgresql server, or set it to '*' to listen to all users. You should be careful to set that all remote users can access PostgreSQL.

[...]
listen_addresses ='*'
[...]
port =5432
[...]
Restart postgresql to save the changes:

sudosystemctl restart postgresql
Or,

sudo service postgresql restart
 

Use phpPgAdmin to manage PostgreSQL
PhpPgAdmin is a PostgreSQL management tool written in PHP on the web.

PhpPgAdmin is available in the default repository. Run the following command to install phpPgAdmin:

sudoapt-get install phppgadmin
By default, you can access phppgadmin through http: // localhost/phppgadmin in the web browser of the local system.

To access the remote system, perform the following operations on Ubuntu 15.10:

Edit the/etc/apache2/conf-available/phppgadmin. conf file,

sudovi/etc/apache2/conf-available/phppgadmin.conf
Locate the line of Require local and add # comment out it before this line.

#Requirelocal
Add the following line:

allow from all
Save and exit the file.

Then restart the apache service.

sudosystemctl restart apache2
For Ubuntu 14.10 and earlier versions:

Edit/etc/apache2/conf. d/phppgadmin:

sudonano/etc/apache2/conf.d/phppgadmin
Comment out the following line:

[...]
#allow from127.0.0.0/255.0.0.0::1/128
Uncomment the following line so that all systems can access phppgadmin.

allow from all
Edit/etc/apache2/apache2.conf:

sudovi/etc/apache2/apache2.conf
Add the following line:

Include/etc/apache2/conf.d/phppgadmin
Then restart the apache service.

sudo service apache2 restart
 

Configure phpPgAdmin
Edit the/etc/phppgadmin/config. inc. php file and make the following changes. Most of the options below are explained. Read carefully to understand why you want to change these values.

sudonano/etc/phppgadmin/config.inc.php
Find the following line:

$conf['servers'][0]['host']='';
Follow these steps:

$conf['servers'][0]['host']='localhost';
Find this line:

$conf['extra_login_security']=true;
Change the value to false.

$conf['extra_login_security']=false;
Find this line:

$conf['owned_only']=false;
Change the value to true.

$conf['owned_only']=true;
Save and close the file. Restart the postgresql service and Apache service.

sudosystemctl restart postgresql
sudosystemctl restart apache2
Or,

sudo service postgresql restart
sudo service apache2 restart
Open your browser and navigate to http: // ip-address/phppgadmin. You will see the following.



PhpPgAdmin

Log On with the user you created earlier. I have already created a user named "senthil" with a "ubuntu" password. Therefore, I log on as a "senthil" user.



PhpPgAdmin

Then you can access the phppgadmin panel.



PhpPgAdmin

Log On with the postgres User:



PhpPgAdmin

That's it. Now you can use phppgadmin to visually create, delete, or change databases.

Come on!

------------------------------------ Lili split line ------------------------------------

Install the PostgreSQL 9.3.5 database in Ubuntu Server 14.04

Install PostgreSQL 6.3 on yum in CentOS 9.3

PostgreSQL cache details

Compiling PostgreSQL on Windows

Configuration and installation of LAPP (Linux + Apache + PostgreSQL + PHP) Environment in Ubuntu

Install and configure phppgAdmin on Ubuntu

Install PostgreSQL9.3 on CentOS

Configure a Streaming Replication cluster in PostgreSQL

How to install PostgreSQL 7/6 and phpPgAdmin in CentOS 5/6. 4

------------------------------------ Lili split line ------------------------------------

PostgreSQL details: click here
PostgreSQL: click here

Via: http://www.unixmen.com/install-postgresql-9-4-and-phppgadmin-on-ubuntu-15-10/

Author: SK Translator: ictlyh Proofreader: wxy

This article was originally compiled by LCTT and launched with the honor of Linux in China

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.