Download Postgres Repository Metadata
First, Run the below command on a server that can connect to internet. This command download the latest postgres repository metadata information.
1 | yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm |
Then go to the below directory. You can found downloaded repository metadata.
1 2 | cd /etc/yum.repos.d/ ls -l |
Download RPM Packets
Then we must download the necessary rpm packets from the downloaded repo metadata with the help of the below command.
1 | sudo reposync -g -l -d -m --repoid=pgdg11 --newest-only --download-metadata --download_path=/pg_data/repopg11/ |
Then go to the relavant directory to see the repo.
1 2 | cd /pg_data/repopg11/ ls -l |
Create Repo Metadata Information
We must create the metadata with the below command.
1 | createrepo pgdg11/ |
Copy Repository to the Server that can not connect to internet
Then copy this repository to relavant server with scp. We use -r parameter to copy all content of directory.
1 | scp -r pgdg11 root@192.165.198.13:/etc/yum.repos.d/ |
Note: 192.165.198.13-> Server that can not connect to internet
Then go to the relavant server and /etc/yum.repos.d/ directory and create a repo file that includes the below content.
On the server that can not connect to internet
1 2 3 | cd /etc/yum.repos.d/ ll vi pgdg11.repo |
Content of repo file
1 2 3 4 5 | [OurRepo] name=PostgreSQL11 baseurl=file:///etc/yum.repos.d/pgdg11 enabled=1 gpgcheck=0 |
Press Esc and type :wq
(Save and exit)
Install PostgreSQL From Repo without Internet
Run the below command to install PostgreSQL using OurRepo.
1 | yum install --disablerepo="*" --enablerepo=OurRepo postgresql11.x86_64 postgresql11-contrib.x86_64 postgresql11-devel.x86_64 postgresql11-libs.x86_64 postgresql11-server.x86_64 |
Then you must perform initdb operations. You can find detailed information about this operation in below articles. All operations are same.
How To Install PostgreSQL Replication On Centos,
How To Install PostgreSQL On centos/redhat
If you need upgrade operation you can use the below article.