First, installation Preparation
Packages that need to be installed:
Yum Install postgresql95-devel-9.5.5-1pgdg.rhel6.x86_64.rpm
Documents can be downloaded from the official website. http://yum.postgresql.org/repopackages.php
Operating system:
CentOS Release 6.3 (Final)
If the Yum source is not correct during installation, be careful to adjust the RPM source as follows:
[email protected] yum.repos.d]# cat Pgdg-95-redhat.repo
[Pgdg95]
Name=postgresql 9.5 $releasever-$basearch
baseurl=https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-$releasever-$basearch
Enabled=1
Gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-pgdg-95
[Pgdg95-source]
Name=postgresql 9.5 $releasever-$basearch-source
Failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/9.5/redhat/rhel-$releasever-$basearch
Enabled=0
Gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-pgdg-95
Second, start the installation:
Yum Install postgresql95-devel-9.5.5-1pgdg.rhel6.x86_64.rpm
Yum Install Postgresql95-server Postgresql95-contrib
Third, initialize the database:
Mkdir-p/data/postgres/pgsql/data
Chown-r postgres.postgres/data/postgres/
(1) switch to Postgres user first
[Email protected] yum.repos.d]# Su-postgres
(2) If the initialization is successful, you will be prompted as follows:
-bash-4.1$/usr/pgsql-9.5/bin/initdb-d/data/postgres/pgsql/data
The files belonging to this database system is owned by user "Postgres".
This user must also own the server process.
The database cluster is initialized with locale "en_US. UTF-8 ".
The default database encoding have accordingly been set to "UTF8".
The default text search configuration is set to "中文版".
Data page checksums is disabled.
Fixing permissions on existing Directory/data/postgres/pgsql/data ... ok
Creating subdirectories ... ok
Selecting Default Max_connections ...
Selecting Default Shared_buffers ... 128MB
Selecting dynamic shared memory implementation ... POSIX
creating configuration files ... ok
Creating temp Late1 database in/data/postgres/pgsql/data/base/1 ... ok
initializing Pg_authid ... ok
initializing dependencies ... ok
Creating system views ... ok
loading system objects ' descriptions ... ok
Creating collations ... ok
cre ating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
Creating info Rmation schema ... ok
loading pl/pgsql server-side language ... ok
vacuuming database template1 ... ok
copying te Mplate1 to template0 ... ok
copying template1 to Postgres ... ok
syncing data to disk ... ok
Warning:enabling "Trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option-a, or
--auth-local and--auth-host, the next time you run INITDB.
Success. You can now start the database server using:
/usr/pgsql-9.5/bin/pg_ctl-d/data/postgres/pgsql/data-l logfile Start
-bash-4.1$
Iv. Start the database:
$/usr/pgsql-9.5/bin/pg_ctl-d/data/postgres/pgsql/data-l/tmp/postrest.log start
Server starting
V. Create a DB
Createdb Mysql2gp_sy
Vi.. Login database:
$ psql-h 127.0.0.1-d mysql2gp_sy-u Postgres
Psql (9.5.6)
Type ' help ' for help.
mysql2gp_sy=#
At this point, the installation succeeds.
Installing postgresql9.5 in CentOS 6.3