Proxmox et OpenVZ

De Linux Server Wiki
Aller à la navigation Aller à la recherche


Partitionnement du disque dur

Pour commencer, partitionnez votre disque. Faites une partition / de 15Go, un swap, et enfin, une partition LVM2 avec l'espace restant.

Nous allons maintenant créer notre architecture LVM puis le système de fichier :

pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created
vgcreate pve /dev/sda3
  Volume group "pve" successfully created
vgdisplay -v pve
    Using volume group(s) on command line
    Finding volume group "pve"
  --- Volume group ---
  VG Name               pve
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               215.09 GB
  PE Size               4.00 MB
  Total PE              55064
  Alloc PE / Size       0 / 0   
  Free  PE / Size       55064 / 215.09 GB
  VG UUID               AenAEU-jdG2-RUh1-4khe-R990-MInR-cdRIe0
   
  --- Physical volumes ---
  PV Name               /dev/sda3     
  PV UUID               CsIxAk-xa18-1W2q-jm1Y-fVqg-VSnW-KMaXvx
  PV Status             allocatable
  Total PE / Free PE    55064 / 55064
   
lvcreate -l55064 -n data pve
  Logical volume "data" created
lvdisplay -v /dev/pve/data
    Using logical volume(s) on command line
  --- Logical volume ---
  LV Name                /dev/pve/data
  VG Name                pve
  LV UUID                KlFCb8-yE7K-NYCN-RNnN-LEV3-maIw-mDtZZq
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                215.09 GB
  Current LE             55064
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
mkfs.ext3 /dev/pve/data
mkswap /dev/sda2
mkfs.ext3 /dev/sda1

Installation du système de base

mount /dev/sda1 /mnt
debootstrap --arch=amd64 lenny /mnt
...
I: Base system installed successfully.

Configuration de debian et installation de proxmox

mount -o bind /proc /mnt/proc
mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys
chroot /mnt

Modifiez le fichier sysctl.conf afin de permettre le forwaring ipv6 :

net.ipv4.ip_forward=1
aptitude update
aptitude safe-upgrade
aptitude install locales 
dpkg-reconfigure locales
aptitude install console-data
dpkg-reconfigure console-data # from arch > french > latin9)

A ajouter dans le source.list :

# PVE packages provided by proxmox.com
deb ftp://download.proxmox.com/debian lenny pve

puis :

wget -O- "http://download.proxmox.com/debian/key.asc" | apt-key add -
aptitude update

Pour profiter d'openVZ, installez le kernel 2.6.32* :

aptitude install pve-kernel-2.6.32-4-pve

Si vous n'aviez pas grub d'installé :

mkdir /boot/grub
grub-install /dev/sda

Créer et configurer /boot/grub/menu.lst

Installez les headers du kernel (optionnel) :

aptitude install pve-headers-2.6.32-4-pve lvm2
tzselect
dpkg-reconfigure tzdata
aptitude install openssh-server
aptitude install proxmox-ve-2.6.32 ntp

Utiliser son propre certificat

Je vous renvoi sur http://wiki.csnu.org/index.php?title=Installation_et_configuration_de_OpenSSL pour la mise en place d'une autorité de certification. Dans l'exemple suivant, je créé un certificat proxmox et le signe avec l'autorité onyx_ca :

openssl req -newkey rsa:2048 -keyout proxmox.key -out proxmox.req
openssl ca -name onyx_ca -extensions PROXMOX -in proxmox.req -out proxmox.pem
mkdir /etc/apache2/ssl/
mv proxmox.* /etc/apache2/ssl/
cat /etc/ssl/root_ca/root_ca.pem /etc/ssl/onyx_ca/onyx_ca.pem > /etc/apache2/ssl/cachain.pem

Modifiez le fichier /etc/apache2/sites-enabled/pve.conf comme suit :

<VirtualHost *:443>
    SSLEngine on
    SSLProtocol all -SSLv2
    #SSLCertificateFile /etc/pve/pve-ssl.pem
    #SSLCertificateKeyFile /etc/pve/pve-ssl.key
    SSLCertificateFile /etc/apache2/ssl/proxmox.pem
    SSLCertificateKeyFile /etc/apache2/ssl/proxmox.key
    SSLCertificateChainFile /etc/apache2/ssl/cachain.pem

    RewriteEngine on
    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
    RewriteRule .* - [F]
 </VirtualHost>

Ajouter des templates manuellement

Il suffit de télécharger directement les archives dans /var/lib/vz/template/cache/. Vous pouvez trouver des templates sur http://download.proxmox.com/appliances/ et http://wiki.openvz.org/Download/template/precreated

Partager des fichiers d'un VE à un autre VE