PostgreSQL simple installation manual under Linux

Source: Internet
Author: User
Tags postgresql

1. Installation Environment

Linux version: CentOS release 6.2 (Final)PG Version: postgresql-9.5.0

2. PG Database

--http://www.postgresql.org/ftp/source/

3. Installing dependent Packages

>yum Install gcc* >yum install readline-devel*

4. Installing Postgres  
1). Unzip the Tarball [email protected] software]# tar jxvf postgresql-9.5.0.tar.bz2   2). Go to the postgresql-9.5.0 folder [email protected] software]# CD postgresql-9.5.0 [[email protected] postgresql-9.5.0]# ls aclocal.m4 Configure contrib doc history Makefile src config configure.in COPYRIGHT gnumakefile.in INSTALL README   3). Compiling PostgreSQL source code [[email protected] postgresql-9.5.0]#./configure--prefix=/opt/pgsql--Installation path

Table 3-3 PostgreSQL Configuration script Options

Options Describe
–prefix=prefix Install to the directory pointed to by prefix; default to/usr/local/pgsql
–bindir=dir Install application to dir; default is Prefix/bin
–with-docdir=dir Install the document to Dir; default is Prefix/doc
–with-pgport=port Set the default server-side network connection service TCP port number
–with-tcl Provides TCL stored procedure support for the service side
–with-perl Provides Perl stored procedure support for the service side
–with-python Provide Python stored procedure support to the server
  [[email protected] postgresql-9.5.0]# make   [[email protected] postgresql-9.5.0]# make install   arrive at this step, will prompt you "PostgreSQL installation complete." OK

5. Create User Postgres

Groupadd-g 701 Postgres
 
 
6. Data Master directory for PostgreSQL database
This database home directory is different from the actual situation, where our home directory is in the/home/postgres/data directory: mkdir Data
Chown postgres:postgres Data

7. Configure Environment variables

 
VI. Bash_profile Add the following content: Export Pghome=/opt/pgsql Export Pgdata=/home/postgres/data export path= $PATH: $HOME/bin: $PGHOME/bin alias pg_start= "Pg_ctl start-l/home/postgres/log/pg_server.log" alias pg_stop= "Pg_ctl stop-l/home/postgres/log/pg_server.log"
8. Using the INITDB database at the beginning of use 
Initdb
9. Configure the service 
$ VI postgresql.conf Modify Content
listen_addresses = ' localhost,127.0.0.1,192.168.8.21 '
Port = 5432
password_encryption = On
#listen_addresses = ' localhost,127.0.0.1,168.8.21 ' can be written as Listen_addresses = ' * ' to monitor all networks
$ VI pg_hba.conf
find the bottom line so that people on the LAN can access
# IPV4 Local connections:
host All 127.0.0.1/32 Trust host All 192.168.1.0/16 Trust

10. Set up the PostgreSQL boot boot

PostgreSQL's boot-up script is located under the contrib/start-scripts path of the PostgreSQL source directory The Linux file is the startup script on the Linux system 1) Modify the Linux file properties and add the X attribute #chmod a+x Linux 2) Copy the Linux file to the/ETC/INIT.D directory and rename it to PostgreSQL #cp Linux/etc/init.d/postgresql 3) Modify the two variables of the/etc/init.d/postgresql file prefix installation path set to PostgreSQL:/opt/pgsql-9.1.2 pgdata Data Directory path set to PostgreSQL: 4) Set up PostgreSQL service to boot from #chkconfig--add PostgreSQL

11. View information

   --http://www.cnblogs.com/marsprj/archive/2013/02/08/2893519.html--http://postgres.cn/index.php/home
Author: li0924

Date: 2016-01-04

This article is copyrighted by the author, welcome reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original link.

PostgreSQL simple installation manual under Linux

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.