Installation d’une debian avec LVM sur un serveur OVH depuis le mode rescue-pro

, par  Jean-Yves LENHOF , popularité : 2%

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<br></br>
./<br></br>
./usr/<br></br>
./usr/share/<br></br>
./usr/share/man/<br></br>
./usr/share/man/man8/<br></br>
./usr/share/man/man8/debootstrap.8.gz<br></br>
./usr/share/doc/<br></br>
./usr/share/doc/debootstrap/<br></br>
./usr/share/doc/debootstrap/README<br></br>
./usr/share/doc/debootstrap/copyright<br></br>
./usr/share/doc/debootstrap/changelog.gz<br></br>
./usr/share/debootstrap/<br></br>
./usr/share/debootstrap/devices.tar.gz<br></br>
./usr/share/debootstrap/functions<br></br>
./usr/share/debootstrap/scripts/<br></br>
./usr/share/debootstrap/scripts/potato<br></br>
./usr/share/debootstrap/scripts/sid<br></br>
./usr/share/debootstrap/scripts/breezy<br></br>
./usr/share/debootstrap/scripts/hoary.buildd<br></br>
./usr/share/debootstrap/scripts/woody<br></br>
./usr/share/debootstrap/scripts/sarge.fakechroot<br></br>
./usr/share/debootstrap/scripts/warty<br></br>
./usr/share/debootstrap/scripts/warty.buildd<br></br>
./usr/share/debootstrap/scripts/hoary<br></br>
./usr/share/debootstrap/scripts/feisty<br></br>
./usr/share/debootstrap/scripts/gutsy<br></br>
./usr/share/debootstrap/scripts/sarge<br></br>
./usr/share/debootstrap/scripts/sarge.buildd<br></br>
./usr/share/debootstrap/scripts/edgy<br></br>
./usr/share/debootstrap/scripts/woody.buildd<br></br>
./usr/share/debootstrap/scripts/dapper<br></br>
./usr/sbin/<br></br>
./usr/sbin/debootstrap<br></br>
./usr/share/debootstrap/scripts/quantal<br></br>
./usr/share/debootstrap/scripts/raring<br></br>
./usr/share/debootstrap/scripts/precise<br></br>
./usr/share/debootstrap/scripts/oldstable<br></br>
./usr/share/debootstrap/scripts/jaunty<br></br>
./usr/share/debootstrap/scripts/natty<br></br>
./usr/share/debootstrap/scripts/karmic<br></br>
./usr/share/debootstrap/scripts/oneiric<br></br>
./usr/share/debootstrap/scripts/hardy<br></br>
./usr/share/debootstrap/scripts/squeeze<br></br>
./usr/share/debootstrap/scripts/intrepid<br></br>
./usr/share/debootstrap/scripts/etch-m68k<br></br>
./usr/share/debootstrap/scripts/etch<br></br>
./usr/share/debootstrap/scripts/unstable<br></br>
./usr/share/debootstrap/scripts/saucy<br></br>
./usr/share/debootstrap/scripts/testing<br></br>
./usr/share/debootstrap/scripts/maverick<br></br>
./usr/share/debootstrap/scripts/lucid<br></br>
./usr/share/debootstrap/scripts/lenny<br></br>
./usr/share/debootstrap/scripts/wheezy<br></br>
./usr/share/debootstrap/scripts/stable<br></br>
./usr/share/debootstrap/scripts/jessie<br></br>
root@rescue:/mnt/tmp#<br></br>




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

Tags : adminsys, Astuces, Debian, Linux

Cet article est repris du site http://blog.lenhof.eu.org/2013/08/1...

Sites favoris Tous les sites

84 sites référencés dans ce secteur