112 lines
		
	
	
	
		
			3.7 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			112 lines
		
	
	
	
		
			3.7 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
Provisioning Server ideas
 | 
						|
 | 
						|
   - bootup kernel on target host via TFTP/PXE
 | 
						|
   - start our code that
 | 
						|
      - enables networking (dhcp)
 | 
						|
      - enables sshd
 | 
						|
 | 
						|
Requires:
 | 
						|
   - Program that creates our blob that needs to be started
 | 
						|
      - for Linux: initrd
 | 
						|
      - Including ssh keys -> known!
 | 
						|
      - startup sshd
 | 
						|
 | 
						|
--------------------------------------------------------------------------------
 | 
						|
Setup for installation server:
 | 
						|
 | 
						|
   - have dhcpd available
 | 
						|
   - install tftpd server
 | 
						|
   - configure dhcp to tell clients to boot from tftp server
 | 
						|
   - have a kernel
 | 
						|
   
 | 
						|
--------------------------------------------------------------------------------
 | 
						|
Ideas on how to create "blob"
 | 
						|
 | 
						|
   - Use tools from system?
 | 
						|
      -> requires same arch on destination!
 | 
						|
   - Use debian|...| base?
 | 
						|
      -> works with cuni!
 | 
						|
--------------------------------------------------------------------------------
 | 
						|
tftp via cuni:
 | 
						|
debian  pxelinux.0  pxelinux.cfg
 | 
						|
 | 
						|
[19:44] kr:tftp% ln -s /usr/lib/syslinux/
 | 
						|
 | 
						|
--------------------------------------------------------------------------------
 | 
						|
How to create the initrd?
 | 
						|
   Base from ...
 | 
						|
      arch?
 | 
						|
      debian?
 | 
						|
 | 
						|
- needs many hardware support / in kernel?
 | 
						|
   - fit to kernel?
 | 
						|
 | 
						|
--------------------------------------------------------------------------------
 | 
						|
Based on Debian
 | 
						|
[21:33] kr:tftp% sudo debootstrap --arch=i386 squeeze debian-squeeze 
 | 
						|
 | 
						|
sudo chroot debian-squeeze /bin/bash
 | 
						|
 apt-get install openssh-server
 | 
						|
 | 
						|
 | 
						|
--------------------------------------------------------------------------------
 | 
						|
Based on Archlinux
 | 
						|
 | 
						|
Edit / create pacman.conf
 | 
						|
Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686
 | 
						|
 | 
						|
[21:40] kr:~% grep -v ^# pacman.conf | grep -v '^$'
 | 
						|
[options]
 | 
						|
HoldPkg     = pacman glibc
 | 
						|
SyncFirst   = pacman
 | 
						|
Architecture = auto
 | 
						|
[core]
 | 
						|
Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686
 | 
						|
[extra]
 | 
						|
Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686
 | 
						|
[community]
 | 
						|
Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686
 | 
						|
[archlinuxfr] 
 | 
						|
Server = http://repo.archlinux.fr/$arch
 | 
						|
 | 
						|
[21:40] kr:tftp% sudo mkarchroot -C ~/pacman.conf archlinuxroot
 | 
						|
 | 
						|
[21:42] kr:tftp% sudo mkarchroot -C ~/pacman.conf archlinuxroot base
 | 
						|
 | 
						|
--------------------------------------------------------------------------------
 | 
						|
Initramfs general:
 | 
						|
 | 
						|
   - need /init
 | 
						|
 | 
						|
Test in Debian:
 | 
						|
   root@kr:/# ln -s /sbin/init init
 | 
						|
 | 
						|
Create initramfs:
 | 
						|
   [22:47] kr:debian-squeeze% sudo find . -print0 | sudo cpio --null -ov --format=newc | gzip -9  > ../pre-os/initrd.gz
 | 
						|
 | 
						|
 | 
						|
 | 
						|
--------------------------------------------------------------------------------
 | 
						|
Gentoo: http://en.gentoo-wiki.com/wiki/Initramfs
 | 
						|
 | 
						|
It is possible to specify multiple initramfs to be extracted during boot. This can be useful if you want to create a generic initramfs (for example one that does mdadm) and then add modifications in separate files (for example a custom /etc/mdadm.conf for every machine). 
 | 
						|
 | 
						|
http://syslinux.zytor.com/wiki/index.php/SYSLINUX#INITRD_initrd_file
 | 
						|
   It supports multiple filenames separated by commas. This is mostly useful for initramfs, which can be composed of multiple separate cpio or cpio.gz archives. Note: all files except the last one are zero-padded to a 4K page boundary. This should not affect initramfs.
 | 
						|
--------------------------------------------------------------------------------
 | 
						|
Multiple initrds, #1:
 | 
						|
 | 
						|
LABEL preos
 | 
						|
   MENU LABEL Pre OS (Debian Squeeze)
 | 
						|
   KERNEL debian-squeeze/boot/vmlinuz-2.6.32-5-686
 | 
						|
   INITRD debian-squeeze/boot/initrd.img-2.6.32-5-686,pre-os/initrd.gz
 | 
						|
 | 
						|
--------------------------------------------------------------------------------
 | 
						|
Debug in rootfs:
 | 
						|
root@kr:/# passwd 
 | 
						|
Enter new UNIX password: 
 | 
						|
Retype new UNIX password: 
 | 
						|
passwd: password updated successfully
 | 
						|
test
 | 
						|
--------------------------------------------------------------------------------
 | 
						|
Multiple nics in Debian...
 |