-- creation d'une petite machine virtuelle Debian, sv-t-vtl-bas19. Ici il s'agit d'un systeme XEN. Vous pouvez egalement utiliser VirtualBox ou autre pour creer la VM, notamment si vous etes sur un PC Windows. -- avec le user root sur sv-t-xenet02 (hote xen), depuis une session ssh root@sv-t-xenet02:~# cat /etc/*release PRETTY_NAME="Debian GNU/Linux bullseye/sid" NAME="Debian GNU/Linux" 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:~# xen-create-image --hostname sv-t-vtl-bas19 --ip=XX.XX.XX.XX --memory=1024MB --vcpus=1 --netmask=XX.XX.XX.XX --gateway=XX.XX.XX.XX --broadcast=XX.XX.XX.XX --lvm=xenpool01 --size=10G --dist=buster --password=XXXXX --force General Information -------------------- Hostname : sv-t-vtl-bas19 Distribution : buster Mirror : http://deb.debian.org/debian Partitions : swap 512M (swap) / 10G (ext4) Image type : full Memory size : 1024MB Kernel path : /boot/vmlinuz-4.19.0-5-amd64 Initrd path : /boot/initrd.img-4.19.0-5-amd64 Networking Information ---------------------- IP Address 1 : xx.xx.xx.xx [MAC: 00:16:3E:B2:2F:E8] Netmask : xx.xx.xx.xx Broadcast : xx.xx.xx.xx Gateway : xx.xx.xx.xx Creating swap on /dev/xenpool01/sv-t-vtl-bas19-swap Done Creating ext4 filesystem on /dev/xenpool01/sv-t-vtl-bas19-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-bas19.log Installation Summary --------------------- Hostname : sv-t-vtl-bas19 Distribution : buster MAC Address : 00:16:3E:B2:2F:E8 IP Address(es) : XX.XX.XX.XX SSH Fingerprint : SHA256:iPOJ8wvd875Y8x3MNNUry3XbpQIJLFmpv56dHKQwV5c (DSA) SSH Fingerprint : SHA256:5YAcoXWxbkItLYgU3LPMJ+LfEPEKZKR3LgYj7XS9/FA (ECDSA) SSH Fingerprint : SHA256:VVAuRbrihX7Jcvp76cd3KMXZOlb60zSDcQPpI50U5yA (ED25519) SSH Fingerprint : SHA256:+KPjBgq+dqZ6yp63d2F3Uoias+vJ5KUwt+LwtfmwSxs (RSA) Root Password : XXXXXX -- demarrage de la machine virtuelle debian sv-t-vtl-bas19 -- avec le user root sur sv-t-xenet02 (hote xen) root@sv-t-xenet02:/etc/xen# xl create sv-t-vtl-bas19.cfg Parsing config from sv-t-vtl-bas19.cfg -- connexion a la console de sv-t-vtl-bas19, vous ne pouvez pas vous connecter root en ssh a distance par defaut et il est deconseille d'activer cette possibilite (securite) -- avec le user root sur sv-t-vtl-bas19 (guest xen), depuis la console root@sv-t-vtl-bas19:~# cat /etc/*release PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster 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-vtl-bas19:~# 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-bas19:~# 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. -- nouvelle session pour beneficier de la nouvelle locale par defaut -- avec le user root sur sv-t-vtl-bas19 (guest xen), depuis la console root@sv-t-vtl-bas19:~# su - root@sv-t-vtl-bas19:~# 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-bas19 (guest xen), depuis la console vi /etc/apt/apt.conf Acquire::Proxy "http://UTILISATEUR:MOT_DE_PASSE@ADRESSE_IP_PROXY:PORT_PROXY"; root@sv-t-vtl-bas19:~# apt-get install postgresql ... Les NOUVEAUX paquets suivants seront installes : bzip2 distro-info-data file libexpat1 libicu63 libldap-2.4-2 libldap-common libllvm7 libmagic-mgc libmagic1 libmpdec2 libpq5 libpython3-stdlib libpython3.7-minimal libpython3.7-stdlib libreadline7 libsasl2-2 libsasl2-modules libsasl2-modules-db libsensors-config libsensors5 libsqlite3-0 libxml2 libxslt1.1 lsb-release mime-support openssl postgresql postgresql-11 postgresql-client-11 postgresql-client-common postgresql-common python3 python3-minimal python3.7 python3.7-minimal ssl-cert sysstat xz-utils 0 mis a jour, 39 nouvellement installes, 0 à enlever et 0 non mis à jour. Il est necessaire de prendre 46,6 Mo dans les archives. Apres cette operation, 186 Mo d'espace disque supplementaires seront utilises. ... pg_ctlcluster 11 main start Ver Cluster Port Status Owner Data directory Log file 11 main 5432 down postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log update-alternatives: utilisation de "/usr/share/postgresql/11/man/man1/postmaster.1.gz" pour fournir "/usr/share/man/man1/postmaster.1.gz" (postmaster.1.gz) en mode automatique Parametrage de postgresql (11+200+deb10u1) ... Parametrage de lsb-release (10.2019051400) ... Traitement des actions differees ("triggers") pour systemd (241-5) ... Traitement des actions differees ("triggers") pour libc-bin (2.28-10) ... root@sv-t-vtl-bas19:~# passwd postgres Nouveau mot de passe : Retapez le nouveau mot de passe : passwd: password updated successfully -- OK ... vous disposez a present d'une VM fonctionnelle pour PostgreSQL avec un cluster (ensemble de bases de donnees) configure par defaut. Vous n'avez plus besoin de la console pour les actions courantes et vous pouvez vous connecter "postgres" en ssh avec le mot de passe que vous venez d'affecter. A noter que cette configuration n'est pas adequate pour un serveur sur internet, il est recommande dans ce cas de ne PAS affecter de mot de passe au user OS PostgreSQL et de creer un autre utilisateur lambda. postgres@sv-t-vtl-bas19:~$ ps -ef | grep postgres postgres 2951 1 0 13:45 ? 00:00:00 /usr/lib/postgresql/11/bin/postgres -D /var/lib/postgresql/11/main -c config_file=/etc/postgresql/11/main/postgresql.conf postgres 2953 2951 0 13:45 ? 00:00:00 postgres: 11/main: checkpointer postgres 2954 2951 0 13:45 ? 00:00:00 postgres: 11/main: background writer postgres 2955 2951 0 13:45 ? 00:00:00 postgres: 11/main: walwriter postgres 2956 2951 0 13:45 ? 00:00:00 postgres: 11/main: autovacuum launcher postgres 2957 2951 0 13:45 ? 00:00:00 postgres: 11/main: stats collector postgres 2958 2951 0 13:45 ? 00:00:00 postgres: 11/main: logical replication launcher postgres@sv-t-vtl-bas19:~$ pg_lsclusters Ver Cluster Port Status Owner Data directory Log file 11 main 5432 online postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log -- Constat : le cluster s'appelle "main", son fichier de parametrage est "/etc/postgresql/11/main/postgresql.conf", son log est "/var/log/postgresql/postgresql-11-main.log" et ses donnees sont dans "/var/lib/postgresql/11/main". Il est possible de detruire ce cluster par defaut et d'en creer un autre si necessaire.