2014年4月10日 星期四

虛擬電腦教室所需之 shell script 及檔案定義

∼/ .................................................................... 家目錄
virtualclassroom/......................................虛擬電腦教室目錄
+debian-7.4.0-amd64-CD-1.iso....................Debian X86_64 ISO 檔
+pxeserver.img .................................... PXE Server 之影像檔
+deb_mirror.img........儲存 debian 套件之影像檔,PXE Server 之 sdb
+linux.img..........................................Linux 主機之影像檔
+buildpxe.sh..............安裝 PXE Server 之 shell script,列表 3.6
+buildlinux.sh ........... 安裝 Linux 主機之 shell script,列表 3.10
+runpxe.sh.......執行 PXE Server 虛擬機器之 shell script,列表 3.7
+runlinux.sh ........... 執行 Linux 虛擬主機之 shell script,列表 ??

-----------------------buildpxe.sh-------------------------------------------
# IP=192.168.2.254 pxeserver.example.org

CPU=host
SMP=2
MEMORY=1024
HDA=pxeserver.img
MAC="DE:AD:BE:CF:EC:B7"
BRIDGE=br10
CDROM=/opt/iso/debian-7.4.0-amd64-CD-1.iso

qemu-system-x86_64 -enable-kvm -cpu $CPU -smp $SMP -m $MEMORY \
-hda $HDA \
-cdrom $CDROM -boot d \
-net nic,macaddr=$MAC -net bridge,br=$BRIDGE
----------------------------------------------------------------------------------------

---------------------runpxe.sh-------------------------------------------------------
# IP=192.168.2.254
# PXE Server

CPU=host
SMP=2
MEMORY=1024
HDA=pxeserver.img
HDB=deb_mirror.img
MAC="DE:AD:BE:CF:EC:B7"
BRIDGE=br10
CDROM=/opt/iso/debian-7.4.0-amd64-CD-1.iso


qemu-system-x86_64 -enable-kvm -cpu $CPU -smp $SMP -m $MEMORY \
-hda $HDA \
-hdb $HDB \
-cdrom $CDROM \
-net nic,macaddr=$MAC -net bridge,br=$BRIDGE
----------------------------------------------------------------------------------------------------

-------------------------buildlinux.sh----------------------------------------------------------
CPU=host
SMP=2
MEMORY=1024
HDA=linux.img
MAC="DE:AD:BE:EF:EC:A8"
BRIDGE=br10
CDROM=/opt/iso/debian-7.4.0-amd64-CD-1.iso


qemu-system-x86_64 -enable-kvm -cpu $CPU -smp $SMP -m $MEMORY \
-hda $HDA \
-net nic,macaddr=$MAC -net bridge,br=$BRIDGE \
-bootp tftp://192.168.10.254/pxelinux.0 \
-tftp /srv/tftp \
-------------------------------------------------------------------------------------------------------

------------------runlinux.sh---------------------------------------------------------------------
CPU=host
SMP=2
MEMORY=1024
HDA=linux.img
MAC="DD:AD:BE:EF:EC:B6"
BRIDGE=br10


qemu-system-x86_64 -enable-kvm -cpu $CPU -smp $SMP -m $MEMORY \
-hda $HDA \
-net nic,macaddr=$MAC -net bridge,br=$BRIDGE
---------------------------------------------------------------------------------------------------------

沒有留言:

張貼留言