I. Introduction
PostgreSQL is a very complex object-relational database management system (ORDBMS). It is also currently the most powerful, feature-rich and complex free software database system. Some features are not even available in commercial databases. This database research program originated from Berkeley (BSD) has now been developed into an international development project and has a wide range of users.
Ii. System Environment
System Platform: CentOS release 6.3 (Final)
PostgreSQL version: PostgreSQL 9.2.4
Firewall disabled/iptables: Firewall is not running.
SELINUX = disabled
Iii. Installation Method
A. download and install the RPM package
B. Install yum
C. Install the source code package
Iv. Installation Process
A. Install the RPM package
1. Check whether PostgreSQL has been installed
[root@TS-DEV ~]# rpm -qa|grep postgres[root@TS-DEV ~]#
If it has been installed, run the rpm-e command to uninstall it.
2. Download the RPM package
#wget http://yum.postgresql.org/9.2/RedHat/rhel-6-i386/postgresql92-server-9.2.4-1PGDG.rhel6.i686.rpm#wget http://yum.postgresql.org/9.2/redhat/rhel-6-i386/postgresql92-contrib-9.2.4-1PGDG.rhel6.i686.rpm#wget http://yum.postgresql.org/9.2/redhat/rhel-6-i386/postgresql92-libs-9.2.4-1PGDG.rhel6.i686.rpm#wget http://yum.postgresql.org/9.2/redhat/rhel-6-i386/postgresql92-9.2.4-1PGDG.rhel6.i686.rpm
3. Install PostgreSQL. Pay attention to the installation sequence.
# rpm -ivh postgresql92-libs-9.2.4-1PGDG.rhel6.i686.rpm
# rpm -ivh postgresql92-9.2.4-1PGDG.rhel6.i686.rpm
# rpm -ivh postgresql92-server-9.2.4-1PGDG.rhel6.i686.rpm
# rpm -ivh postgresql92-contrib-9.2.4-1PGDG.rhel6.i686.rpm
4. initialize the PostgreSQL database
Initialization is prompted when the PostgreSQL service is started for the first time.
# service postgresql-9.2 initdb
5. Start the service
# service postgresql-9.2 start
6. Add the PostgreSQL service to the startup list.
# chkconfig postgresql-9.2 on# chkconfig --list|grep postgres
7. Modify the PostgreSQL database user's postgres password (note that it is not a linux Account)
By default, PostgreSQL creates an ipvs database user as the database administrator. The default password is blank. We need to change it to the specified password, which is set to 'ipvs '.
# su - postgres$ psql# ALTER USER postgres WITH PASSWORD 'postgres';# select * from pg_shadow ;
8. Test the database
8.1 create a Test Database
# Create database david;
8.2 switch to the david Database
# \ C david
8.3 create a test table
david=# create table test (id integer,name text);
8.4 insert Test Data
david=# insert into test values (1,'david');INSERT 0 1david=#
8.5 select data
david=# select * from test ; id | name ----+------- 1 | david(1 row)david=#
The test is successful.
For more details, please continue to read the highlights on the next page:
PostgreSQL deletes duplicate data rows in a table
Establishment of PostgreSQL database connection pool PgBouncer
Compiling PostgreSQL on Windows
Notes on PostgreSQL backup
PostgreSQL details: click here
PostgreSQL: click here