Installation GENTOO + RAID sur VMWARE

Transcription

Installation GENTOO + RAID sur VMWARE
Installation GENTOO + RAID sur VMWARE
Chargement modules
modprobe raid0
modprobe raid1
modprobe dm-mod
Partitionnement
/dev/sdx1
/dev/sdx2
/dev/sdx3
ext2
swap
ext3
32M
=RAM
reste du disque
Pour supprimer un raid existant
mdadm --manage --stop /dev/mdX
mdadm --zero-superblock /dev/sdYZ (si msg d’erreur alors c’est OK)
mdadm --zero-superblock /dev/sdY
puis suppression des partitions
fdisk /dev/sda
sfdisk -d /dev/sda | sfdisk --force /dev/sdb (on duplique le partionnement)
mknod /dev/md1 b 9 1
mknod /dev/md2 b 9 2
mknod /dev/md3 b 9 3
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md2 --level=0 --raid-devices=2 /dev/sda2 /dev/sdb2
mdadm --create /dev/md3 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3
watch -n 60 cat /proc/mdstat
mkfs.ext2 /dev/md1
mkfs.ext3 /dev/md3
mkswap /dev/md2
swapon -p 1 /dev/md2
swapon -v -s
Installation des fichiers d’installation
mount /dev/md3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/md1 /mnt/gentoo/boot
date
si besoin : date 030600162006 (Format : MMJJhhmmAAAA)
cd /mnt/gentoo
links http://www.gentoo.org/main/en/mirrors.xml
tar xvjpf stage3-*.tar.bz2
Options de compilation
nano -w /mnt/gentoo/etc/portage/make.conf
CFLAGS="-march=native -O2 -pipe" (native = autodectect)
MAKEOPTS="-j4" # nombre de cœur x2
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
mirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf
Installation du système de base de Gentoo
cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount -t proc none /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile
export PS1="(chroot) $PS1"
emerge-webrsync
emerge --sync
eselect profile list
exemple : eselect profile set 2
ls /usr/share/zoneinfo
cp /usr/share/zoneinfo/Europe/Paris /etc/localtime
Configuration du noyau
emerge gentoo-sources
ls -l /usr/src/linux
cd /usr/src/linux
make menuconfig
[*] 64-bit kernel (leave blank for x86)
General Setup --->
[*] Optimize very unlikely/likely branches
Processor type and features --->
Processor Family (usually Core2/Newer Xeon)
Device Drivers --->
Generic Driver Options
[*] Maintain a devtmpfs filesystem to mount at /dev
[*] Multiple devices driver support (RAID and LVM) --->
<*> RAID support
[*] Autodetect RAID arrays during kernel boot
<*> RAID-0 (striping) mode
<*> RAID-1 (mirroring) mode
<*> Device mapper support
Misc Devices --->
[*] VMware Balloon Driver (manages memory between VM and host)
[*] VMware VMCI Driver (Virtual Machine Communication Interface - low-latency access to host memory bus)
SCSI device support --->
[*] SCSI low-level drivers --->
<*> VMware PVSCSI driver support (high throughput storage adapter)
[*] Fusion MPT device support --->
<*> Fusion MPT ScsiHost drivers for SPI
[*] Network device support --->
[*] Ethernet driver support --->
(disable every driver but this)
[*] Intel Devices
<*> …(keep default intel)
Graphics support --->
<*> Direct Rendering Manager
<*> DRM driver for VMware Virtual GPU
[*] Enable framebuffer console support under vmwgfx by default
<*> Support for frame buffer devices
File systems --->
(enable only those you anticipate using)
<*> The Extended 4 (ext4) filesystem
[*] Use ext4 for ext2/ext3 file systems
[*] Ext4 POSIX ACL
[*] Ext4 Security Label
-*- Native language support --->
<*> NLS ISO 8859-15 (Latin 9; Western European Languages with Euro)
Pseudo filesystems --->
[*] Tmpfs virtual memory file system support (former shm fs)
[*] Tmpfs POSIX Access Control Lists
make && make modules_install
cp arch/x86_64/boot/bzImage /boot/kernel-3.x.y-gentoo
emerge genkernel mdadm
mdadm --examine --scan >> /etc/mdadm.conf
nano /etc/mdadm.conf
Editez et simplifiez exemple :
ARRAY /dev/md1 UUID=baebaec7:6d25ab9a:a9578716:3ff8487b
ARRAY /dev/md2 UUID=f1c2304c:ab04bc3a:19d593b0:b7d7c179
ARRAY /dev/md3 UUID=0d3cce86:1e5a82a9:e53ae32f:9e7eea9d
nano /etc/genkernel.conf
MDADM="yes"
MDADM_CONFIG="/etc/mdadm.conf"
genkernel --mdadm --install initramfs
ls /boot
Configurer le système
mkdir /mnt/cdrom
nano -w /etc/fstab
/dev/md1 /boot
ext2 noauto,noatime 1 2
/dev/md3 /
ext3 noatime
01
/dev/md2 none
swap sw
00
/dev/cdrom /mnt/cdrom auto noauto,user
00
nano -w /etc/conf.d/hostname
HOSTNAME="nom_serveur"
nano -w /etc/conf.d/net
dns_domain="mynet67"
config_enp2s0="192.168.223.1x/24"
routes_enp2s0="default via 192.168.223.1"
dns_servers="192.168.223.1"
cd /etc/init.d
ln -s net.lo net.enp2s0
rc-update add net.enp2s0 default
nano -w /etc/hosts
127.0.0.1 localhost
192.168.223.1x SERVx.mynet67 SERVx
passwd
nano -w /etc/conf.d/keymaps
keymap="fr"
fix_euro="YES"
nano -w /etc/locale.gen
fr_FR ISO-8859-1
fr_FR@euro ISO-8859-15
fr_FR.UTF-8 UTF-8
[email protected] UTF-8
locale-gen
nano /etc/env.d/02locale
LANG="fr_FR.UTF-8"
LC_COLLATE="C"
nano /etc/profile.d/alias.sh
alias ll='ls -l'
alias cp='cp -i'
alias rm='rm -i'
alias mv='mv -i'
alias screen='screen -RD'
env-update && source /etc/profile
Installer les outils système
emerge syslog-ng vixie-cron mlocate
rc-update add syslog-ng default
rc-update add vixie-cron default
rc-update add sshd default
Configurer le chargeur de démarrage
emerge sys-boot/grub:2
grub2-install /dev/sda
grub2-install /dev/sdb
nano /etc/default/grub
GRUB_CMDLINE_LINUX="domdadm"
grub2-mkconfig -o /boot/grub/grub.cfg
rm /stage3-*.tar.bz2*
emerge gentoolkit
exit
cd
umount -l /mnt/gentoo/dev{/shm,/pts,}
umount -l /mnt/gentoo{/boot,/proc,}
reboot
Réparation du RAID
mdadm --zero-superblock /dev/sdbX
mdadm –a /dev/mdY /dev/sdbX
cat /proc/mdstat (pour surveiller la reconstruction)
Puis on réécrit le boot sur les deux partitions :
grub2-install /dev/sda
grub2-install /dev/sdb