사용자 도구

사이트 도구


devops:vagrant

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
devops:vagrant [2023/02/03 13:10]
kwon37xi [명시적 username/password]
devops:vagrant [2024/01/03 16:56] (현재)
kwon37xi [Ubuntu 에 설치하기]
줄 4: 줄 4:
   * 개발 서버 환경 구축하기   * 개발 서버 환경 구축하기
   * [[https://github.com/boxcutter|Box Cutter - Community-driven templates and tools for creating cloud, virtual machines, containers and metal operating system environments]]   * [[https://github.com/boxcutter|Box Cutter - Community-driven templates and tools for creating cloud, virtual machines, containers and metal operating system environments]]
 +  * [[devops:multipass|Ubuntu Multipass]] Ubuntu 가상환경 설치 전용 Multipass
  
 ===== Install ===== ===== Install =====
줄 12: 줄 13:
   * 기본 Provider 지정. Default 설정을 해두면 ''%%--%%provider'' 옵션 불필요<code sh>   * 기본 Provider 지정. Default 설정을 해두면 ''%%--%%provider'' 옵션 불필요<code sh>
 export VAGRANT_DEFAULT_PROVIDER=virtualbox export VAGRANT_DEFAULT_PROVIDER=virtualbox
 +</code>
 +
 +===== 기본 provider 지정 =====
 +  * ''~/.bashrc'' 혹은 ''~/.config/environment.d/원하는파일'' 등의 방식으로 default provider 로 지정하기
 +<code>
 +export VAGRANT_DEFAULT_PROVIDER=libvirt
 +</code>
 +  * 실행 시점마다 지정
 +
 +<code>
 +vagrant up --provider=libvirt
 </code> </code>
 ===== libvirt ===== ===== libvirt =====
   * [[:libvirt|libvirt]]   * [[:libvirt|libvirt]]
 +  * [[https://app.vagrantup.com/boxes/search?page=1&provider=libvirt|libvirt boxes]]
 +  * [[https://vagrant-libvirt.github.io/vagrant-libvirt/|Quickstart - Vagrant Libvirt Documentation]]
   * [[https://github.com/vagrant-libvirt/vagrant-libvirt|vagrant-libvirt]]   * [[https://github.com/vagrant-libvirt/vagrant-libvirt|vagrant-libvirt]]
   * [[https://computingforgeeks.com/using-vagrant-with-libvirt-on-linux/|How to Use Vagrant with Libvirt on Linux - Computing for Geeks]]   * [[https://computingforgeeks.com/using-vagrant-with-libvirt-on-linux/|How to Use Vagrant with Libvirt on Linux - Computing for Geeks]]
   * [[https://blog.scottlowe.org/2017/12/06/using-vagrant-with-libvirt-on-fedora/|Using Vagrant with Libvirt on Fedora 27 - Scott's Weblog - The weblog of an IT pro focusing on cloud computing, Kubernetes, Linux, containers, and networking]]   * [[https://blog.scottlowe.org/2017/12/06/using-vagrant-with-libvirt-on-fedora/|Using Vagrant with Libvirt on Fedora 27 - Scott's Weblog - The weblog of an IT pro focusing on cloud computing, Kubernetes, Linux, containers, and networking]]
   * Linux 상에서  ''libvirt'' + [[:qemu|QEMU]]가 실행 성능이 더 좋다고함(거의 Native 수준).   * Linux 상에서  ''libvirt'' + [[:qemu|QEMU]]가 실행 성능이 더 좋다고함(거의 Native 수준).
-  * [[linux:arch|Arch Linux]] 에서 설치하기<code sh>+ 
 + 
 +==== Ubuntu 에 설치하기 ==== 
 +<code sh> 
 +sudo apt install libvirt-dev 
 +vagrant plugin install vagrant-libvirt 
 +</code> 
 +  * Ubuntu 용 ''vagrant'', ''vagrant-libvirt'' 패키지가 존재하지만 [[linux:linuxbrew|linuxbrew]]와 ruby 버전이 안 맞아 충돌하는 경우가 많아서 그냥 ''brew'' 의 ''vagrant'' 사용 
 +==== Arch Linux 에 설치 ==== 
 +  * [[linux:arch|Arch Linux]] 에서 설치하기 
 +<code sh>
 # libvirtd 는 ebtables, dnsmasq 가 떠있ᅟ는 상태에서 실행해야 함. # libvirtd 는 ebtables, dnsmasq 가 떠있ᅟ는 상태에서 실행해야 함.
 sudo pacman -S libvirt qemu ebtables dnsmasq sudo pacman -S libvirt qemu ebtables dnsmasq
줄 34: 줄 58:
 vagrant up --provider=libvirt vagrant up --provider=libvirt
 </code> </code>
- * [[https://superuser.com/questions/1063240/libvirt-failed-to-initialize-a-valid-firewall-backend|networking - libvirt: "Failed to initialize a valid firewall backend" - Super User]]+ 
 +  * [[https://superuser.com/questions/1063240/libvirt-failed-to-initialize-a-valid-firewall-backend|networking - libvirt: "Failed to initialize a valid firewall backend" - Super User]]
 ===== 기본 사용 ===== ===== 기본 사용 =====
   * 박스를 검색해서 찾은뒤 사용법을 따라하면 된다.   * 박스를 검색해서 찾은뒤 사용법을 따라하면 된다.
줄 56: 줄 81:
 vagrant ssh vagrant ssh
 </code> </code>
 +
 +===== 공유 폴더 / shared folder / synced folder =====
 +  * [[https://developer.hashicorp.com/vagrant/docs/synced-folders|Synced Folders | Vagrant | HashiCorp Developer]]
 +  * 기본적으로 Host의 ''Vagrantfile'' 있는 디렉토리가 Linux 가상머신의 ''/vagrant'' 디렉토리로 마운트 된다. 두 시스템간의 파일 공유는 해당 디렉토리를 사용하면 된다.
  
 ===== Box를 미리 받아두기 ===== ===== Box를 미리 받아두기 =====
줄 109: 줄 138:
   * 그래도 알고자 한다면 ''vagrant ssh'' 명령으로 자동 로그인이 되면 ''id'' 명령으로 id 를 확인하고, ''sudo passwd <id>'' 해주면 된다.   * 그래도 알고자 한다면 ''vagrant ssh'' 명령으로 자동 로그인이 되면 ''id'' 명령으로 id 를 확인하고, ''sudo passwd <id>'' 해주면 된다.
  
-==== 명시적 root 비번 지정 password ====+==== 명시적 username / password ====
 <code> <code>
-config.ssh.username = '원하는username'+config.ssh.username = '사용자명'
 config.ssh.password = '비번' config.ssh.password = '비번'
 config.ssh.insert_key = 'true' config.ssh.insert_key = 'true'
 </code> </code>
 +  * 만약 사용자명을 ''root'' 로 할 경우 ssh 를 root 로 접근가능하게 해줘야한다. box 내의 ''/etc/ssh/sshd_config''
  
 +<code>
 +PermitRootLogin yes
 +</code>
 ===== vagrant ubuntu ===== ===== vagrant ubuntu =====
   * https://app.vagrantup.com/ubuntu   * https://app.vagrantup.com/ubuntu
줄 122: 줄 155:
 ===== vagrant amazon-linux ===== ===== vagrant amazon-linux =====
   * https://app.vagrantup.com/bento/boxes/amazonlinux-2   * https://app.vagrantup.com/bento/boxes/amazonlinux-2
 +  * 기본 username/password : ''vagrant/vagrant''
  
 ===== 참조 ===== ===== 참조 =====
devops/vagrant.1675397402.txt.gz · 마지막으로 수정됨: 2023/02/03 13:10 저자 kwon37xi