Après avoir rebooté en mode rescue pro (avec la clé publique c’est plus facile), il faut nettoyer les partitions dans parted (commande rm) puis créer une partition de BiosBoot pour grub (si vous avez un disque en GPT)
root@rescue:~# parted GNU Parted 3.1.52-1c659-dirty Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) p Model: ATA ST32000641AS (scsi) Disk /dev/sda: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags (parted) mkpart Partition name? []? primary File system type? [ext2]? ext4 Start? 1 End? 100M (parted) p Model: ATA ST32000641AS (scsi) Disk /dev/sda: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 99.6MB 98.6MB primary (parted)
Puis la « flagguer » correctement
(parted) set 1 bios_grub on (parted) p Model: ATA ST32000641AS (scsi) Disk /dev/sda: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 99.6MB 98.6MB primary bios_grub (parted)
Ensuite on créer une partition avec tout le reste :
(parted) mkpart Partition name? []? pv File system type? [ext2]? ext4 Start? 100M End? -1 (parted) p Model: ATA ST32000641AS (scsi) Disk /dev/sda: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 99.6MB 98.6MB primary bios_grub 2 99.6MB 2000GB 2000GB pv (parted)
Puis on positionne le type LVM sur cette deuxième partition :
(parted) set 2 lvm New state? [on]/off? on (parted) p Model: ATA ST32000641AS (scsi) Disk /dev/sda: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 99.6MB 98.6MB primary bios_grub 2 99.6MB 2000GB 2000GB pv lvm (parted) (parted) quit Information: You may need to update /etc/fstab. root@rescue:~# pvcreate /dev/sda2 Writing physical volume data to disk "/dev/sda2" Physical volume "/dev/sda2" successfully created root@rescue:~# root@rescue:/# vgcreate rootvg /dev/sda2 Volume group "rootvg" successfully created root@rescue:/# root@rescue:/# lvcreate -n slashlv -L10G rootvg Logical volume "slashlv" created root@rescue:/# lvcreate -n varlv -L2G rootvg Logical volume "varlv" created root@rescue:/# lvcreate -n tmplv -L2G rootvg Logical volume "tmplv" created root@rescue:/# lvcreate -n varliblv -L10G rootvg Logical volume "varliblv" created root@rescue:/# root@rescue:/# mkfs.ext4 /dev/rootvg/slashlv mke2fs 1.42.5 (29-Jul-2012) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 655360 inodes, 2621440 blocks 131072 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2684354560 80 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: mdone root@rescue:/# mkfs.ext4 /dev/rootvg/varlv mke2fs 1.42.5 (29-Jul-2012) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 131072 inodes, 524288 blocks 26214 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=536870912 16 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Allocating group tables: done Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done root@rescue:/# mkfs.ext4 /dev/rootvg/tmplv mke2fs 1.42.5 (29-Jul-2012) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 131072 inodes, 524288 blocks 26214 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=536870912 16 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Allocating group tables: done Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done root@rescue:/# mkfs.ext4 /dev/rootvg/varliblv mke2fs 1.42.5 (29-Jul-2012) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 655360 inodes, 2621440 blocks 131072 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2684354560 80 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done root@rescue:/# root@rescue:/# mount /dev/rootvg/slashlv /mnt/ root@rescue:/# mkdir /mnt/var root@rescue:/# mount /dev/rootvg/varlv /mnt/var root@rescue:/# mkdir /mnt/var/lib root@rescue:/# mount /dev/rootvg/varliblv /mnt/var/lib/ root@rescue:/# mkdir /mnt/tmp root@rescue:/# mount /dev/rootvg/tmplv /mnt/tmp root@rescue:~# mkdir /mnt/proc root@rescue:~# mkdir /mnt/sys root@rescue:~# mkdir /mnt/dev
Télécharger et recopier debootstrap dans /mnt/tmp (il faut un endroit où on a le droit d’écrire)
jylenhof@portable-jylenhof:~$ scp debootstrap_1.0.53_all.deb root@jedimaster.lenhof.eu.org:/mnt/tmp/ Warning: the RSA host key for 'jedimaster.lenhof.eu.org' differs from the key for the IP address '91.121.74.224' Offending key for IP in /home/jylenhof/.ssh/known_hosts:16 Matching host key in /home/jylenhof/.ssh/known_hosts:18 Are you sure you want to continue connecting (yes/no)? yes root@jedimaster.lenhof.eu.org's password: debootstrap_1.0.53_all.deb 100% 59KB 58.8KB/s 00:00jylenhof@portable-jylenhof:~$ root@rescue:~# cd /mnt/tmp/ root@rescue:/mnt/tmp# ls debootstrap_1.0.53_all.deb lost+found root@rescue:/mnt/tmp# ar x debootstrap_1.0.53_all.deb root@rescue:/mnt/tmp# ls control.tar.gz debian-binary lost+found data.tar.gz debootstrap_1.0.53_all.deb root@rescue:/mnt/tmp# tar xvzf data.tar.gz ./ ./usr/ ./usr/share/ ./usr/share/man/ ./usr/share/man/man8/ ./usr/share/man/man8/debootstrap.8.gz ./usr/share/doc/ ./usr/share/doc/debootstrap/ ./usr/share/doc/debootstrap/README ./usr/share/doc/debootstrap/copyright ./usr/share/doc/debootstrap/changelog.gz ./usr/share/debootstrap/ ./usr/share/debootstrap/devices.tar.gz ./usr/share/debootstrap/functions ./usr/share/debootstrap/scripts/ ./usr/share/debootstrap/scripts/potato ./usr/share/debootstrap/scripts/sid ./usr/share/debootstrap/scripts/breezy ./usr/share/debootstrap/scripts/hoary.buildd ./usr/share/debootstrap/scripts/woody ./usr/share/debootstrap/scripts/sarge.fakechroot ./usr/share/debootstrap/scripts/warty ./usr/share/debootstrap/scripts/warty.buildd ./usr/share/debootstrap/scripts/hoary ./usr/share/debootstrap/scripts/feisty ./usr/share/debootstrap/scripts/gutsy ./usr/share/debootstrap/scripts/sarge ./usr/share/debootstrap/scripts/sarge.buildd ./usr/share/debootstrap/scripts/edgy ./usr/share/debootstrap/scripts/woody.buildd ./usr/share/debootstrap/scripts/dapper ./usr/sbin/ ./usr/sbin/debootstrap ./usr/share/debootstrap/scripts/quantal ./usr/share/debootstrap/scripts/raring ./usr/share/debootstrap/scripts/precise ./usr/share/debootstrap/scripts/oldstable ./usr/share/debootstrap/scripts/jaunty ./usr/share/debootstrap/scripts/natty ./usr/share/debootstrap/scripts/karmic ./usr/share/debootstrap/scripts/oneiric ./usr/share/debootstrap/scripts/hardy ./usr/share/debootstrap/scripts/squeeze ./usr/share/debootstrap/scripts/intrepid ./usr/share/debootstrap/scripts/etch-m68k ./usr/share/debootstrap/scripts/etch ./usr/share/debootstrap/scripts/unstable ./usr/share/debootstrap/scripts/saucy ./usr/share/debootstrap/scripts/testing ./usr/share/debootstrap/scripts/maverick ./usr/share/debootstrap/scripts/lucid ./usr/share/debootstrap/scripts/lenny ./usr/share/debootstrap/scripts/wheezy ./usr/share/debootstrap/scripts/stable ./usr/share/debootstrap/scripts/jessie root@rescue:/mnt/tmp# ./usr/sbin/debootstrap --arch amd64 wheezy /mnt/ http://ftp.us.debian.org/debian .... root@rescue:~# mount --bind /proc /mnt/proc root@rescue:~# mount --bind /sys /mnt/sys root@rescue:/mnt# mount --bind /dev /mnt/dev root@rescue:/mnt# LANG=C.UTF-8 chroot /mnt/ /bin/bash apt-get install locales lvm2 bind9-host dpkg-reconfigure locales
Choisir en_US.UTF-8 & fr_FR.UTF-8 et choisir l’un des deux en langue principal
dpkg-reconfigure tzdata
vi /etc/hostname
vi /etc/network/interfaces
vi /etc/resolv.conf
vi /etc/hosts
vi /etc/fstab
Modification /etc/apt/sources.list (ajouter notamment ce qui est security)
# Debian packages for stable deb http://ftp2.fr.debian.org/debian/ stable main contrib # Uncomment the deb-src line if you want 'apt-get source' # to work with most packages. deb-src http://ftp2.fr.debian.org/debian/ stable main contrib # Security updates for stable deb http://security.debian.org/ stable/updates main contrib deb-src http://security.debian.org/ stable/updates main contrib deb http://ftp2.fr.debian.org/debian/ wheezy-updates main deb-src http://ftp2.fr.debian.org/debian/ wheezy-updates main deb http://ftp2.fr.debian.org/debian/ wheezy-backports main deb-src http://ftp2.fr.debian.org/debian/ wheezy-backports main
apt-get update apt-get dist-upgrade tasksel install standard ssh apt-get install grub2 linux-image-amd64 initramfs-tools openssh-server