| 1 |
Provisioning Server ideas |
| 2 |
|
| 3 |
- bootup kernel on target host via TFTP/PXE |
| 4 |
- start our code that |
| 5 |
- enables networking (dhcp) |
| 6 |
- enables sshd |
| 7 |
|
| 8 |
Requires: |
| 9 |
- Program that creates our blob that needs to be started |
| 10 |
- for Linux: initrd |
| 11 |
- Including ssh keys -> known! |
| 12 |
- startup sshd |
| 13 |
|
| 14 |
-------------------------------------------------------------------------------- |
| 15 |
Setup for installation server: |
| 16 |
|
| 17 |
- have dhcpd available |
| 18 |
- install tftpd server |
| 19 |
- configure dhcp to tell clients to boot from tftp server |
| 20 |
- have a kernel |
| 21 |
|
| 22 |
-------------------------------------------------------------------------------- |
| 23 |
Ideas on how to create "blob" |
| 24 |
|
| 25 |
- Use tools from system? |
| 26 |
-> requires same arch on destination! |
| 27 |
- Use debian|...| base? |
| 28 |
-> works with cuni! |
| 29 |
-------------------------------------------------------------------------------- |
| 30 |
tftp via cuni: |
| 31 |
debian pxelinux.0 pxelinux.cfg |
| 32 |
|
| 33 |
[19:44] kr:tftp% ln -s /usr/lib/syslinux/ |
| 34 |
|
| 35 |
-------------------------------------------------------------------------------- |
| 36 |
How to create the initrd? |
| 37 |
Base from ... |
| 38 |
arch? |
| 39 |
debian? |
| 40 |
|
| 41 |
- needs many hardware support / in kernel? |
| 42 |
- fit to kernel? |
| 43 |
|
| 44 |
-------------------------------------------------------------------------------- |
| 45 |
Based on Debian |
| 46 |
[21:33] kr:tftp% sudo debootstrap --arch=i386 squeeze debian-squeeze |
| 47 |
|
| 48 |
sudo chroot debian-squeeze /bin/bash |
| 49 |
apt-get install openssh-server |
| 50 |
|
| 51 |
|
| 52 |
-------------------------------------------------------------------------------- |
| 53 |
Based on Archlinux |
| 54 |
|
| 55 |
Edit / create pacman.conf |
| 56 |
Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686 |
| 57 |
|
| 58 |
[21:40] kr:~% grep -v ^# pacman.conf | grep -v '^$' |
| 59 |
[options] |
| 60 |
HoldPkg = pacman glibc |
| 61 |
SyncFirst = pacman |
| 62 |
Architecture = auto |
| 63 |
[core] |
| 64 |
Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686 |
| 65 |
[extra] |
| 66 |
Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686 |
| 67 |
[community] |
| 68 |
Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686 |
| 69 |
[archlinuxfr] |
| 70 |
Server = http://repo.archlinux.fr/$arch |
| 71 |
|
| 72 |
[21:40] kr:tftp% sudo mkarchroot -C ~/pacman.conf archlinuxroot |
| 73 |
|
| 74 |
[21:42] kr:tftp% sudo mkarchroot -C ~/pacman.conf archlinuxroot base |
| 75 |
|
| 76 |
-------------------------------------------------------------------------------- |
| 77 |
Initramfs general: |
| 78 |
|
| 79 |
- need /init |
| 80 |
|
| 81 |
Test in Debian: |
| 82 |
root@kr:/# ln -s /sbin/init init |
| 83 |
|
| 84 |
Create initramfs: |
| 85 |
[22:47] kr:debian-squeeze% sudo find . -print0 | sudo cpio --null -ov --format=newc | gzip -9 > ../pre-os/initrd.gz |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
-------------------------------------------------------------------------------- |
| 90 |
Gentoo: http://en.gentoo-wiki.com/wiki/Initramfs |
| 91 |
|
| 92 |
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). |
| 93 |
|
| 94 |
http://syslinux.zytor.com/wiki/index.php/SYSLINUX#INITRD_initrd_file |
| 95 |
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. |
| 96 |
-------------------------------------------------------------------------------- |
| 97 |
Multiple initrds, #1: |
| 98 |
|
| 99 |
LABEL preos |
| 100 |
MENU LABEL Pre OS (Debian Squeeze) |
| 101 |
KERNEL debian-squeeze/boot/vmlinuz-2.6.32-5-686 |
| 102 |
INITRD debian-squeeze/boot/initrd.img-2.6.32-5-686,pre-os/initrd.gz |
| 103 |
|
| 104 |
-------------------------------------------------------------------------------- |
| 105 |
Debug in rootfs: |
| 106 |
root@kr:/# passwd |
| 107 |
Enter new UNIX password: |
| 108 |
Retype new UNIX password: |
| 109 |
passwd: password updated successfully |
| 110 |
test |
| 111 |
-------------------------------------------------------------------------------- |
| 112 |
Multiple nics in Debian... |