-- creation d'une petite machine virtuelle Debian, sv-t-vtl-bas11. Ici il s'agit d'un système XEN. Vous pouvez également utiliser VirtualBox ou autre pour créer la VM, notamment si vous êtes sur un PC Windows. -- avec le user root sur sv-t-xenet02 (hote xen), depuis une session ssh root@sv-t-xenet02:/etc/xen# cat /etc/*release PRETTY_NAME="Debian GNU/Linux 9 (stretch)" NAME="Debian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)" ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" root@sv-t-xenet02:/etc/xen# xen-create-image --hostname sv-t-vtl-bas11 --ip=xx.xx.xx.xx --memory=4096MB --vcpus=1 --netmask=xx.xx.xx.xx --gateway=xx.xx.xx.xx --broadcast=xx.xx.xx.xx --lvm=xenpool01 --size=30G --dist=stretch --password=xxxxx General Information -------------------- Hostname : sv-t-vtl-bas11 Distribution : stretch Mirror : http://httpredir.debian.org/debian Partitions : swap 512M (swap) / 30G (ext4) Image type : full Memory size : 4096MB Kernel path : /boot/vmlinuz-4.9.0-3-amd64 Initrd path : /boot/initrd.img-4.9.0-3-amd64 Networking Information ---------------------- IP Address 1 : xx.xx.xx.xx [MAC: 00:16:3E:27:D4:A0] Netmask : xx.xx.xx.xx Broadcast : xx.xx.xx.xx Gateway : xx.xx.xx.xx Creating swap on /dev/xenpool01/sv-t-vtl-bas11-swap Done Creating ext4 filesystem on /dev/xenpool01/sv-t-vtl-bas11-disk Done Installation method: debootstrap Done Running hooks Done No role scripts were specified. Skipping Creating Xen configuration file Done No role scripts were specified. Skipping Setting up root password Generating a password for the new guest. All done Logfile produced at: /var/log/xen-tools/sv-t-vtl-bas11.log Installation Summary --------------------- Hostname : sv-t-vtl-bas11 Distribution : stretch MAC Address : 00:16:3E:27:D4:A0 IP Address(es) : xx.xx.xx.xx SSH Fingerprint : SHA256:he640v5zFM0w89PpNpmJ2kKR6T4aEujnec9WrswlTgI (DSA) SSH Fingerprint : SHA256:vkzJrc18ZAAfdWFbuavpyrnJG6BGImu86coDXJpxxgQ (ECDSA) SSH Fingerprint : SHA256:V6mP0JlBGhKmUL3dS5EzfXNDR+MmV7QND6jE3Avq/fs (ED25519) SSH Fingerprint : SHA256:ebguluBHJA78iAmNixO5QI9nB80PJQAFwdeo/WIRxtE (RSA) Root Password : xxxxx -- démarrage de la machine virtuelle debian sv-t-vtl-bas11 -- avec le user root sur sv-t-xenet02 (hote xen) root@sv-t-xenet02:/etc/xen# xl create sv-t-vtl-bas11.cfg Parsing config from sv-t-vtl-bas11.cfg -- connexion à la console de sv-t-vtl-bas11, vous ne pouvez pas vous connecter root en ssh à distance par défaut et il est déconseillé d'activer cette possibilité (sécurité) -- avec le user root sur sv-t-vtl-bas11 (guest xen), depuis la console xl console sv-t-vtl-bas11 (user : root , mdp : celui que vous avez choisi avec password= lors de la création avec xen-create-image) -- configurer la localisation française, jeu de caractère UTF8 sur sv-t-vtl-bas11 (choisir fr_FR.UTF-8) -- avec le user root sur sv-t-vtl-bas11 (guest xen), depuis la console root@sv-t-vtl-bas11:~# locale LANG=C LANGUAGE= LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C" LC_PAPER="C" LC_NAME="C" LC_ADDRESS="C" LC_TELEPHONE="C" LC_MEASUREMENT="C" LC_IDENTIFICATION="C" LC_ALL= root@sv-t-vtl-bas11:~# dpkg-reconfigure locales Package configuration lqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring locales tqqqqqqqqqqqqqqqqqqqqqqqqqqk x Locales are a framework to switch between multiple languages and allow x x users to use their language, country, characters, collation order, etc. x x x x Please choose which locales to generate. UTF-8 locales should be chosen x x by default, particularly for new installations. Other character sets may x x be useful for backwards compatibility with older systems and software. x x x x Locales to be generated: x x x x [ ] fr_CH ISO-8859-1 x x [ ] fr_CH.UTF-8 UTF-8 x x [ ] fr_FR ISO-8859-1 a x x [*] fr_FR.UTF-8 UTF-8 a x x [ ] fr_FR@euro ISO-8859-15 x x x x x x x x x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj Package configuration lqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring locales tqqqqqqqqqqqqqqqqqqqqqqqqqqk x Many packages in Debian use locales to display text in the correct x x language for the user. You can choose a default locale for the system x x from the generated locales. x x x x This will select the default language for the entire system. If this x x system is a multi-user system where not all users are able to speak the x x default language, they will experience difficulties. x x x x Default locale for the system environment: x x x x None x x C.UTF-8 x x fr_FR.UTF-8 x x x x x x x x x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj Generating locales (this might take a while)... fr_FR.UTF-8... done Generation complete. root@sv-t-vtl-bas11:~# -- nouvelle session pour bénéficier de la nouvelle locale par défaut -- avec le user root sur sv-t-vtl-bas11 (guest xen), depuis la console root@sv-t-vtl-bas11:~# su - root@sv-t-vtl-bas11:~# locale LANG=fr_FR.UTF-8 LANGUAGE= LC_CTYPE="fr_FR.UTF-8" LC_NUMERIC="fr_FR.UTF-8" LC_TIME="fr_FR.UTF-8" LC_COLLATE="fr_FR.UTF-8" LC_MONETARY="fr_FR.UTF-8" LC_MESSAGES="fr_FR.UTF-8" LC_PAPER="fr_FR.UTF-8" LC_NAME="fr_FR.UTF-8" LC_ADDRESS="fr_FR.UTF-8" LC_TELEPHONE="fr_FR.UTF-8" LC_MEASUREMENT="fr_FR.UTF-8" LC_IDENTIFICATION="fr_FR.UTF-8" LC_ALL= -- installation de PostgreSQL -- avec le user root sur sv-t-vtl-bas11 (guest xen), depuis la console -- la configuration du proxy est necessaire uniquement avec un miroir Debian non accessible directement root@sv-t-vtl-bas11:~# export http_proxy=http://xx.xx.xx.xx:xx root@sv-t-vtl-bas11:~# apt-get install postgresql ... Creating config file /etc/logrotate.d/postgresql-common with new version Building PostgreSQL dictionaries from installed myspell/hunspell packages... Removing obsolete dictionary files: Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /lib/systemd/system/postgresql.service. Paramétrage de python3.5 (3.5.3-1) ... Paramétrage de libpython3-stdlib:amd64 (3.5.3-1) ... Paramétrage de postgresql-client-9.6 (9.6.3-3) ... update-alternatives: utilisation de « /usr/share/postgresql/9.6/man/man1/psql.1.gz » pour fournir « /usr/share/man/man1/psql.1.gz » (psql.1.gz) en mode automatique Paramétrage de postgresql-9.6 (9.6.3-3) ... Creating new cluster 9.6/main ... config /etc/postgresql/9.6/main data /var/lib/postgresql/9.6/main locale fr_FR.UTF-8 socket /var/run/postgresql port 5432 update-alternatives: utilisation de « /usr/share/postgresql/9.6/man/man1/postmaster.1.gz » pour fournir « /usr/share/man/man1/postmaster.1.gz » (postmaster.1.gz) en mode automatique Paramétrage de postgresql (9.6+181) ... Paramétrage de postgresql-contrib-9.6 (9.6.3-3) ... Paramétrage de python3 (3.5.3-1) ... running python rtupdate hooks for python3.5... running python post-rtupdate hooks for python3.5... Paramétrage de lsb-release (9.20161125) ... Paramétrage de dh-python (2.20170125) ... Traitement des actions différées (« triggers ») pour libc-bin (2.24-11) ... Traitement des actions différées (« triggers ») pour sgml-base (1.29) ... Traitement des actions différées (« triggers ») pour systemd (232-25) ... -- modification du mot de passe du user postgres (mot de passe à votre choix) -- avec le user root sur sv-t-vtl-bas11 (guest xen), depuis la console root@sv-t-vtl-bas11:~# passwd postgres Entrez le nouveau mot de passe UNIX : Retapez le nouveau mot de passe UNIX : passwd: password updated successfully -- OK ... vous disposez à présent d'une VM fonctionnelle pour PostgreSQL avec un cluster (ensemble de bases de données) configuré par défaut. Vous n'avez plus besoin de la console pour les actions courante et vous pouvez vous connecter "postgres" en ssh avec le mot de passe que vous venez de trouver. postgres@sv-t-vtl-bas11:~$ ps -ef | grep postg postgres 2929 1 0 16:36 ? 00:00:00 /usr/lib/postgresql/9.6/bin/postgres -D /var/lib/postgresql/9.6/main -c config_file=/etc/postgresql/9.6/main/postgresql.conf postgres 2931 2929 0 16:36 ? 00:00:00 postgres: 9.6/main: checkpointer process postgres 2932 2929 0 16:36 ? 00:00:00 postgres: 9.6/main: writer process postgres 2933 2929 0 16:36 ? 00:00:00 postgres: 9.6/main: wal writer process postgres 2934 2929 0 16:36 ? 00:00:00 postgres: 9.6/main: autovacuum launcher process postgres 2935 2929 0 16:36 ? 00:00:00 postgres: 9.6/main: stats collector process root@sv-t-vtl-bas11:~# pg_lsclusters Ver Cluster Port Status Owner Data directory Log file 9.6 main 5432 online postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log -- Constat : le cluster s'appelle "main", son fichier de paramétrage est "/etc/postgresql/9.6/main/postgresql.conf", son log est "/var/log/postgresql/postgresql-9.6-main.log" et ses données sont dans "/var/lib/postgresql/9.6/main". Nous pourrons détruire ce cluster par défaut, en créer un autre etc.