kvm guest vm setup

페이지 정보

작성자 조희승 댓글 0건 조회 9,837회 작성일 13-10-04 21:32

본문

ubuntu-vm-builder kvm precise \
                  --dest g1 \
                  --arch amd64 \
                  --hostname g1 \
                  --mem 256 \
                  --ip 192.168.0.12 \
                  --mask 255.255.255.0 \
                  --net 192.168.0.0 \
                  --bcast 192.168.0.255 \
                  --gw 192.168.0.1 \
                  --dns 192.168.0.1 \
                  --mirror http://ftp.daum.net/ubuntu \
                  --components 'main,universe' \
                  --libvirt qemu:///system ;
#                  --components 'main,universe,restricted' \

ubuntu-vm-builder kvm trusty \
                  --dest g1 \
                  --arch amd64 \
                  --hostname g1 \
                  --mem 256 \
                  --ip 192.168.0.12 \
                  --mask 255.255.255.0 \
                  --net 192.168.0.0 \
                  --bcast 192.168.0.255 \
                  --gw 192.168.0.1 \
                  --dns 192.168.0.1 \
                  --mirror http://ftp.daum.net/ubuntu \
                  --components 'main,universe' \
                  --addpkg=linux-image-generic \
                  --addpkg acpid \
                  --addpkg vim \
                  --addpkg openssh-server \
                  --addpkg avahi-daemon \
                  --swapsize=0
                  --libvirt qemu:///system ;


dpkg: error processing package sudo (--configure): -----------> 이런 에러라면 아래 링크 참고
https://askubuntu.com/questions/852814/dpkg-error-processing-package-sudo-configure



 
xml 파일은 virsh 에서 dumpxml 로 생성
 
 
 
socket.gaierror: [Errno -2] Name or service not known
에러가 날때 있는데, line 70번을 그냥 defaultdomain으로 수정
 
잘 안될때가 있는데 왜그런지 모르겠음.
 
default id/pw는 ubuntu/ubuntu 임
 
- Permission denied to read images on KVM
Just to document to other users using 12.04
You have to update /etc/libvirt/qemu.conf
and uncomment user="root" and group="root"
/etc/init.d/libvirt-bin restart
 
 
- network
ifconfig virbr0 보고 192.168.000.000 확인하고 설정
/var/lib/libvirt/network/default.xml 수정하면 ip 대역 변경 가능. 리부팅.
 
- virsh shutdown
apt-get install acpid 하면 동작함
 
- console
g1.xml에서
<!--
<serial type='tty'>
<source path='/dev/ttyS0'/>
<target port='0'/>
</serial>
<console type='tty' tty='/dev/ttyS0'>
<source path='/dev/ttyS0'/>
<target port='0'/>
</console>
-->
<console type='pty'>
<target port='0'/>
</console>
vm에서 /etc/init/ttyS0.conf 생성 (tty1에서 copy)

start on stopped rc RUNLEVEL=[12345]
stop on runlevel [!12345]
respawn
exec /sbin/getty -L 38400 ttyS0

virsh console g1 으로 접속 가능
 
가끔 ttyS0가 늦게 뜨는 경우가 있는데, /etc/failsafe.conf 때문임. sleep하는 부분들을 # 처리
 
grub에서 kernel parameter로 console=ttyS0 를 주면 부팅 로그도 보고 지연되는 경우도 없음
자동로그인하고 싶으면 ....getty -a root -L...추가
 
 
- qcow2 mount
agi guestmount
guestmount --rw -a g1.qcow2 -m /dev/sda1 /mnt 
guestmount --rw -a g1.qcow2 -i /mnt 
 
 
qcow 포맷은 쓰지 말것
그냥 disk.img로 만들고, lvm 쓸려면 dd로 덤프하는게 제일 편함

댓글목록

등록된 댓글이 없습니다.