Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ PostgreSQL 9.4.3 Installation and Configuration under CentOS 6.5     - Oracle utilized undo data recovery operations (Database)

- Exploring the Android Listview display confusion (Programming)

- How to monitor Linux system performance Nmon (Linux)

- Linux PXE unattended installation PXE-E32: TFTP OPen timeout the solution (Linux)

- How to fix Ubuntu / Mint can not add PPA source of error (Linux)

- To install Oracle Database Details and FAQ Summary under CentOS (Database)

- Single-node Hadoop environment to build (Server)

- 10 Regulation of painless SQL Schema (Database)

- Linux Network Analysis Tcpdump Command Guide (Linux)

- A detailed introduction to the Hadoop ecosystem (Server)

- Installation under Linux Mint system guidelines for Gtk (Linux)

- tar decompression problems gzip: stdin: not in gzip format (Linux)

- How to install Go1.5 source development environment on Mac (Server)

- Virt Related Command Summary (Linux)

- Mybatis + binding Struts2: achieving user to insert and find (Programming)

- Oracle10g 64-bit installation solution in Windows 2008 Server R2 (Database)

- Linux Getting Started tutorial: XWindow what (Linux)

- RHEL6.5 replace local YUM source (Linux)

- Use PuTTY key authentication mechanism for remote login Linux (Linux)

- Oracle 11g RAC manually playing GI PSU patch (11.2.0.4.8) (Database)

 
         
  PostgreSQL 9.4.3 Installation and Configuration under CentOS 6.5
     
  Add Date : 2018-11-21      
         
         
         
  First, Introduction
PostgreSQL is a very complex object - relational database management system (ORDBMS), is currently the most powerful, richest and most complex feature of free software database system. Some properties even commercial databases do not have. This database research project originated in the Berkeley (BSD) is already derivatized to an international development projects, and has a very wide range of users.

Second, the system environment
Platform: CentOS release 6.5 (Final)
PostgreSQL version: PostgreSQL 9.4.3
Firewall off / iptables: Firewall is not running.
SELINUX = disabled
Third, the installation source
1. Download PostgreSQL Source Package
# Wget http://ftp.postgresql.org/pub/source/v9.4.3/postgresql-9.4.3.tar.bz2
2. Extract the source package
# Tar xjf postgresql-9.4.3.tar.bz2
3. Go to the unpacked directory
# Cd postgresql-9.4.3
4. Install dependencies
yum -y install gcc *
yum -y install readline-devel
5. Add the user to set a password
[Root @ postgresql ~] # adduser postgres
[Root @ postgresql ~] # passwd postgres
Changing password for user postgres.
New password:
BAD PASSWORD: it is too simplistic / systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
6. Start to compile and install the PostgreSQL database.
 [Root @ postgresql ~] # cd postgresql-9.4.3
[Root @ postgresql postgresql-9.4.3] # ./configure --prefix = / home / postgres / pgsql
 
[Root @ postgresql postgresql-9.4.3] # gmake
 
[Root @ postgresql postgresql-9.4.3] # gmake install
 
7. Set Environment Variables
[Root @ postgresql ~] # cd / home / postgres /
[Root @ postgresql postgres] # ls
pgsql
[Root @ postgresql postgres] # vi .bash_profile
The PATH = $ PATH: $ HOME / bin
Change the PATH = $ PATH: $ HOME / bin: / home / postgres / pgsql / bin
Save and exit.
Let environment variables to take effect:
Settings
[Root @ postgresql ~] # vi .bash_profile
The PATH = $ PATH: $ HOME / bin
Change the PATH = $ PATH: $ HOME / bin: / home / postgres / pgsql / bin
Save and exit.
Let environment variables to take effect:
[Root @ postgresql ~] # source .bash_profile
8. initialize the database
8.1 New Data directory
[Root @ postgresql ~] # mkdir / home / postgres / pgsql / data
8.2 Change Permissions
[Root @ postgresql ~] # chown postgres: postgres / home / postgres / pgsql / data
8.3 switch to the postgres user
[Root @ postgresql ~] # su - postgres
8.4 init db
[Postgres @ postgresql ~] $ / home / postgres / pgsql / bin / initdb -D / home / postgres / pgsql / data
Here the data initialization is completed
9. System Services
9.1 Back to the root user
[Postgres @ postgresql ~] $ exit
9.2 copy the installation directory of the linux file to /etc/init.d/
Enter postgresql installation directory (that is, just use the tar command to extract the directory)
[Root @ postgresql ~] # cd postgresql-9.4.3
[Root @ postgresql postgresql-9.4.3] # cp contrib / start-scripts / linux /etc/init.d/postgresql
9.3 modify /etc/init.d/postgresql Note: The red part is to modify
[Root @ postgresql postgresql-9.4.3] # vi /etc/init.d/postgresql
#! / Bin / sh
 
# Chkconfig: 2345 98 02
# Description: PostgreSQL RDBMS
 
# This is an example of a start / stop script for SysV-style init, such
# As is used on Linux systems. You should edit some of the variables
# And maybe the 'echo' commands.
#
# Place this file at /etc/init.d/postgresql (or
# /etc/rc.d/init.d/postgresql) And make symlinks to
# /etc/rc.d/rc0.d/K02postgresql
# /etc/rc.d/rc1.d/K02postgresql
# /etc/rc.d/rc2.d/K02postgresql
# /etc/rc.d/rc3.d/S98postgresql
# /etc/rc.d/rc4.d/S98postgresql
# /etc/rc.d/rc5.d/S98postgresql
# Or, if you have chkconfig, simply:
# Chkconfig --add postgresql
#
# Proper init scripts on Linux systems normally require setting lock
# And pid files under / var / run as well as reacting to network
# Settings, so you should treat this with care.
 
# Original author: Ryan Kirkpatrick < pgsql@rkirkpat.net>
 
# Contrib / start-scripts / linux
 
## EDIT FROM HERE
 
# Installation prefix
prefix = / home / postgres / pgsql
 
# Data directory
PGDATA = "/ home / postgres / pgsql / data"
# Who to run the postmaster as, usually "postgres". (NOT "root")
PGUSER = postgres
 
# Where to keep a log file
PGLOG = "$ PGDATA / serverlog"
 
# It's often a good idea to protect the postmaster from being killed by the
# OOM killer (which will tend to preferentially kill the postmaster because
# Of the way it accounts for shared memory). Setting the OOM_SCORE_ADJ value
# To -1000 will disable OOM kill altogether. If you enable this, you probably
# Want to compile PostgreSQL with "-DLINUX_OOM_SCORE_ADJ = 0", so that
# Individual backends can still be killed by the OOM killer.
# OOM_SCORE_ADJ = -1000
# Older Linux kernels may not have / proc / self / oom_score_adj, but instead
# / Proc / self / oom_adj, which works similarly except the disable value is -17.
# For such a system, enable this and compile with "-DLINUX_OOM_ADJ = 0".
# OOM_ADJ = -17
 
## STOP EDITING HERE
 
# The path that is to be used for the script
PATH = / usr / local / sbin: / usr / local / bin: / sbin: / bin: / usr / sbin: / usr / bin
 
# What to use to start up the postmaster. (If you want the script to wait
# Until the server has started, you could use "pg_ctl start -w" here.
# But without -w, pg_ctl adds no value.)
DAEMON = "$ prefix / bin / postmaster"
 
# What to use to shut down the postmaster
PGCTL = "$ prefix / bin / pg_ctl"
 
set -e
 
# Only start if we can find the postmaster.
test -x $ DAEMON ||
{
        echo "$ DAEMON not found"
        if [ "$ 1" = "stop"]
        then exit 0
        else exit 5
        fi
}
 
 
# Parse command line parameters.
case $ 1 in
  start)
        echo -n "Starting PostgreSQL:"
        test x "$ OOM_SCORE_ADJ"! = x && echo "$ OOM_SCORE_ADJ"> / proc / self / oom_score_adj
        test x "$ OOM_ADJ"! = x && echo "$ OOM_ADJ"> / proc / self / oom_adj
        su - $ PGUSER -c "$ DAEMON -D '$ PGDATA' &" >> $ PGLOG 2> & 1
        echo "ok"
        ;;
  stop)
        echo -n "Stopping PostgreSQL:"
        su - $ PGUSER -c "$ PGCTL stop -D '$ PGDATA' -s -m fast"
        echo "ok"
        ;;
  restart)
        echo -n "Restarting PostgreSQL:"
        su - $ PGUSER -c "$ PGCTL stop -D '$ PGDATA' -s -m fast -w"
        test x "$ OOM_SCORE_ADJ"! = x && echo "$ OOM_SCORE_ADJ"> / proc / self / oom_score_adj
        test x "$ OOM_ADJ"! = x && echo "$ OOM_ADJ"> / proc / self / oom_adj
        su - $ PGUSER -c "$ DAEMON -D '$ PGDATA' &" >> $ PGLOG 2> & 1
        echo "ok"
        ;;
  reload)
        echo -n "Reload PostgreSQL:"
        su - $ PGUSER -c "$ PGCTL reload -D '$ PGDATA' -s"
        echo "ok"
        ;;
status)
        su - $ PGUSER -c "$ PGCTL status -D '$ PGDATA'"
        ;;
  *)
        # Print help
        echo "Usage: $ 0 {start | stop | restart | reload | status}" 1> & 2
        exit 1
        ;;
esac
 
exit 0
 
9.4 add execute permissions
[Root @ postgresql postgresql-9.4.3] # chmod + x /etc/init.d/postgresql
 
9.5 Start the database
[Root @ postgresql postgresql-9.4.3] # /etc/init.d/postgresql start
Starting PostgreSQL: ok
Let the boot Database 9.6
[Root @ postgresql postgresql-9.4.3] # chkconfig --add postgresql
[Root @ postgresql postgresql-9.4.3] # chkconfig postgresql on
9.7 Creating a database operation history file
[Root @ postgresql postgresql-9.4.3] # touch /home/postgres/pgsql/.pgsql_history
[Root @ postgresql postgresql-9.4.3] # chown postgres: postgres /home/postgres/pgsql/.pgsql_history
10. Test Use
[Root @ postgresql postgresql-9.4.3] # su - postgres
[Postgres @ postgresql ~] $ createdb test
[Postgres @ postgresql ~] $ psql test
psql (9.4.3)
Type "help" for help.
test = #
 
Source compiler installation was successful.
     
         
         
         
  More:      
 
- Linux mention the right notes (Linux)
- Linux security settings Basics (Linux)
- Restore Oracle Database Cold backup and database reconstruction emca (Database)
- MySQL + Heartbeat + DRBD deployment architecture (Server)
- How to install Kernel 4.0.2 on CentOS 7 (Linux)
- DataGuard add temporary data files bug (Database)
- Some common Linux commands Study Notes (Linux)
- Based on a complete solution RMI service to transfer large files (Programming)
- CentOS 7 - use cgroups limit process resource (Linux)
- Use IP address spoofing Intrusion Prevention Firewall (Linux)
- MySQL Data Types (Database)
- Java application server WildFly (Server)
- Ubuntu Locale configuration problem solving Can not set LC_CTYPE (Linux)
- How to use the DM-Crypt encryption Linux File System (Linux)
- Linux environment to build next Cocos2dx-3.3.1 (Linux)
- SQL in the specific internal Oracle process (Database)
- LMMS 1.03 install on Ubuntu 14.04 (Linux)
- Mahout source code analysis: FP-Growth algorithm parallelization (Programming)
- Use Redis as time-series database: why and how (Database)
- Ubuntu Linux Change the PATH (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.