ubuntu14.04 LTS Source compile and install PostgreSQL

Source: Internet
Author: User
Tags bz2 postgresql

First, the environment

ubuntu14.04

postgresql-9.4.3

Second, installation

1. Dependent Package Installation

sudo Install libperl-dev  python-dev libreadline-gplv2-dev Zlib1g-dev

2. Download PostgreSQL, compile and install

WGer https://ftp.postgresql.org/pub/source/v9.4.3/postgresql-9.4.3.tar.bz2tar -jxvf  postgresql-9.4. 3. tar. Bz2-c/usr/local/src/
./configure--prefix=/usr/local/postgresql-9.4. 3 --with-perl --with-pythonsudomakesudo make Install
cd/usr/local/sudoln -fs postgresql-9.4. 3/Pgsql

In the compilation installation path is the version number, plus the version number of the reason is for later upgrade convenience; If postgreSQL9.4.4 is released, you need to stop the existing database after compiling postgreSQL9.4.4, and then point the link/usr/local/pgsql /usr/local/postgresql-9.4.4.

3. Configure Environment variables

After the installation is complete, configure the path of the PostgreSQL executable file and the path of the shared library, the database directory

Export path=/usr/local/pgsql/bin: $PATHexport ld_library_path=/usr/local/pgsql/lib

If you want the above configuration to take effect for all users, you can add the above content to the/etc/profile file. If you want the above configuration to take effect for the current user, you can add the above content to the. bashrc file under Linux, and you can add it to the. profile file under other Unix.

4. Create a database cluster

Export pgdata=/data/PGDATA  #数据目录环境变量initdb

5. Install the tools under the contrib directory

CD postgresql-9.4. 3/contribmakesudomakeinstall

6. Start and stop the database

Pg_ctl start-d/data/pgdata  -d/dtat/pgdata

ubuntu14.04 LTS Source code compile and install PostgreSQL

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.