가상 머신에 PostgreSQL을 설치하고 싶습니다.

가상 머신에 PostgreSQL을 설치하고 싶습니다.

2022-10-04 last update

5 minutes reading Yum Vagrant SSL 리포지토리 PostgreSQL

가상 환경 VirtualBox - Vagrant



vagrant init centos64 를 거쳐 vagrant up . 가상 머신에 연결 vagrant ssh .
 ruby, Ruby on rails, git을 가상 머신에 성공적으로 설치.
  다음으로 PostgreSQL의 버전을 확인.
[[email protected] ~]$ psql --version
-bash: psql: command not found

  거기서 PostgreSQL 설치를 시도했다.
[[email protected] ~]$ sudo yum install postgresql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/repodata/repomd.xml: [Errno 14] problem making ssl connection
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: pgdg95. Please verify its path and try again

  실패. problem making ssl connection 메시지에서 rhel (redhat) 리포지토리에 ssl connection가 실패한 것입니다.
 SSL 주위의 라이브러리의 업데이트( 오랜만에 로그인 한 서버에서 yum하면 epel 연결로 ssl 오류가 발생했기 때문에 대응 )가 필요라고 하는 조언을 질문 사이트에서 받았으므로 시험.
[[email protected] ~]$ sudo yum install -y nss
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/repodata/repomd.xml: [Errno 14] problem making ssl connection
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: pgdg95. Please verify its path and try again

  에러 내용 변함없이.
- 거기서, 일단 yum 의 인수에 --disablerepo=pgdg95 를 추가해, 이 리포지터리를 무시하도록 해 보세요.
[[email protected] ~]$ sudo yum install -y nss --disablerepo=pgdg95
(中略)
base      | 3.7 kB 00:00 #突破
extras    | 3.4 kB 00:00 
updates   | 3.4 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
(中略)
Dependencies Resolved
(中略)
Updated:
nss.x86_64 0:3.27.1-13.el6 
Dependency Updated:
nspr.x86_64 0:4.13.1-1.el6 nss-softokn.x86_64 0:3.14.3-23.3.el6_8 
nss-softokn-freebl.x86_64 0:3.14.3-23.3.el6_8 nss-sysinit.x86_64 0:3.27.1-13.el6 
nss-tools.x86_64 0:3.27.1-13.el6 nss-util.x86_64 0:3.27.1-3.el6 
Complete! #完了

Incredible! 좋아요. 이 상태로 갈 수 있을까?
[[email protected] ~]$ sudo yum install postgresql-server
(中略)
pgdg95         | 4.1 kB 00:00 #突破
pgdg95/primary_db  | 177 kB 00:01
Setting up Install Process
Resolving Dependencies
--> Running transaction check
(中略)
Dependencies Resolved
(中略)
Installed:
postgresql95-server.x86_64 0:9.5.6-2PGDG.rhel6 
Dependency Installed:
postgresql95.x86_64 0:9.5.6-2PGDG.rhel6 postgresql95-libs.x86_64 0:9.5.6-2PGDG.rhel6
Complete! #完了
[[email protected] ~]$ psql --version
psql (PostgreSQL) 9.5.6 #確認

Superb! 일건 낙착.

sudo yum install -y http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm  
sudo rpm -ivh http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm  
sudo yum install -y postgresql95 postgresql95-server postgresql95-contrib postgresql95-libs postgresql95-devel  
sudo rpm -i http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm  
sudo yum update  
sudo yum -y install postgresql96*  
sudo vi /etc/yum.repos.d/CentOS-Base.repo  
sudo yum -y localinstall   https://yum.postgresql.org/9.6/redhat/rhel-6.7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
sudo apt-get install postgresql  
wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm

1) 위와 같이 몇 가지 시도도 설치할 수 없습니다.
[[email protected] network-scripts]# vi ifcfg-eth0  
[[email protected] network-scripts]# vi ifcfg-eth1  
[[email protected] network-scripts]# vi ifcfg-lo

2) ~ 이러한 파일도 이상하지 않습니다 (no를 yes로 다시 쓸 수있는 것 같습니다).
3) PostgreSQL 사이트에서 rpm을 찾고,
$ yum localinstall https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm

와 직접 두드리는 + rpm을 PC로 다운로드하고 서버에 설치 후
$ yum localinstall pgdg-centos96-9.6-3.noarch.rpm
그렇다고해도 에러 내용 변함없이.

4) ~ 가상 환경에서 인터넷에 연결되어 있는지 확인.

  그러나, 이하는 이쪽과 가상 머신과의 통신의 확인이라고 생각된다.
[[email protected] ~]$ ip a  
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN  
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  
inet 127.0.0.1/8 scope host lo  
inet6 ::1/128 scope host  
valid_lft forever preferred_lft forever  
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000  
link/ether 08:00:27:62:52:b8 brd ff:ff:ff:ff:ff:ff  
inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0  
inet6 fe80::a00:27ff:fe62:52b8/64 scope link  
valid_lft forever preferred_lft forever  
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000  
link/ether 08:00:27:06:9f:0b brd ff:ff:ff:ff:ff:ff  
inet 192.168.78.90/24 brd 192.168.78.255 scope global eth1  
inet6 fe80::a00:27ff:fe06:9f0b/64 scope link  
valid_lft forever preferred_lft forever  
[[email protected] ~]$ ping -c4 192.168.78.90 PING 192.168.78.90 (192.168.78.90) 56(84) bytes of data.  
64 bytes from 192.168.78.90: icmp_seq=1 ttl=64 time=0.008 ms  
64 bytes from 192.168.78.90: icmp_seq=2 ttl=64 time=0.105 ms  
64 bytes from 192.168.78.90: icmp_seq=3 ttl=64 time=0.056 ms  
64 bytes from 192.168.78.90: icmp_seq=4 ttl=64 time=0.020 ms  
--- 192.168.78.90 ping statistics ---  
4 packets transmitted, 4 received, 0% packet loss, time 3001ms  
rtt min/avg/max/mdev = 0.008/0.047/0.105/0.038 ms