public:projekte:c3:29c3:live_cd

29C3 Multipurpose Live CD

  • Die Live CDs gibt es in zwei Geschmackrichtungen: Debian und Gentoo
  • Die Administration API ist transparent für beide Betriebssysteme
  • Die Live CDs booten und starten den /etc/init.d/fem-cdn init script
  • Anmeldung unter cccongress-supporter@fem.tu-ilmenau.de
  • mögliche Ressourcen-Verwendung
    • Verteil-VM/Host (RTMP, HTTP, Icecast)
      • möglichst „dick“ angebunden (>= 1GE)
      • brauch keine Festplatte, Live-CD (32bit oder 64bit) muss booten
      • bissl CPU und RAM (>=1GB)
    • HTTP-Cache-Knoten
      • benötigt min. 100GB schnellen Plattenplatz
      • >= 1GE, viel RAM nützlich
      • für HLS-Schnippsel (live + ondemand)
      • für Slides-Schnippsel (live + ondemand)
    • Ondemand Storage
      • benötigt min. 500GB
      • >= 1GE, viel RAM nützlich
  • SSH Zugang:
    • Alle Machinen lauschen auf Port 1022 für SSH Verbindungen

ssh fem@$IP_ADDR -p 1022
    

  • User fem
  • Kein root login möglich über SSH
  • Password bei rei@fem.tu-ilmenau.de beantragen
  • SSH-Pub-Key Zugang Möglich, bei rei@fem beantragen
  • fem user hat sudo Rechte
  • VNC Zugang falls möglich:
  • Beispiel:

#vncviewer $IP_TO_VM_HOST:$VNC_PORT
vncviewer 10.28.0.2:1
    

  • dodhcp
    • Erforderlich, falls die Machine in ein Netz mit DHCP ist
  • nodhcp
    • Erforderlich, wenn man eine statische einsetzen will
  • ip4
    • Erforderlich, falls die Machine eine feste IP bekommen soll, siehe nodhcp
  • gateway4
    • Wir zusammen mit „ip4“ benutzt
  • ip6
    • Erforderlich, falls die Machine eine feste IP bekommen soll
  • gateway6
    • Wir zusammen mit „ip6“ benutzt
  • eth1_ip4
    • Falls die Machine eine zweite Interface hat, kann man hiermiet die IP für diese setzen
  • eth1_gateway4
    • ACHTUNG, Dieses gateway wird auch als default route betrachtet! Nicht gateway4 und eth1_gateway4 gleichzeitig verwenden.
  • eth1_ip6
  • eth1_gateway6
    • ACHTUNG, Dieses gateway wird auch als default route betrachtet! Nicht gateway6 und eth1_gateway6 gleichzeitig verwenden.
  • domain
    • Die search domain fürs DNS, falls die Machine in ein Netzt ohne DHCP gebootet wurde
  • dns
    • Die Liste der DNS Server, falls die Machine in ein Netzt ohne DHCP gebootet wurde
  • hostname
    • Der Hostname ist Optional

Booten mit DHCP

  • Als default Parameter ist dodhcp als Boot Parameter gesetzt
  • Beispiel:

root=/dev/ram0 init=/linuxrc nosound lang=de docache looptype=squashfs loop=/image.squashfs cdroot dodhcp 
  

Booten mit feste IP - kein DHCP

  • Falls die Machine in ein Netz ohne DHCP booten soll/muss, kann man in den GRUB Boot Parameter eine IP festsetzen.
  • Beispiel:

  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 ]]

Debian

  • Sollte einfach gehen

Gentoo

  • Die kernel boot option docache entfernen. Dann sollte booten.
 === 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/*

Installation der Live CD auf HDD

#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

  • config_debian FIXME
  • config_gentoo FIXME
  • public/projekte/c3/29c3/live_cd.txt
  • Zuletzt geändert: 2012/12/28 20:08
  • von rei