PostgreSQL source installation on Linux

Source: Internet
Author: User
Tags bz2 postgresql readline

Download the source code and unzip
[[email protected] ~]# wget https://ftp.postgresql.org/pub/source/v9.4.0/postgresql-9.4.0.tar.bz2[[email protected] ~]# tar -xjvf postgresql-9.4.0.tar.bz2 [[email protected] ~]# cd postgresql-9.4.0
Start compiling the installation
[[email protected] postgresql-9.4.0]# ./configure ……checking for library containing shmget... none requiredchecking for library containing readline... noconfigure: error: readline library not foundIf you have readline already installed, see config.log for details on thefailure.  It is possible the compiler isn‘t looking in the proper directory.Use --without-readline to disable readline support.
Follow the error prompts to install the dependent packages in turn
[[email protected] postgresql-9.4.0]# yum install readline-devel[[email protected] postgresql-9.4.0]# yum install zlib-devel...
Go on
[[email protected] postgresql-9.4.0]# ./configure[[email protected] postgresql-9.4.0]# make……All of PostgreSQL successfully made. Ready to install.[[email protected] postgresql-9.4.0]# make install……PostgreSQL installation complete.
Add user
[[email protected] postgresql-9.4.0]# useradd postgres[[email protected] postgresql-9.4.0]# passwd postgresChanging password for user postgres.New password: BAD PASSWORD: it is based on a dictionary wordRetype new password: passwd: all authentication tokens updated successfully.
Set up Database cluster target folder.
[[email protected] postgresql-9.4.0]# mkdir /var/lib/pgsql/data -p[[email protected] postgresql-9.4.0]# chown -R postgres /var/lib/pgsql
environment variable Settings
Create DATABASE Cluster
Loading Pl/pgsql server-side language ... okthe files belonging to this database system would be owned by user "Postgres". T His 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/var/lib/pgsql/data ... okcreating Subdirectorie S ... okselecting default max_connections ... 100selecting Default Shared_buffers ... 128MBselecting Dynamic shared Memory implementation ... posixcreating configuration files ... okcreating template1 databas E in/var/lib/pgsql/data/base/1 ... okinitializing pg_authid ... okinitializing dependencies ... okcreating system views. .. Okloading system objects ' descriptions ... okcreating collations ... okcreating conversions ... okcreating dictionaries ... . Oksetting privileges on built-in objects ... okcreating information schema ... okloading pl/pgsql server-side language ... okvacuuming database template1 ... okcopying template1 to tem Plate0 okcopying template1 to Postgres ... oksyncing data to disk ... okwarning:enabling "Trust" Authentication for L Ocal connectionsyou can change this by editing pg_hba.conf or using the Option-a, or--auth-local and--auth-host, the NEX T time you run INITDB. Success. You can now start the database server using:/usr/local/pgsql/bin/postgres-d/var/lib/pgsql/dataor/usr/local/pgsql /bin/pg_ctl-d/var/lib/pgsql/data-l logfile Start
Start a DB instance

after setting the PGDATA environment variable, you can do so without the-D option

[[email protected] ~]$ pg_ctl start -l /var/lib/pgsql/pgsql.logserver starting
To close a DB instance
[[email protected] ~]$ pg_ctl stopwaiting for server to shut down.... doneserver stopped
Boot auto-start settings
[[email protected] postgresql-9.4.0]# vi /etc/rc.local…su - c ‘/usr/local/pgsql/bin/pg_ctl start -D /var/lib/pgsql/data -l /var/lib/pgsql/pgsql.log‘

PostgreSQL source installation on Linux

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.