08/10/2009
Le contexte:
- HP ProLiant DL140
- 2 Xeon HT (32 bits)
- 4 Go de RAM
- 80 Go IDE (récup)
- 5 adresses IP
- le tout derrière un squid
A la différence de nombreux tutos où on ne voit que les commandes qui marchent, je vais essayer de partager mes erreurs et mes réflexions.
Installation
Je ne vais pas recopier http://www.netbsd.org/docs/guide/en/chap-exinst.html mais une lecture attentive ne fera pas de mal.
Mes adaptations:
- Figure 3.5. MBR partitions
J'ai choisi 'b: Use the entire disk'
Concernant les partition, un / et un swap suffiront pour l'instant.
Par contre, / sera formaté en ffsv2 et mounté avec l'option log (Figure 3.15. Disklabel partition editing)
- Figure 3.6. Full or custom installation
Full, on sait jamais. Pour être honnête, vu le nombre de réinstallation que j'ai fait, j'ai parfois (souvent :) sélectionné Custom avec les sets pré-sélectionnés.
NetBSD est toujours aussi simple/rapide à installer.
Configuration
Un reboot plus tard et voila le dmesg.
/etc/rc.conf:
hostname=netbsd.domain.tld
ifconfig_bge0="inet 10.50.0.40 netmask 255.255.255.0"
defaultroute="10.50.0.100"
sshd=YES
/etc/ssh/sshd_config:
PermitRootLogin yes
netbsd# /etc/rc.d/network restart
netbsd# /etc/rc.d/sshd restart
Packages
Tant que je suis en mode découverte, pourquoi ne pas essayer pkgin ?
netbsd# export ftp_proxy=http://proxy.domain.tld:3128/
netbsd# export http_proxy=http://proxy.domain.tld:3128/
netbsd# pkg_info
netbsd# pkg_add -v ftp://ftp.fr.netbsd.org/pub/pkgsrc/packages/NetBSD/i386/5.0.1_2009Q2/All/pkgin-0.2.5.tgz
pkg_add: Can't process ftp://ftp.fr.netbsd.org:21/pub/pkgsrc/packages/NetBSD/i386/5.0.1_2009Q2/All/sqlite3*: Protocol error
pkg_add: no pkg found for 'sqlite3>=3.2.7nb1', sorry.
pkg_add: Can't install dependency sqlite3>=3.2.7nb1
pkg_add: 1 package addition failed
On va lui donner un coup de main:
netbsd# pkg_add -v ftp://ftp.fr.netbsd.org/pub/pkgsrc/packages/NetBSD/i386/5.0.1_2009Q2/All/sqlite3-3.6.14.2.tgz
bin/sqlite3
include/sqlite3.h
include/sqlite3ext.h
lib/libsqlite3.la
lib/libsqlite3.a
lib/libsqlite3.so
lib/libsqlite3.so.0
lib/libsqlite3.so.0.8.6
lib/pkgconfig/sqlite3.pc
man/man1/sqlite3.1
Package sqlite3-3.6.14.2 registered in /var/db/pkg/sqlite3-3.6.14.2
netbsd# pkg_add -v ftp://ftp.fr.netbsd.org/pub/pkgsrc/packages/NetBSD/i386/5.0.1_2009Q2/All/pkgin-0.2.5.tgz
Running install with PRE-INSTALL for pkgin-0.2.5.
bin/pkgin
man/man1/pkgin.1
share/examples/pkgin/repositories.conf.example
Executing '/bin/mkdir -p '/usr/pkg'/etc/pkgin'
Running install with PRE-INSTALL for pkgin-0.2.5.
pkgin-0.2.5: copying /usr/pkg/share/examples/pkgin/repositories.conf.example to /usr/pkg/etc/pkgin/repositories.conf
Package pkgin-0.2.5 registered in /var/db/pkg/pkgin-0.2.5
#========================================================================
$NetBSD: MESSAGE,v 1.1.1.1 2009/06/08 13:58:26 imil Exp $
First steps before using pkgin.
. Modify /usr/pkg/etc/pkgin/repositories.conf to suit your platform
. Initialize the database :
# pkgin update
#========================================================================
netbsd# vi /usr/pkg/etc/pkgin/repositories.conf
netbsd# pkgin update
processing local summary...
updating database: 100%
downloading pkg_summary.bz2: 100%
processing remote summary (ftp://ftp.fr.netbsd.org/pub/pkgsrc/packages/NetBSD/i386/5.0.1_2009Q2/All/)...
updating database: 100%
Installation de Xen
On garde sous les yeux:
- http://www.netbsd.org/ports/xen/howto.html
- http://www.netbsdfr.org/wiki/doku.php?id=tips:xen3_current
Et on y va:
netbsd# pkgin install xentools33
calculating dependencies for xentools33...
nothing to upgrade.
8 packages to be installed: ncurses-5.7nb1 readline-6.0 libffi-3.0.8nb2 python25-2.5.4nb1 py25-xml-0.8.4nb2 py25-readline-0nb4 py25-curses-0nb4 xentools33-3.3.1nb6 (14M to download, 59M to install)
proceed ? [y/N] y
...
netbsd# cp /usr/pkg/share/examples/rc.d/* /etc/rc.d/
netbsd# chmod 755 /etc/rc.d/xen*
netbsd# cd /dev && sh MAKEDEV xen
netbsd# pkgin install xenkernel33
calculating dependencies for xenkernel33...
nothing to upgrade.
1 packages to be installed: xenkernel33-3.3.1nb1 (828K to download, 828K to install)
proceed ? [y/N] y
...
netbsd# cp /usr/pkg/xen3-kernel/xen.gz /
On récupère depuis ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.0.1/i386/binary/kernel/
Tout le monde est là:
netbsd# ls /
.cshrc cdrom libexec proc usr
.profile dev mnt rescue var
altroot etc netbsd root xen.gz
bin kern netbsd-INSTALL_XEN3_DOMU.gz sbin
boot lib netbsd-XEN3_DOM0.gz stand
boot.cfg libdata netbsd-XEN3_DOMU.gz tmp
netbsd# cat /boot.cfg
menu=Boot normally:boot netbsd
menu=Boot single user:boot netbsd -s
menu=Disable ACPI:boot netbsd -2
menu=Disable ACPI and SMP:boot netbsd -12
menu=Boot Xen dom0:load /netbsd-XEN3_DOM0.gz console=pc;multiboot /xen.gz dom0_mem=256M -s
menu=Drop to boot prompt:prompt
default=1
timeout=5
netbsd# reboot
On choisit manuellement la cinquième entrée et chocapik:
Mismatch between XEN and DOM0 kernel
On va lire http://archive.netbsd.se/?ml=port-xen&a=2008-08&t=8360302, puis http://www.netbsd.org/ports/xen/ et on se dit qu'on va attendre: "A new kernel XEN3PAE_DOM0 should show up in the next HEAD autobuild."
et c'est (re)parti:
netbsd# pkgin remove xenkernel33
netbsd# pkgin remove xentools33
netbsd# pkgin install xenkernel3
netbsd# pkgin install xentools3
netbsd# cp /usr/pkg/xen3-kernel/xen.gz /
netbsd# reboot
On choisit la cinquième entrée du menu de boot et hop un dmesg
netbsd# cp /usr/pkg/share/examples/rc.d/* /etc/rc.d/
netbsd# chmod 755 /etc/rc.d/xen*
netbsd# echo "xend=YES" >> /etc/rc.conf
netbsd# echo "xenbackendd=YES" >> /etc/rc.conf
netbsd# echo "xendomains=YES" >> /etc/rc.conf
netbsd# xend start
netbsd# xenbackendd
netbsd# cat /etc/ifconfig.bridge0
create
!brconfig $int add bge0 up
On modifie le script /usr/pkg/etc/xen/scripts/vif-bridge
netbsd# grep xbridge= /usr/pkg/etc/xen/scripts/vif-bridge
#xbridge=$(xenstore-read "$xpath/bridge")
xbridge=bridge0
Configuration des domU
netbsd# mkdir -p /home/xen
netbsd# dd if=/dev/zero of=/home/xen/netbsd-001.img bs=1m count=2k
netbsd# grep -v "^#" /usr/pkg/etc/xen/netbsd-001
kernel = "/netbsd-INSTALL_XEN3_DOMU.gz"
memory = 128
name = "netbsd-001"
vif = [ 'bridge=bridge0' ]
disk = [ 'file:/home/xen/netbsd-001.img,xbd0a,w', 'file:/home/xen/i386cd-5.0.1.iso,xbd1d,r' ]
root = "/dev/xbd0a"
Roulement de tambour:
netbsd# xm create -c /usr/pkg/etc/xen/netbsd-001
Error: Device 0 (vif) could not be connected. Hotplug scripts not working
On active le bridge0 sinon les domU ne se lance pas:
netbsd# /etc/rc.d/network restart
On installe tranquillou, minimal, depuis le cd qui est en xbd1d et pas cd0a, et on finit par un
netbsd-001# halt -p
ctrl+] pour quitter la console du domU. On bascule sur le kernel normal:
netbsd# grep ^kernel /usr/pkg/etc/xen/netbsd-001
kernel = "netbsd-XEN3_DOMU.gz"
On boote le domU et voilà-t-y pas qu'il demande sur quoi booter :( On modifie /usr/pkg/etc/xen/netbsd-001
netbsd# grep ^root /usr/pkg/etc/xen/netbsd-001
root = "xbd0a"
Si au prochain reboot du dom0 pas de xen, on n'oublie pas de modifier l'entrée par défaut de /boot.cfg:
netbsd# grep ^default /boot.cfg
default=5
Poufinage domU
On a donc une image d'un domU non configurée. Pourquoi ne pas en profiter ?
netbsd# dd if=/home/xen/netbsd-001.img of=/home/xen/_netbsd.img
On pourra rapidement (re)faire un domU:
netbsd# dd if=/home/xen/_netbsd.img of=/home/xen/netbsd-002.img
netbsd# sed -e 's/001/002/' /usr/pkg/etc/xen/netbsd-001 > /usr/pkg/etc/xen/netbsd-002
Reste à commenter les lignes screen de /etc/wscons.conf et garder uniquement la console on dans /etc/ttys. Un peu de configuration:
netbsd-001# tail /etc/rc.conf
ifconfig_bge0="inet 10.50.0.41 netmask 255.255.255.0"
defaultroute="10.50.0.100"
hostname="netbsd-001.domain.tld"
sshd=YES
powerd=YES
netbsd-001# cat /etc/resolv.conf
domain domain.tld
search domain.tld
nameserver 192.168.0.2
nameserver 192.168.0.1
nameserver 192.168.0.3
Pour démarrer automatiquement notre domU:
netbsd# echo 'xendomains="netbsd-001"' >> /etc/rc.conf
A venir
Un seul disque n'est pas suffisant pour une mise en production. Je vais donc rajouter un disque et refaire une installation sur du raid 1 (mirroir).
Les fichiers utilisés comme device pour les domU je n'aime pas car on superpose les couches:
disque -> partition -> file system -> partition -> file system
dom0 dom0 domU domU
On ne dispose pas encore de LVM ni de ZFS (mais c'est en cours). Vu la quantité de RAM et le nombre d'IP disponibles, je vais pouvoir affecter une (des) partitions à mes 4 domU:
disque -> partition -> file system
dom0 dom0
-> partition -> file system
domU domU
-> partition -> file system
domU domU
-> partition -> file system
domU domU
-> partition -> file system
domU domU
Le dom0 doit être un peu mieux configuré: sshd, pf, ntp, cache dns, centralisation des logs, un petit smartmontool, du symon (ou munin) et deux trois trucs qui facilitent la vie. En attendant un controleur SATA et deux disques de plus grosse capacité, amusez-vous bien avec NetBSD et Xen !
Pages : 1
Rss