• 카테고리

    질문 & 답변
  • 세부 분야

    데브옵스 · 인프라

  • 해결 여부

    미해결

macOS Monterey 12.1 에서 Vagrant 설치 오류 해결한 방법 적습니다.

22.01.29 00:21 작성 조회수 468

0

  • Mac OS Monterey 12.1 에서 서버 구축 스크립트가 정상적으로 실행 안되는 문제가 있음
    • Mac Os Monterey 12.1에서 Virtual Box의 Headless 설정 불가능
      • Vagrantfile에서 v.gui = true 로 수정
    • 반드시 6.1.30 이상의 VirtualBox를 설치 할 것.
      • v.gui = true 수정 시 Virtual Box의 Verision이 6.1.30 이하라면 Mac이 알수 없는 오류로 재시작 됨.
    • 손쉬운 사용에 VirtualBox 권한을 추가할 것
      • 시스템 환경설정 → 보안 및 개인 정보 보호 → 손쉬운 사용 오른쪽에 VirtualBox를 추가 할 것

https://superuser.com/questions/1683747/vagrant-virtualbox-not-working-after-upgrading-to-monterey

https://www.virtualbox.org/ticket/20636

 


Mac OS Monterey 12.1

VirtualBox 6.1.32

vagrant 2.2.14

 

이거 실행 시키느라 하루종일 삽질해서 다른분들은 그러지 마시라고 올립니다.

 

 환경이 달라서 안될 수 도 있는데 저는 이렇게 겨우 작동시켰네요.

이제 다시 수업들으러 갑니다.

 

답변 5

·

답변을 작성해보세요.

1

자동으로 환경을 구축하는 스크립트가 주변환경의 버전이 바뀌면서 맞지 않아 문제가 생기는 것 같습니다. 
질문의 문제는 각 리눅스(cent1-3)의 ip address가 설정이 안된 것이 원인으로 생기는 문제입니다. 
각 서버에 접속하셔서 아래 파일에 고정IP를 설정 해 주세요. 
/etc/sysconfig/network-scripts/ifcfg-디바이스명

IP정보는 다음과 같습니다.
Cent1 : 172.181.91
Cent2 : 172.181.92
Cent3 : 172.181.93

최근 설치문제가 많이 발생하여 이를 해결할 방법을 찾고 있으니 조금만 기다려주세요.  ㅠㅠ
김진님의 프로필

김진

질문자

2022.02.09

 

답변해주신 내용대로

Cent1~3 에 접속해서 확인해 보니

 

/etc/sysconfig/network-scripts/

 

하위에 아래와 같은 파일들이 있는데요.

 

ifcfg-ens3  ifcfg-eth0  ifcfg-eth1  ifcfg-eth2

 

이중 어떤것을 변경해야 하는지요.

 

 

 

ifcfg-ens3 의 경우에는 아래와 같이 나옵니다

[root@cent3 network-scripts]# cat ifcfg-ens3 

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=dhcp

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=ens3

UUID=814f575f-6d69-42a1-a7da-3658c903dffa

DEVICE=ens3

 

ONBOOT=yes

 

 

 

 

ifcfg-eth0 의 경우에는

[root@cent3 network-scripts]# cat ifcfg-eth0

DEVICE="eth0"

BOOTPROTO="dhcp"

ONBOOT="yes"

TYPE="Ethernet"

 

PERSISTENT_DHCLIENT="yes"

 

 

 

 

 

그리고 ifcfg-eth1, ifcfg-eth2 내부에는 Vagrant에서 미리 설정해놓은 Ip들이 입력 되어 있습니다.

 

 

ifcfg-eth1

 

[root@cent3 network-scripts]# cat ifcfg-eth1

#VAGRANT-BEGIN

# The contents below are automatically generated by Vagrant. Do not modify.

NM_CONTROLLED=yes

BOOTPROTO=none

ONBOOT=yes

IPADDR=172.18.1.93

NETMASK=255.255.255.0

DEVICE=eth1

PEERDNS=no

#VAGRANT-END

 

 

ifcfg-eth2

 

[root@cent3 network-scripts]# cat ifcfg-eth2

#VAGRANT-BEGIN

# The contents below are automatically generated by Vagrant. Do not modify.

NM_CONTROLLED=yes

BOOTPROTO=none

ONBOOT=yes

IPADDR=10.18.1.93

NETMASK=255.255.255.0

DEVICE=eth2

PEERDNS=no

#VAGRANT-END

[root@cent3 network-scripts]# cat ifcfg-eth0

DEVICE="eth0"

BOOTPROTO="dhcp"

ONBOOT="yes"

TYPE="Ethernet"

PERSISTENT_DHCLIENT="yes"

어제 오후에 vagrant script를 수정해서 업데이트 했습니다. 

https://www.inflearn.com/news/438345

vagrant destroy로 cent[1-3]을 삭제하시고 새로 올린 vagrant script를 clone하신 후 vagrant up을 해 보세요. 

쉘스크립트 강좌이기 때문에 환경설정이 수업의 범위를 벗어나니 최대한 간단하고 쉽게 만들려고 준비를 했는데 오히려 그게 더 복잡하게 된 것 같습니다. 

이번엔 쉽게 구축이 될테니 가벼운 마음으로 재시도를 부탁드립니다.

김진님의 프로필

김진

질문자

2022.02.26

The IP address configured for the host-only network is not within the

allowed ranges. Please update the address used to be within the allowed

ranges and run the command again.

 

  Address: 172.18.1.91

  Ranges: 192.168.56.0/21

 

Valid ranges can be modified in the /etc/vbox/networks.conf file. For

more information including valid format see:

 

  https://www.virtualbox.org/manual/ch06.html#network_hostonly

 

 

오랜만에 댓글을 답니다

새로 받은 script를 적용 했는데 이런게 출력 됩니다

김진님의 프로필

김진

질문자

2022.02.26

vi /etc/vbox/networks.conf 해서 아래처럼 넣어주니까 되네요

 

* 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12

# * 0.0.0.0/0 ::/0

 

https://forums.virtualbox.org/viewtopic.php?f=7&t=104198

0

오늘 설치 후 ssh접속 이슈가 발생하여 추가로 답변 드립니다. 

id_rsa(개인키)파일에 특수공백문자가 들어갔을 가능성이 있어 로컬에서 ssh용 키를 생성해서 각 서버에 배포해주시는 것이 가장 빠를테니 다음 명령어 순서대로 실행 해 주세요. 

##0 config 퍼미션 변경
# cent[1-3]에 각각 접속해서
chmod 644 /root/.ssh/config

##1 Cent1에 접속해서 기존 인증키 삭제 vagrant ssh cent1 sudo su - rm -f /root/.ssh/id_rsa /root/.ssh/authorized_keys ##2 SSH에서 사용 할 인증 키 생성 ssh-keygen -t rsa # 이후 나오는 메세지 전부 엔터 ls -al # id_rsa, id_rsa.pub 파일이 생성된 것을 확인 ##3 public key를 cent[2-3]에 등록 # cent1에서 public key 내용을 카피해서 cent[2-3]의 authorized_keys 파일에 등록 cat /root/.ssh/id_rsa.pub # 다른 터미널 창을 열어 cent2에 접속 vagrant ssh cent2 sudo su - rm -f /root/.ssh/id_rsa /root/.ssh/authorized_keys vi /root/.ssh/authorized_keys # cent1에서 카피한 퍼블릭키를 붙여넣고 저장(:wq) # 퍼미션 설정 chmod 644 /root/.ssh/authorized_keys ##4 private key를 cent[2-3]에 등록 # cent1 에서 private key 내용을 카피해서 cent[2-3]의 id_rsa 파일에 등록 cat /root/.ssh/id_rsa # cent2에서 id_rsa를 생성 vi /root/.ssh/id_rsa # cent1에서 카피한 내용을 붙여넣고 저장(:wq) # 퍼미션 설정 chmod 600 /root/.ssh/id_rsa # cent3에서 cent2와 동일하게 설정 ##5 ssh 접속 테스트 # cent1 에서 접속 ssh cent2 ssh cent3 # cent2에서 접속 ssh cent1 ssh cent3 # cent3에서 접속 ssh cent1 ssh cent2 # ssh 접속시 known host 등록은 yes를 입력

0

김진님의 프로필

김진

질문자

2022.02.04

진짜 쉽게 되는게 없네요.

 

2-2 강의를 듣는데

 

172.18.1.91 에 접속이 안되네요

 

 

그래서 vagrant에서 해당 ip가 설정 된건지 구글링 해서 좀 찾아봤는데

 

 

확인 결과 각 virtual machine의 Hostname의 주소가 VagrantFile에 설정해 놓으신

172.18.1.91~93 으로 설정이 안되어 있고

 

 

127.0.0.1 로 설정되어 있네요.

port번호만 다 다르고

 

그래서 http://127.0.0.1:2222/www/index.html 로 접속해 봤더니 webpage는 접근불가....

아...

해결 방법 없을까요?

 

https://ostechnix.com/how-to-find-vagrant-machine-ip-address-from-host/

 

 

 

user@AL01447243 VWS_vagrant_script % vagrant global-status

id       name   provider   state   directory                           

-----------------------------------------------------------------------

57a5cfb  cent1  virtualbox running /Users/user/VWS_vagrant_script      

7f41593  cent2  virtualbox running /Users/user/VWS_vagrant_script      

010ee1c  cent3  virtualbox running /Users/user/VWS_vagrant_script      

 

The above shows information about all known Vagrant environments

on this machine. This data is cached and may not be completely

up-to-date (use "vagrant global-status --prune" to prune invalid

entries). To interact with any of the machines, you can go to that

directory and run Vagrant, or you can use the ID directly with

Vagrant commands from any directory. For example:

"vagrant destroy 1a2b3c4d"

user@AL01447243 VWS_vagrant_script % vagrant ssh-config 57a5cfb

Host cent1

  HostName 127.0.0.1

  User vagrant

  Port 2222

  UserKnownHostsFile /dev/null

  StrictHostKeyChecking no

  PasswordAuthentication no

  IdentityFile /Users/user/VWS_vagrant_script/.vagrant/machines/cent1/virtualbox/private_key

  IdentitiesOnly yes

  LogLevel FATAL

 

user@AL01447243 VWS_vagrant_script % vagrant ssh-config 7f41593

Host cent2

  HostName 127.0.0.1

  User vagrant

  Port 2200

  UserKnownHostsFile /dev/null

  StrictHostKeyChecking no

  PasswordAuthentication no

  IdentityFile /Users/user/VWS_vagrant_script/.vagrant/machines/cent2/virtualbox/private_key

  IdentitiesOnly yes

  LogLevel FATAL

 

user@AL01447243 VWS_vagrant_script % vagrant ssh-config 010ee1c       

Host cent3

  HostName 127.0.0.1

  User vagrant

  Port 2201

  UserKnownHostsFile /dev/null

  StrictHostKeyChecking no

  PasswordAuthentication no

  IdentityFile /Users/user/VWS_vagrant_script/.vagrant/machines/cent3/virtualbox/private_key

  IdentitiesOnly yes

  LogLevel FATAL

0

김진님의 프로필

김진

질문자

2022.01.29

 

???

VirtualBox에서 cent1,  cent2, cent3 전부 지우고,

VWS 폴더에서 .vagrant 삭제

상위 폴더에서 .d.vagrant 삭제 

한 후 다시 vargrant up 으로 재생성하니 이제 정상적으로 생성됐습니다.

 

작동되므로 다시 강의들으러 갑니다.....

0

김진님의 프로필

김진

질문자

2022.01.29

다 된줄 알았는데....

vagrant ssh cent1 로 접속해 보면  강의에서 보여지는

      "이 서버는 학습용 가상회사인 Virtual Web Service Company의 서버입니다."

      "실습의 용이성을 위해 selinux와 iptables를 off 했습니다."

      "접속 후 sudo su - 커맨드를 실행하여 root 유저로 실습을 진행해 주세요."

Text는 안나오네요.

 

그리고 sudo su 적용하고 netstat -nlptu 입력해서 프로세스 상태 확인해보면

nginx 도 실행이 안되어있네요

 

하..