Ubuntu14.04 install PostgreSQL9.2

Source: Internet
Author: User
Tags psql
I. Environment vmvm NAME = "Ubuntu" VERSION = "12.04.4LTS, PrecisePangolin" II. Process 1. Install make. Do not install make now. # Apt-getinstallmake # make -- versionGNUMake3.81Copyright (C) 2006 FreeSoftwareFoundation

I. Environment

Vmvm

NAME = "Ubuntu"
VERSION = "12.04.4 LTS, Precise Pangolin"

Ii. Process

1. Install make. Do not install make now.

# Apt-get install make

# Make -- version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR
Particle PURPOSE.

This program built for i686-pc-linux-gnu

2. Get source code

However, there are ready-made binary installation packages and the installation methods are provided based on different systems. Http://www.postgresql.org/download/

The source code is obtained from git on File Browser or directly from the version control repository. The Operation Document installed with the source code is here. Http://www.postgresql.org/docs/current/static/installation.html

Open the ubuntu option page and take a look at what I said, http://www.postgresql.org/download/linux/ubuntu /. Ubuntu already contains PostgreSQL by default. Now you can use apt-get to install it. If the pgsql version on Ubuntu is not what you want, you can use PostgreSQL Apt repository to integrate the patch, and then the following is the basic operation steps, more Apt-related information see wiki, https://wiki.postgresql.org/wiki/Apt.

In wiki, PGDG is a group that supports APT repository maintenance. They are committed to building PostgreSQL server packages as well as extensions and modules packages on several Debian/Ubuntu releases for all PostgreSQL versions supported. PostgreSQL and its related packages are released for different releases. The following is a quick start installation step. Follow the wiki.

3. Install

Add source and update source

# Sudo sh-c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $ (lsb_release-cs)-pgdg main">/etc/apt/sources. list. d/pgdg. list'
# Apt-get update

PS: this variable can get the version code.
# Echo $ (lsb_release-cs)
Precise
# Cat/etc/apt/sources. list. d/pgdg. list
Deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main

After the source is updated, you can search for postgresql of each version. After reading about it, there are also 8.2 versions. The latest version is 9.5.

# Apt-cache search postgresql-| grep 'object-relational '| less
Postgresql-9.1-object-relational SQL database, version 9.1 server
Postgresql-8.4-object-relational SQL database, version 8.4 server
Postgresql-8.2-object-relational SQL database, version 8.2 server
Postgresql-8.3-object-relational SQL database, version 8.3 server
Postgresql-9.0-object-relational SQL database, version 9.0 server
Postgresql-9.2-object-relational SQL database, version 9.2 server
Postgresql-9.3-object-relational SQL database, version 9.3 server
Postgresql-9.4-object-relational SQL database, version 9.4 server
Postgresql-9.5-object-relational SQL database, version 9.5 server

Install and update wget and Certificate

# Sudo apt-get install wget ca-certificates
... Omitted...
Preparing to replace ca-certificates 20111211 (using.../ca-certificates_20141019ubuntu0.12.04.1_all.deb )...
Extracting the ca-certificates file used for replacement...
Preparing to replace wget 1.13.4-2ubuntu1 (using.../wget_1.13.4-2ubuntu1.2_i386.deb )...
Extracting and replacing the package file wget...
Processing the trigger for man-db...
Processing the trigger for install-info...
Setting ca-certificates (20151119ubuntu0. 12.04.1 )...
Updating certificates in/etc/ssl/certs... 38 added, 17 removed; done.
Running hooks in/etc/ca-certificates/update. d ...... done.
Setting wget (1.13.4-2ubuntu1. 2 )...

# Wget -- quiet-O-https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add-
OK


Install PostgreSQL, and install 9.2 first

# Sudo apt-get install postgresql-9.2
Reading the package list... complete
Analyzing the dependency tree of the software package
Reading status information... complete
The following additional software packages will be installed:
Libpq5 pgdg-keyring postgresql-client-9.2 postgresql-client-common postgresql-common ssl-cert
Recommended software packages:
Oidentd ident-server locales-all postgresql-doc-9.2 openssl-blacklist
The following [new] software packages will be installed:
Libpq5 pgdg-keyring postgresql-9.2 postgresql-client-9.2 postgresql-client-common postgresql-common ssl-cert
0 software packages have been upgraded, 7 new software packages have been installed, and 0 software packages have to be uninstalled. 140 software packages have not been upgraded.
Download the 4,663 kB software package.
After decompression, 22.6 MB of extra space is consumed.
...
The download process is omitted.
...
Setting libpq5 (9.4.4-1. pgdg12.4 + 1 )...
Setting pgdg-keyring (2014.1 )...
Removing apt.postgresql.org key from trusted. gpg: OK
Importing apt.postgresql.org key: OK
You are setting postgresql-client-common (169. pgdg12.4 + 1 )...
Setting postgresql-client-9.2 (9.2.13-1. pgdg12.4 + 1 )...
Update-alternatives:/usr/share/postgresql/9.2/man/man1/psql.1.gz is used to provide/usr/share/man/man1/psql.1.gz (psql.1.gz) in automatic mode.
Setting ssl-cert (1.0.28ubuntu0.1 )...
Setting postgresql-common (169. pgdg12.4 + 1 )...
Adding user defined s to group ssl-cert

Creating config file/etc/postgresql-common/createcluster. conf with new version

Creating config file/etc/logrotate. d/postgresql-common with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
En_us
Removing obsolete dictionary files:
* No PostgreSQL clusters exist; see "man pg_createcluster"
Setting postgresql-9.2 (9.2.13-1. pgdg12.4 + 1 )...
Creating new cluster 9.2/main...
Config/etc/postgresql/9.2/main
Data/var/lib/postgresql/9.2/main
Locale zh_CN.UTF-8
Port 5432
Update-alternatives:/usr/share/postgresql/9.2/man/man1/postmaster.1.gz is used to provide/usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in automatic mode.
* Starting PostgreSQL 9.2 database server [OK]
Processing the trigger for libc-bin...
Ldconfig deferred processing now taking place

4. configure remote access

After PostgreSQL is installed, the postgres user password on Ubuntu is unknown and the postgres password on the database is not set.

If you use root or allow sudo, you can directly Force Logon with the postgres user without knowing the postgres password.

Root # su ipvs
Postgres $ psql
Psql (9.2.13)
Enter "help" to obtain help information.

Postgres = #

(Non-root users are allowed to use sudo. Password-free is set here) $ sudo-u postgres psql
Psql (9.2.13)
Enter "help" to obtain help information.

Postgres = #

After logon, set a password for postgres of SQL.

Postgres # \ password postgres

Log out and find a directory. You need to modify two files, postgresql. conf and pg_assist.conf.

# Find/-name postgresql. conf
/Etc/postgresql/9.2/main/postgresql. conf
# Cd/etc/postgresql/9.2/main/
# L
Environment pg_ctl.conf pg_mirror.conf pg_ident.conf postgresql. conf start. conf

Postgresql. conf listens to all IP addresses, default ports, and enables log collection. A new log is generated every day, and many parameters that you don't know can be called.


Listen_addresses = '*' # what IP address (es) to listen on;
# Comma-separated list of addresses;
# Defaults to 'localhost'; use '*' for all
# (Change requires restart)
Port = 5432 # (change requires restart)
Logging_collector = on # Enable capturing of stderr and csvlog
# Into log files. Required to be on
# Csvlogs.
# (Change requires restart)
Log_directory = 'pg _ log' # directory where log files are written,
# Can be absolute or relative to PGDATA
Log_filename = 'postgresql-% Y-% m-% d _ % H % M % S. log' # log file name pattern,
# Can include strftime () escapes
Log_truncate_on_rotation = off # If on, an existing log file with
# Same name as the new log file will be
# Truncated rather than appended.
# But such truncation only occurs on
# Time-driven rotation, not on restarts
# Or size-driven rotation. Default is
# Off, meaning append to existing files
# In all cases.
Log_rotation_age = 1d # Automatic rotation of logfiles will
# Happen after that time. 0 disables.
Log_rotation_size = 0 # Automatic rotation of logfiles will
# Happen after that much log output.
#0 disables.

Add your own address to pg_mirror.conf, all of which are 0.0.0.0/0.

# IPv4 local connections:
Host all 127.0.0.1/32 md5
Host all 192.168.152.1/24 md5

Restart the postgresql service, and then set the address, port, user name, and password for pgAdminIII to connect.

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

Install PostgreSQL 6.3 http://www.linuxidc.com/Linux/2014-05/101787.htm in CentOS 9.3 environment yum

PostgreSQL cache detail http://www.linuxidc.com/Linux/2013-07/87778.htm

Windows platform compiling PostgreSQL http://www.linuxidc.com/Linux/2013-05/85114.htm

Configuration and installation http://www.linuxidc.com/Linux/2013-04/83564.htm of LAPP (Linux + Apache + PostgreSQL + PHP) Environment in Ubuntu

Install and configure the http://www.linuxidc.com/Linux/2011-08/40520.htm for phppgAdmin on Ubuntu

Install PostgreSQL9.3 http://www.linuxidc.com/Linux/2014-05/101723.htm on CentOS Platform

PostgreSQL configure Streaming Replication cluster http://www.linuxidc.com/Linux/2014-05/101724.htm

How to install PostgreSQL 7/6 and phpPgAdmin in CentOS 5/6. 4Http://www.linuxidc.com/Linux/2014-12/110108.htm

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

PostgreSQL details: Click here
PostgreSQLOf: Click here

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-09/123109.htm

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.