내용으로 건너뛰기
권남
사용자 도구
로그인
사이트 도구
검색
도구
문서 보기
이전 판
역링크
최근 바뀜
미디어 관리자
사이트맵
로그인
>
최근 바뀜
미디어 관리자
사이트맵
추적:
devops:vagrant
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
====== Vagrant ====== * http://www.vagrantup.com/ * [[https://portal.cloud.hashicorp.com/vagrant/discover|Vagrant Box 검색]] * [[http://www.vagrantbox.es/|A list of base boxes for Vagrant - Vagrantbox.es]] * 개발 서버 환경 구축하기 * [[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 ===== * debian/ubuntu 은 https://www.vagrantup.com/downloads.html 에서 다운로드 하거나 ''vagrant'' 패키지를 설치하면 됨 * [[https://wiki.archlinux.org/index.php/Vagrant|Arch Linux Vagrant]]<code sh> sudo pacman -S vagrant </code> * 기본 Provider 지정. Default 설정을 해두면 ''%%--%%provider'' 옵션 불필요<code sh> 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> ===== 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://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]] * Linux 상에서 ''libvirt'' + [[:qemu|QEMU]]가 실행 성능이 더 좋다고함(거의 Native 수준). ==== 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 가 떠있ᅟ는 상태에서 실행해야 함. sudo pacman -S libvirt qemu ebtables dnsmasq # enable libvertd.servcie sudo systemctl enable --now libvertd.service # 플러그인 설치 vagrant plugin install vagrant-libvirt # 잘 설치됐는지 확인 vagrant plugin list # 실행시 --provider=libvirt 지정 vagrant up --provider=libvirt </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://app.vagrantup.com/ubuntu/boxes/trusty64|Ubuntu trusty 64bit]], [[https://app.vagrantup.com/debian/boxes/buster64|debian buster 64bit]] 띄우기<code> # vagrant 관련 설정을 넣어둘 디렉토리로 이동하여 Vagrantfile 생성 # for ubuntu vagrant init ubuntu/trusty64 # for debian vagrant init debian/buster64 # 띄우기 vagrant up # 종료 vagrant halt # 완전삭제 vagrant destroy </code> * SSH 접속<code sh> vagrant ssh </code> ===== 공유 폴더 / shared folder / synced folder ===== * [[https://developer.hashicorp.com/vagrant/docs/synced-folders|Synced Folders | Vagrant | HashiCorp Developer]] * 기본적으로 Host의 ''Vagrantfile'' 있는 디렉토리가 Linux 가상머신의 ''/vagrant'' 디렉토리로 마운트 된다. 두 시스템간의 파일 공유는 해당 디렉토리를 사용하면 된다. ===== Box를 미리 받아두기 ===== * [[https://gist.github.com/idecardo/deec25b8fa54976edb496d7ce7d320a7|Laravel Homestead Manual Installation]] <code sh> # 원하는 box를 다운로드 wget https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.5.0/providers/virtualbox.box # vagrant에 등록 vagrant box add laravel/homestead file:///c:/users/idecardo/downloads/virtualbox.box </code> ===== Hyper-V ===== * [[windows:hyper_v|Hyper-V]] Provider * https://www.vagrantup.com/docs/hyperv/ <code sh> # 관리자 권한으로 vagrant up --provider=hyperv </code> ===== vagrant-aws ===== * [[https://github.com/mitchellh/vagrant-aws|vagrant-aws]] * [[https://www.rapid7.com/blog/post/2017/05/31/devops-vagrant-with-aws-ec2-digital-ocean/|DevOps: Vagrant with AWS EC2 & Digital Ocean | Rapid7 Blog]] * vagrant 로 AWS EC2 인스턴스 제어 ===== 사설 인증서 오류 ===== * [[https://github.com/dkuhndba|Vagrant up - SSL certificate problem: self signed certificate in certificate chain · Issue #1106 · laravel/homestead]] box 다운로드시에 아래와 같은 오류가 발생한다면 실제로 문제가 없는지 확인하고 문제가 없는게 맞다면 <code sh> An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again. SSL certificate problem: self signed certificate in certificate chain </code> 먼저 다음과 같이 ''%%--insecure%%''로 box 를 받고나서 <code sh> vagrant box add --insecure ubuntu/jammy64 </code> 환경 구성을 한다. 혹은 ''Vagrantfile''에 다음과 같은 방식을 취한다. <code> config.vm.box_download_insecure = true </code> ===== Linux box 기본 username/password ===== * Linux box 의 기본 username/password 는 꼭 몰라도 된다. * ssh key 가 모두 설정되어 자동 로그인이 된다. * 그래도 알고자 한다면 ''vagrant ssh'' 명령으로 자동 로그인이 되면 ''id'' 명령으로 id 를 확인하고, ''sudo passwd <id>'' 해주면 된다. ==== 명시적 username / password ==== <code> config.ssh.username = '사용자명' config.ssh.password = '비번' config.ssh.insert_key = 'true' </code> * 만약 사용자명을 ''root'' 로 할 경우 ssh 를 root 로 접근가능하게 해줘야한다. box 내의 ''/etc/ssh/sshd_config'' <code> PermitRootLogin yes </code> ===== vagrant ubuntu ===== * https://app.vagrantup.com/ubuntu * 기본 username/password : ''vagrant/vagrant'' ===== vagrant amazon-linux ===== * https://app.vagrantup.com/bento/boxes/amazonlinux-2 * 기본 username/password : ''vagrant/vagrant'' ===== 참조 ===== * [[http://wiki.opencloudengine.org/pages/viewpage.action?pageId=2852295|Vagrant를 이용한 가상 환경 구축 - Realtime Stream - Open Cloud Engine WIKI]] * [[http://ppiazi.tistory.com/230|Vagrant - VirtualBox 가상머신 관리 도구 소개]] * [[http://www.slideshare.net/arawnkr/vagrant-chef|Vagrant와 chef로 개발서버 구축하기]] * [[http://bcho.tistory.com/806|Vagrant를 이용한 개발환경 관리(간단한 VM관리)]] * [[http://taewan.kim/post/vagrant_intro/|내 친구 Vagrant를 소개합니다.]] * [[https://fedoramagazine.org/vagrant-qemukvm-fedora-devops-sysadmin/|Installing and running Vagrant using qemu-kvm - Fedora Magazine]] * [[https://www.44bits.io/ko/post/vagrant-tutorial|베이그런트(Vagrant) 튜토리얼: 개발 환경 공유와 가상 머신 관리 도구 | 44BITS]] * [[https://superuser.com/questions/701735/run-script-on-host-machine-during-vagrant-up|Run script on host machine during vagrant up - Super User]]
devops/vagrant.txt
· 마지막으로 수정됨: 2025/01/07 14:05 저자
kwon37xi
문서 도구
문서 보기
이전 판
역링크
맨 위로