There are two installation methods for postgresql11: binary source code installation, rpm package installation
wget https: //ftp.postgresql.org/pub/source/v11.5/postgresql-11.5.tar.gz ./configure --prefix=/u01/pgsql make make install wget http://download.postgresql.org/pub/repos/yum/testing/11/redhat/rhel-6-x86_64/postgresql11-server-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-contrib-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-libs-11.5-1PGDG.rhel6.x86_64.rpm wget https://ftp.postgresql.org/pub/source/v11.5/postgresql-11.5.tar.gz ./configure --prefix=/u01/pgsql make make install wget http://download.postgresql.org/pub/repos/yum/testing/11/redhat/rhel-6-x86_64/postgresql11-server-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-contrib-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-libs-11.5-1PGDG.rhel6.x86_64.rpm rpm -ivh postgresql11-libs-11.5-1PGDG.rhel6.x86_64.rpm rpm -ivh postgresql11-11.5-1PGDG.rhel6.x86_64.rpm rpm -ivh postgresql11-contrib-11.5-1PGDG.rhel6.x86_64.rpm rpm -ivh postgresql11-server-11.5-1PGDG.rhel6.x86_64.rpm
However, you must first create users and groups and directories before installing in the above 2 method. Edit user environment variables. Strictly speaking, you also need to set sysctl.conf and limits.conf
groupadd postgres useradd -g postgres postgres passwd postgres mkdir -p /u01/pgsql chown -R postgres:postgres /u01/pgsql chmod -R 775 /u01/pgsql export PGHOME=/u01/pgsql export PGDATA=/u01/pgsql/data export PATH=$PATH:$HOME/bin:$PGHOME/bin
After the rpm installation is complete, you need to copy from the things under /usr/local/pgsql-11 to /u01/pgsql
Initialize initdb
Start postgresql pg_ctl start
Modify the network configuration file pg_hba.conf
host All all 192.168.20.0/24 Trust 192.168.20.0/24 It is not safe to configure it in production>
>Modify the main configuration file postgresql.conf
Listen_addresses = ‘192.168.20.202’
Port #port = 5432
wget https://ftp.postgresql.org/pub/source/v11.5/postgresql-11.5.tar.gz ./configure --prefix=/u01/pgsql make make install wget http://download.postgresql.org/pub/repos/yum/testing/11/redhat/rhel-6-x86_64/postgresql11-server-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-contrib-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-libs-11.5-1PGDG.rhel6.x86_64.rpm wget https://ftp.postgresql.org/pub/source/v11.5/postgresql-11.5.tar.gz ./configure --prefix=/u01/pgsql make make install wget http://download.postgresql.org/pub/repos/yum/testing/11/redhat/rhel-6-x86_64/postgresql11-server-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-contrib-11.5-1PGDG.rhel6.x86_64.rpm wget https://yum.postgresql.org/testing/11/redhat/rhel-6-x86_64/postgresql11-libs-11.5-1PGDG.rhel6.x86_64.rpm rpm -ivh postgresql11-libs-11.5-1PGDG.rhel6.x86_64.rpm rpm -ivh postgresql11-11.5-1PGDG.rhel6.x86_64.rpm rpm -ivh postgresql11-contrib-11.5-1PGDG.rhel6.x86_64.rpm rpm -ivh postgresql11-server-11.5-1PGDG.rhel6.x86_64.rpm
groupadd postgres useradd -g postgres postgres passwd postgres mkdir -p /u01/pgsql chown -R postgres:postgres /u01/pgsql chmod -R 775 /u01/pgsql export PGHOME=/u01/pgsql export PGDATA=/u01/pgsql/data export PATH=$PATH:$HOME/bin:$PGHOME/bin