Tutoriels sur l'installation d'un serveur Web : Installation et pré configuration

Tout d'abord, installez un logiciel d'émulation type VMWare ou VirtualBox.
Je recommande personnellement VirtualBox, qui est libre.

Téléchargez la version vous concernant, installez là et, probablement, redémarrez.

Ensuite, rendez-vous sur le site de Debian, afin de récuperer la toute dernière version, notre petite Lenny : http://www.debian.org/distrib/.
Comme à l'accoutumé, téléchargez la version vous concernant.

Pour ma part, j'ai opté pour la version NetInst, petit iso de 180Mo qui contient l'essentiel, le reste étant mis à jour une fois l'installation terminée. C'est la version la plus propre d'après moi.

Ensuite, il va falloir définir le réseau de votre environnement émulé.
Deux options s'offrent à vous :

  • En tant que Bridge, histoire qu'il soit considéré comme une autre machine à part entière sur le réseau.
  • Ou en tant que "Host Only", si vous souhaitez que le serveur ne puisse communiquer qu'avec votre machine.

Comme cela dépends de votre choix, de votre émulateur et de votre OS, je ne vais pas faire un détail ici ! Vous êtes suffisamment grand pour trouver la porte d'entrée de Google :)

Afin que notre machine soit reconnue comme un serveur ayant une url (en supposant que l'on dispose d'un nom de domaine), on va modifier le fichier hosts, afin de pointer l'ip du serveur sur un faux nom. Nous utiliserons le nom de domaine http://www.example.org.

Vous trouverez le fichier hosts :

  • Windows : C:\Windows\System32\Drivers\etc\hosts
  • Linux : /etc/hosts

Ceci est pour la plupart des distribs, si vous ne le trouvez pas à l'adresse indiquée, googlez :p

Ensuite, créez votre environnement virtualisé, en choisissant le mode (Bridge/Host-Only) et démarrez l'installation.

L'installation en elle-même n'est pas très compliquée, c'est pour cela qu'elle ne sera pas détaillée ici :) Je vous conseil juste de n'installer que le système standard (une invite vous proposera d'installer, avec, divers serveurs, environnement de bureau, etc. Ne prennez que "Système  Standard").

L'installation est terminée ! :) Maintenant, nous allons définir l'ip en statique, histoire de ne pas avoir de mauvaise surprise :p

Editez le fichier /etc/network/interfaces avec votre éditeur préféré (vi, vim, nano, ...), et mettez ceci :

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

#eth0 is enabled during initrd
auto eth0:0
iface eth0:0 inet static
        address xxx.xxx.xxx.xxx
        netmask 255.255.255.0

Ou xxx.xxx.xxx.xxx sera l'ip que vous aurez définit (à vous d'adapter le netmask ensuite). Nous récapitulerons toutes ces informations dans le prochain article.

Et bien voilà ! Votre nouvelle Debian est prête à subir des attaques d'apt !

Le prochain article récapitulera les différentes informations nécéssaires, qui seront récapitulées au début de chaque tutoriels.

Si vous avez des questions/conseils, n'hésitez pas !

Filed under  //  Debian   Howtos   Scripts   Unix/Linux   host-only   installation   lenny   pré configuration   server   virtualbox   vmware   web  
Posted by Cyril Nicodème 

How to easily map ports on VirtualBox

To setup easily a map between your host and your guest, you need to do these commands in root :

VBoxManage setextradata {guest name} "VBoxInternal/Devices/pcnet/0/LUN#0/Config/{mapping name}/HostPort" {host port}
VBoxManage setextradata {guest name} "VBoxInternal/Devices/pcnet/0/LUN#0/Config/{mapping name}/GuestPort" {guest port}
VBoxManage setextradata {guest name} "VBoxInternal/Devices/pcnet/0/LUN#0/Config/{mapping name}/UDP" 0
  • {guest name} : Name of the guest
  • {mapping name} : String to identify the nature of the mapping (http, ftp, ssh etc)
  • {host port} : Host port
  • {guest port} : Guest port

To remove a map, just do theses same commands, but without {port guest} :)

(Find at : http://nicoleau.fabien.free.fr/weblog/index.php?post/2007/11/11/Config-NAT-pour-acceder-a-votre-machine-virtuelle-VirtualBox (in french))

Filed under  //  guest   host   map   mapping   port   virtualbox  
Posted by Cyril Nicodème 

How to setup a bridge between a virtual machine with VirtualBox and a Fedora host

Hi everybody, I will try to show you how it's easy to configure your virtual machine to be visible on the network, like another machine.

First, you need to install the bridge-utils package
yum install bridge-utils
and you need to create a bridge.
Go to /etc/sysconfig/network-scripts/ and create a new file (ifcfg-tap0 for example) :
vi /etc/sysconfig/network-script/ifcfg-tap0

IMPORTANT NOTE : NetworkManager load the scripts files in alphabetical order. If you set the name of your bridge with the first letter is before the first letter of your interface, it will not work ! (br0 connected to eth0 for example). Take care about that !

Put these lines :
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
BOOTPROTO=static #or dhcp, and leave the next
IPADDR=192.168.0.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
BROADCAST=192.168.0.255
then open your network configuration file (for example ifcfg-eth0) and add these lines (if they didn't exists) :
PEERDNS=no
TYPE=Ethernet
USERCTL=yes
IPV6INIT=yes
BRIDGE=tap0
Restart the network service by
su -lc 'service network restart'
Finally, and the most important, in root, you need to specify the bridge for VirtualBox with this command :
VBoxAddIf vbox0 {user} tap0

With {user} your current user, br0 the name of your bridge, and vbox0, it's the name of the network you will need to specify in the preferences of VirtualBox, network section. Select Host Network Adaptater, and specify vbox0.

Voilà ! You can launch your virtual machine in bridge mode ! :)

(See : http://forums.fedora-fr.org/viewtopic.php?pid=200600 for more info (in french))

You can have some issues after a reboot, with your virtual machine that cannot connect to the web. If it happens, stop your vm, remove the interface and re-add it to virtualbox (in root mode) and start your vm.

# Command to remove an interface :
VBoxDeleteIF vbox0

# And now, we add it:
VBoxAddIF vbox0  tap0

Filed under  //  Fedora   Howtos   Unix/Linux   box   bridge   virtual   virtualbox  
Posted by Cyril Nicodème