Postgresql is installed on the CentOS server using

Source: Internet
Author: User
Tags postgresql centos server iptables

1Before you install PostgreSQL, verify that the Internet connection is working to download the installation files. Use Yum First-y update instructions to upgrade the system to the latest version. 2. Turn off Firewall service: #/etc/init.d/iptables Stop3Add user group, add user Groupadd postgres useradd postgres-g Postgres4New database execution file directory, new database data file directory mkdir-p/usr/local/pgsql mkdir-p/db/pgsql/Data5. Modify the directory owner Chown-R postgres/usr/local/pgsql/. Chown-R postgres/db/pgsql/Data Chown-R postgres/db/pgsql/data/.6. Editing path search Paths VI/etc/Profile adds the following two lines: PATH=/usr/local/pgsql/Bin: $PATH export PATH7. Effective path search Path source/etc/ Profile8. Install the tools and libraries that are required to compile the source Yum-y install wget gcc readline-devel zlib-devel Make9Enter the source tarball download directory, unzip the source package CD/usr/src tar jxvf./postgresql-9.2.4. tar.bz2TenEnter the extracted source directory and execute the compilation CD./postgresql-9.2.4Configure make make install One. Change login user, execute database initialization script Su-Postgres/usr/local/pgsql/bin/initdb--encoding=utf8-d/db/pgsql/Data A. Exit Change Login Exit -. Copy PostgreSQL execute script, increase execute privilege CP/usr/src/postgresql-9.2.4/contrib/start-scripts/linux/etc/init.d/PostgreSQL chmod+x/etc/init.d/PostgreSQL -. Edit PostgreSQL execution script, specify database file directory VI/etc/init.d/PostgreSQL PGDATA="/db/pgsql/data" the. Edit postgresql.conf Configuration VI/db/pgsql/data/postgresql.conf Configuration Content modified to: listen_addresses='*'# What IP address (es) to listen on; # comma-separated list of addresses; # defaults to'localhost'; Use'*'  forAll # (change requires restart) #port=5432# (change requires restart) -. Edit pg_hba.conf Configuration VI/db/pgsql/data/pg_hba.conf Configuration content is: # IPV4 local connections:host all127.0.0.1/ +Trust host All0.0.0.0/0Trust -. Modify the database password for the postgres user su postgres psql-U postgres Postgres=# ALTER USER Postgres PASSWORD'123456'; Postgres=# \q -. Restart the PostgreSQL Services service PostgreSQL restart or/etc/init.d/PostgreSQL Restart If the restart fails, start service server PostgreSQL startremark:
Netstat-TPNL |grep5432 //View Ports # /etc/init.d/iptables status

Postgresql is installed on the CentOS server using

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.