Ubuntu14.04 install PostgreSQL9.2

Source: Internet
Author: User
Tags psql
I. Environment vmvirtual machine NAMEUbuntuVERSION12.04.4LTS, PrecisePangolin II. Process 1. Install make. Do not install make now. # Apt-getin

I. Environment vmvirtual machine NAME = UbuntuVERSION = 12.04.4 LTS, Precise Pangolin II. Process 1. Install make. Do not install make now. # Apt-get in

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.

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.

Open the ubuntu option page to see what it says ,. 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 $ (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 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.

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.