Install postgresql934 in source code and sql934 in source code

Source: Internet
Author: User
Tags psql

Install postgresql934 in source code and sql934 in source code
0
[Root @ pghost ~] # Uname-
Linux pghost 2.6.32-431. el6.x86 _ 64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[Root @ pghost ~] # Cat/etc/issue
CentOS release 6.5 (Final)
Kernel \ r on an \ m

1
Yum-y install readline-devel zlib-devel openssl-devel pam-devel libxml2-devel libxslt-devel python-devel tcl-devel gcc make flex bison perl-devel perl-ExtUtils *

2
Useradd S

3
Vi/home/postgres/. bash_profile
Export: PGPORT = 5432
Export PGDATA =/opt/pgsql9.3.4/pgdata
Export LANG = en_US.utf8
Export PGHOME =/opt/pgsql
Export LD_LIBRARY_PATH = $ PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/local/lib: $ LD_LIBRARY_PATH
Export PATH = $ PGHOME/bin: $ PATH :.
Export MANPATH = $ PGHOME/share/man: $ MANPATH
Export PGUSER = postgres
Export PGHOST = $ PGDATA

4
[Root @ pghost ~] # Cd/root/backup/
[Root @ pghost backup] # ll
Total 21356
-Rw-r --. 1 root 21865589 Sep 7 postgresql-9.3.4.tar.gz

[Root @ pghost backup] # tar-zxvf postgresql-9.3.4.tar.gz
[Root @ pghost backup] # ll
Total 21360
Drwxrwxrwx. 6 1107 1107 Mar 18 4096 postgresql-9.3.4

5
[Root @ pghost backup] # cd postgresql-9.3.4
[Root @ pghost postgresql-9.3.4] #. /configure -- prefix =/opt/pgsql9.3.4 -- with-pgport = 5432 -- with-perl -- with-tcl -- with-python -- with-openssl -- with-pam -- without-ldap -- with-libxml -- with-libxslt -- enable-thread-safety -- with-wal-blocksize = 8 -- with-blocksize = 8 & gmake world
...
...
Gmake [2]: Leaving directory '/root/backup/postgresql-9.3.4/contrib/xml2'
Gmake [1]: Leaving directory '/root/backup/postgresql-9.3.4/contrib'
PostgreSQL, contrib, and documentation successfully made. Ready to install.
[Root @ pghost postgresql-9.3.4] #
[Root @ pghost postgresql-9.3.4] # ll
Total 1448
-Rw-r --. 1 root 359981 Sep 19 :26 config. log
-Rwxr-xr-x. 1 root 39791 Sep 19 :26 config. status
-Rw-r --. 1 root 3618 Sep 19 :26 GNUmakefile
Drwxrwxrwx. 15 1107 1107 4096 Sep 19 src

6
[Root @ pghost postgresql-9.3.4] # gmake install-world
...
...
Gmake [2]: Leaving directory '/root/backup/postgresql-9.3.4/contrib/xml2'
Gmake [1]: Leaving directory '/root/backup/postgresql-9.3.4/contrib'
PostgreSQL, contrib, and documentation installation complete.
[Root @ pghost postgresql-9.3.4] #

7
[Root @ pghost postgresql-9.3.4] # ll/opt/
Total 8
Drwxr-xr-x. 6 root 4096 Sep 19 17:31 pgsql9.3.4
Drwxr-xr-x. 2 root 4096 Nov 22 2013 rh

[Root @ pghost postgresql-9.3.4] # ln-s/opt/pgsql9.3.4/opt/pgsql

[Root @ pghost postgresql-9.3.4] # ll/opt/
Total 8
Lrwxrwxrwx. 1 root 15 Sep 19 17: 33 pgsql->/opt/pgsql9.
Drwxr-xr-x. 6 root 4096 Sep 19 :31 pgsql9.3.4
Drwxr-xr-x. 2 root 4096 Nov 22 2013 rh
[Root @ pghost postgresql-9.3.4] #

[Root @ pghost postgresql-9.3.4] # ll/opt/pgsql9.3.4/
Total 16
Drwxr-xr-x. 2 root 4096 Sep 19 :31 bin
Drwxr-xr-x. 6 root 4096 Sep 19 17:31 include
Drwxr-xr-x. 4 root 4096 Sep 19 17:31 lib
Drwxr-xr-x. 8 root 4096 Sep 19 :31 share

8
[Root @ pghost ~] # Chown-R root: daemon/opt/pgsql9.3.4/
[Root @ pghost ~] # Ll/opt/
Total 8
Lrwxrwxrwx. 1 root 15 Sep 19 17: 33 pgsql->/opt/pgsql9.
Drwxr-xr-x. 6 root daemon 4096 Sep 19 :31 pgsql9.3.4
Drwxr-xr-x. 2 root 4096 Nov 22 2013 rh
[Root @ pghost ~] # Ll/opt/pgsql9.3.4/
Total 16
Drwxr-xr-x. 2 root daemon 4096 Sep 19 bin
Drwxr-xr-x. 6 root daemon 4096 Sep 19 include
Drwxr-xr-x. 4 root daemon 4096 Sep 19 17:31 lib
Drwxr-xr-x. 8 root daemon 4096 Sep 19 share

9
[Root @ pghost pgsql9.3.4] # mkdir pgdata
[Root @ pghost pgsql9.3.4] # chown postgres: S pgdata/
[Root @ pghost pgsql9.3.4] # ll
Total 20
Drwxr-xr-x. 2 root daemon 4096 Sep 19 bin
Drwxr-xr-x. 6 root daemon 4096 Sep 19 include
Drwxr-xr-x. 4 root daemon 4096 Sep 19 17:31 lib
Drwxr-xr-x. 2 postgres 4096 Sep 19 pgdata
Drwxr-xr-x. 8 root daemon 4096 Sep 19 share

10
[Root @ pghost postgresql-9.3.4] # su-postgres
[Postgres @ pghost ~] $ Initdb-D $ PGDATA-E UTF8 -- locale = C-U postgres-W
...
...
Syncing data to disk... OK


WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_0000.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:


Postgres-D/opt/pgsql9.3.4/pgdata
Or
Pg_ctl-D/opt/pgsql9.3.4/pgdata-l logfile start


[Postgres @ pghost ~] $

11
[Root @ pghost opt] # ll pgsql9.3.4/
Total 20
Drwxr-xr-x. 2 root daemon 4096 Sep 19 bin
Drwxr-xr-x. 6 root daemon 4096 Sep 19 include
Drwxr-xr-x. 4 root daemon 4096 Sep 19 :31 lib
Drwx ------. 15 postgres 4096 Sep 22 11: 51 pgdata
Drwxr-xr-x. 8 root daemon 4096 Sep 19 share


12
[Root @ pghost opt] # vi pgsql9.3.4/pgdata/pg_assist.conf
# IPv4 local connections:
Host all 0.0.0.0/0 md5


13
[Root @ pghost opt] # vi pgsql9.3.4/pgdata/postgresql. conf
Listen_addresses = '*'
# Listen_addresses = 'localhost'

Unix_socket_directories = '.'
# Unix_socket_directories = '/tmp'

Unix_socket_permissions = 0700
# Unix_socket_permissions = 0777

14
[Postgres @ pghost ~] $ Pg_ctl-D/opt/pgsql9.3.4/pgdata/-l/opt/pgsql9.3.4/pgdata/pg_log/startup. log start
Server starting
[Postgres @ pghost ~] $

[Postgres @ pghost ~] $ Ps-ef | grep postgres
Postgres 33829 1 0 00:00:00 pts/1/opt/pgsql9.3.4/bin/postgres-D/opt/pgsql9.3.4/pgdata
Postgres 33831 33829 0? 00:00:00 ipvs: checkpointer process
Postgres 33832 33829 0? 00:00:00 ipvs: writer process
Postgres 33833 33829 0? 00:00:00 ipvs: wal writer process
Postgres 33834 33829 0? 00:00:00 postgres: autovacuum launcher process
Postgres 33835 33829 0? 00:00:00 postgres: stats collector process
[Postgres @ pghost ~] $

15
[Root @ pghost ~] # Vi/etc/sysconfig/iptables
-A input-m state -- state NEW-m tcp-p tcp -- dport 5432-j ACCEPT
[Root @ pghost ~] #/Etc/init. d/iptables restart


16
[Root @ hostalonetest ~] #/Opt/PostgreSQL/9.3/bin/psql-h 192.168.19.77-Upostgres
Password for user postgres:
Psql. bin (9.3.5, server 9.3.4)
Type "help" for help.


Postgres = #


Reference: http://www.postgresql.org/docs/9.3/interactive/tutorial-install.html



-----------------

Please refer to the following source for reprinting:
Blog.csdn.net/beiigang

Kneel postgreSQL database Installer

Download is available here, and each version has
Www.postgresql.org/
Installation instructions: My students sorted out before. I don't know if the current version is applicable.

/*************************************** *********
This document describes how to install postgresql. If you use Windows, open the WordPad in linux.
Take postgresql-8.4.6 as an example, PS; installation process but prompt permissions are not enough, to the root user, re-execute the command can be, retried.
**************************************** **********/
First, we need to create an ipvs user. First, click the red hat in the lower left corner (or upper left corner to see where you are) (equivalent to the start of win ),
Manage --> users and groups
In the "Add User" dialog box, enter "postgres" as the user name.
Full name: PostgreSQL Server
Password: (enter one by yourself)
Main Directory:/var/lib/pgsql
Login:/bin/bash

1. Here we use the source code for installation. First, we obtain the source code. If not, we can download it at www.postgresql.org/download.

2. Here I will introduce how to decompress the compressed package with the extension name tar.bz2,
First, open the terminal in the directory where the current package is located and enter the command,
Bzip2-d postgresql-8.4.6.tar.bz2
Tar-xvf postgresql-8.4.6.tar

3. after the above command we get the PG source code folder, the default name is postgresql-8.4.6, enter this folder, we see some files and folders, open the terminal (right click to choose to call, or press the shortcut key F4). Below are some general procedures for installing the original code on Linux, which may be used in the future. Note that these three commands
./Configure
Make
Make install
Make install must be installed under the root user.
Therefore, the command su root is required and the password is entered.
After the installation is complete, restart the computer and log on to the system using ipvs.

4. After all the commands are executed, we will install PG. You can check the installation in the default installation directory,
The default directory is/usr/local/pgsql,
Here we need to create a folder for storing the database, open the terminal, and run the command under the root user, that is, first su root and then execute the following command.
Mkdir data
Chmod 777 data
Chown postgres data

5. Execute the command
/Usr/local/pgsql/bin/initdb-D/usr/local/pgsql/data
Complete the database initialization... the remaining full text>

Why linux cannot install the latest postgresql (postgresql-912targz) version)

You can choose to compile and install the source code:
1. Use the source code compilation method to install PostgreSQL under the root user
1. Extract
Tar jxvf postgresql-9.1.2.tar.bz2

2. Check the dependent Software Package
Rpm-qa | grep readline
Rpm-qa | grep zlib
Rpm-qa | grep gcc
Rpm-qa | grep make

3. If the dependent software package is missing, install the following Software Package
Gcc
Make
Zlib-devel
Readline-devel

4. Configure PostgreSQL
Cd postgresql-9.1.2
./Configure -- prefix =/usr/local/pgsql

5. Compile and install PostgreSQL
Make
Make install

6. Create a group and a user
Groupadd postgres
Useradd-g postgres
Passwd ipvs

7. Create a database file storage directory and grant permissions to ipvs:
Mkdir/usr/local/pgsql/data
Cd/usr/local/pgsql
Chown postgres. postgres data
Touch/var/log/pgsql. log
Chown S. postgres/var/log/pgsql. log

8. initialize the database directory (execute the command under postgres user)
Cd/usr/local/pgsql/
./Bin/initdb-E UTF-8-D/usr/local/pgsql/data -- locale = zh_CN.UTF-8

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.