Download and offline installation of postgresql14

Download address: Index of /pub/

Then according to your method, it is generally divided into two types: compilation and installation and rpm package installation. I won’t go into details about the installation of windows. After downloading the installation package, the next step is just the next step.

The first rpm package installation method

I use the newer 14.3-1 version as an example, and find the corresponding rpm package to download according to the server's kernel. My system is arm architecture and the system is centos7, so the corresponding download is pub/repos/yum/14/redhat/rhel- The installation package under the 7-aarch64/ directory.

postgresql14-libs-14.3-1PGDG.rhel7.aarch64.rpm

postgresql14-14.3-1PGDG.rhel7.aarch64.rpm

postgresql14-server-14.3-1PGDG.rhel7.aarch64.rpm

Then install libs, PGDG, and server in sequence. After the installation is complete, find the configuration according to the default directory and modify it.

Installation commands such as: rpm -ivh postgresql14-libs-14.3-1PGDG.rhel7.aarch64.rpm --nodeps --force

After the installation is complete, check whether it is installed rpm -qa |grep postgresql

Modify the configuration file, there are two configurations that need to be modified postgresql.conf and pg_hba.conf

#Default postgreql is installed in /usr/pgsql-14, data storage directory: /var/lib/pgsql/14/data

vi /var/lib/pgsql/14/data/postgresql.conf

#Modify listen_addresses = '*'
vi /var/lib/pgsql/14/data/pg_hba.conf 
#Add a line 
host all all 0.0.0.0/0 password

then reboot

systemctl restart postgresql-14 

Then restart and try to connect with the tool.

The installation method of the second code compilation

Resource file download address:  Index of /pub/source/v14.3/

Upload the compressed package postgresql-14.3.tar.gz #Decompression: to the specified directory I put it under /ust/local/src

tar -xzvf /usr/local/src/postgresql-14.3.tar.gz -C /usr/local/src

compile & install

cd /usr/local/src/postgresql-14.3

./configure --prefix=/usr/local/postgresql-14.3 --without-readline --without-zlib

make && make install

It takes a long time, so be patient. The successful prompt is as follows (the version of the picture is 12.3): 

Create database directory and log directory

/usr/local/postgresql-14.3/bin/initdb -D /usr/local/postgresql-14.3/data

Initialize the database

/usr/local/postgresql-142.3/bin/initdb -D /usr/local/postgresql-14.3/data

The start after the start database command can be replaced by

/usr/local/postgresql-14.3/bin/pg_ctl -D /usr/local/postgresql-14.3/data -l /usr/local/postgresql-14.3/log/pgsql.log start

Then you need to configure data and create users

/usr/local/postgresql-14.3/bin/createuser -s -d -P postgre

Enter password for new role:

Enter it again:

Enter the password twice in succession:

Modify the configuration file to achieve remote access:

vi /usr/local/postgresql-14.3/data/postgresql.conf

Make the following changes:

#listen_addresses= 'localhost' remove the comment and change to listen_addresses = '*'

#password_encryption= md5 Remove the comment and change to password_encryption = md5

max_connections = 100 changed to max_connections = 1000

Modify the accessible user ip segment

vi /usr/local/postgresql-14.3/data/pg_hba.conf

Add a line at the end:

host    all             all             0.0.0.0/0               trust

Restart the database service to make the configuration take effect:

This command is one line

/usr/local/postgresql-14.3/bin/pg_ctl -D /usr/local/postgresql-14.3/data -l /usr/local/postgresql-14.3/log/pgsql.log  restart

The pgsql deployed by this method is relatively green version, basically deleting /usr/local/postgresql-14.3 is equivalent to assisting this installation.

Guess you like

Origin blog.csdn.net/wangzhi291/article/details/125488808