Install PostgreSQL 9.1.4 from centos6 source code

Source: Internet
Author: User

In Linux, I like source code installation. I personally feel that he will not lose all files.

Step 1: Download the source code package

: Http://ftp.postgresql.org/pub/source/v9.1.4/postgresql-9.1.4.tar.gz

If you need to install another version, you can go to http://www.postgresql.org/ftp/source/

Step 2: preparations before installation

Yum install-y zlib-devel Readline-devel

Step 3: decompress and compile

Tar-zxvf postgresql-9.1.4.tar.gz

CD postgresql-9.1.4

./Configure (add-H to the end to display the supported parameters)

Make & make install

Step 4: Add PostgreSQL users and initialize data

Useradd PostgreSQL

Su-PostgreSQL # switch to a PostgreSQL user

Passwd # Change User Password

Mkdir data # create a data directory

Chown-r PostgreSQL: PostgreSQL/usr/local/pgsql # It is installed in this directory by default after compilation, so the ownership of this directory is handed over to PostgreSQL

CD Data # enter the data directory

/Usr/local/pgsql/bin/initdb # Run the initialization script.

After completion, some PostgreSQL data and configuration files will be generated under the current directory.

Step 5: Set startup

Su # Switch to Super User

Cd ~ /Postgresql-9.1.4 # enter the source code folder, and decompress the source code folder

CP contrib/start-scripts/Linux/etc/init. d/PostgreSQL # Add the service script to init. d.

VI/etc/init. d/PostgreSQL # modify the data directory And change pgdata = "/usr/local/pgsql/Data" to pgdata = "/home/PostgreSQL/Data"

Chmod A + x/etc/init. d/PostgreSQL # Add execution permission

Chkconfig -- add PostgreSQL

Now you can use service PostgreSQL start to enable the postgresql service, and it will automatically start when it is started.

Step 6: the installation is successful.

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.