ssh fem@$IP_ADDR -p 1022
#vncviewer $IP_TO_VM_HOST:$VNC_PORT vncviewer 10.28.0.2:1
root=/dev/ram0 init=/linuxrc nosound lang=de docache looptype=squashfs loop=/image.squashfs cdroot dodhcp
root=/dev/ram0 init=/linuxrc nosound lang=de docache looptype=squashfs loop=/image.squashfs cdroot nodhcp ip4=141.24.40.40/26 gateway4=141.24.40.62 dns=8.8.8.8,141.24.53.227,8.8.4.4 domain=fem.tu-ilmenau.de hostname=interceptor eth1_ip6=2001::01/64 eth1_gateway6=2001::02
* Beispiel Script um eine VM Instanz des Live CDs zu starten
#!/bin/bash NAME="cdn1" MAC="00:60:2F:01:01:01" ISO="/home/fem/29c3_gentoo_x86_64.iso" NUMBER=1 /usr/bin/qemu-system-x86_64 -name $NAME -cpu qemu64 -smp 2 -m 512 \ -watchdog i6300esb -balloon none -k de -localtime \ -pidfile /tmp/${NAME}.pid -net nic,macaddr=${MAC},model=virtio \ -net tap,script=/etc/qemu/qemu-ifup -cdrom ${ISO} -boot d \ -vnc :${NUMBER} -daemonize
* Siehe [[http://www.petri.co.il/use-iso-image-files-vmware.htm]] * [[http://en.gentoo-wiki.com/wiki/VMware_Guest#Preparing_Virtual_Machine | Gentoo Anleitung ]]
=== Installation des FeM-CDN Initscripts ===
wget http://subversion.fem.tu-ilmenau.de/repository/cccongress/trunk/tools/fem-cdn-mm/cdn/etc/init.d/fem-cdn.init -q -O /etc/init.d/fem-cdn.init wget http://subversion.fem.tu-ilmenau.de/repository/cccongress/trunk/tools/fem-cdn-mm/cdn/etc/init.d/fem-cdn.debian -q -O /etc/init.d/fem-cdn.debian wget http://subversion.fem.tu-ilmenau.de/repository/cccongress/trunk/tools/fem-cdn-mm/cdn/etc/init.d/fem-cdn.gentoo -q -O /etc/init.d/fem-cdn.gentoo useradd -m fem #passwd fem #Set random password gpasswd -a fem wheel #Add fem user to the wheel group. #Update the sudoers file to allow the fem user to be root without password #For GENTOO: #rc-update add fem-cdn.gentoo default #For DEBIAN: # update-rc.d fem-cdn.debian defaults # setup fstab echo "####################################################" >>/etc/fstab echo "## ATTENTION: THIS IS THE FSTAB ON THE LIVECD ##" >>/etc/fstab echo "## PLEASE EDIT THE FSTAB at /mnt/gentoo/etc/fstab ##" >>/etc/fstab echo "####################################################" >>/etc/fstab echo "tmpfs / tmpfs defaults 0 0" >>/etc/fstab echo "tmpfs /lib/firmware tmpfs defaults 0 0" >>/etc/fstab echo "#tmpfs /usr/portage tmpfs defaults 0 0" >>/etc/fstab echo "tmpfs /tmp tmpfs defaults,mode=41777 0 0" >>/etc/fstab echo "crs-storage:/crs-mount /opt/crs/storage glusterfs _netdev,noatime 0 0" >>/etc/fstab # checkout subversion repository svn co https://subversion.fem.tu-ilmenau.de/repository/cccongress/trunk /opt/crs/vcs --non-interactive --username anonymous --password '' # add build number echo "FeMCDN LiveCD Build: \"$(date)\" ($(date +'%s'))" >>/etc/motd # remove symlink rm /var/run mkdir /var/run cp -r /run/* /var/run rm /var/lock mkdir /var/lock ###Fix nginx mkdir -p /var/tmp/nginx/client ##Create www folders mkdir -p /var/www/rtmp mkdir -p /var/www/www mkdir -p /var/www/slides mkdir -p /var/www/hls mkdir -p /var/www/hls_slides_www wget -q https://github.com/arut/nginx-rtmp-module/blob/master/stat.xsl -O /var/www/rtmp/stat.xsl #Fix erlyvideo chmod a+x /opt/erlyvideo/bin/* chmod a+x /opt/erlyvideo/erts-*/bin/* chmod a+x /opt/erlyvideo/lib/inets-*/priv/bin/* chmod a+x /opt/erlyvideo/lib/observer-*/priv/bin/* chmod a+x /opt/erlyvideo/lib/os_mon-*/priv/bin/* chmod a+x /opt/erlyvideo/lib/webtool-*/priv/bin/*
#Create a loopback device if needed #Root partition 10Gb #Swap partiotion 256Mb dd if=/dev/zero of=/home/fem/livecd_root.img bs=1M count=10k dd if=/dev/zero of=/home/fem/livecd_swap.img bs=1M count=256 #boot your customcd image #set root passwd sudo passwd #change to root sudo -i #set the user passwd passwd fem #Create a primary partition and mark it bootable. cfdisk /dev/sda #Format it as ext3, then mount it. mkfs.ext3 /dev/sda1 #Create the mount point first, if necessary. mkdir -p /mnt/sda1 #mount the partition mount /dev/sda1 /mnt/sda1 #copy the system over, exclude a few things rsync -a / /mnt/sda1/ --exclude=/{/mnt/sda1,dev,live,sys,proc,media}/ #create proc, sys, and media folders mkdir -p /mnt/sda1/dev /mnt/sda1/proc /mnt/sda1/sys /mnt/sda1/media #Mount Dev and Proc filesystems mount -o bind /dev /mnt/sda1/dev mount -t proc none /mnt/sda1/proc #chroot into partition chroot /mnt/sda1/ /bin/bash export PS1="(chroot)$PS1" #install grub - will only setup grub for this installation grub-install /dev/sda update-grub #remove fstab rm /etc/fstab #create new fstab (example below) nano /etc/fstab #exit chroot exit #reboot reboot
/etc/fstab example
/dev/sda1 / ext3 defaults 0 1 proc /proc proc defaults 0 0
Booting with Qemu
#!/bin/bash NAME="cdn1" MAC="00:60:2F:01:01:01" NUMBER=1 /usr/bin/qemu-system-x86_64 -name $NAME -cpu qemu64 -smp 2 -m 512 \ -watchdog i6300esb -balloon none -k de -localtime \ -pidfile /tmp/${NAME}.pid -net nic,macaddr=${MAC},model=virtio \ -net tap,script=/etc/qemu/qemu-ifup \ -hda /home/fem/livecd_root.img -hdb /home/fem/livecd_swap.img -boot a -vnc :${NUMBER} -daemonize