Installer Oracle Linux sur un serveur OVH

Oracle Linux offre plusieurs avantages dont celui d’être maintenu par Oracle, totalement gratuit et très compatible RedHat, il serait dommage de ne pas en profiter.

Pour mener cette installation à bien il faudra procéder en plusieurs étapes:

  • Repérer les sources à installer
  • Se créer une clé de connexion de type RSA
  • Réaliser l’installation sur un serveur OVH
  • Finaliser l’installation

Repérer les sources à installer

Pour installer des images personnalisées OVH requiert soit des fichers RAW soit des fichiers qcow2. On ne pourra donc pas utiliser une image DVD ISO. Le liens vers les fichier qcow2 se trouve dans la page de téléchargement des linux Oracle, il n s’agit donc pas d’un téléchargement classique mais d’un téléchargement d’image cloud

Pour l’exemple j’ai installé l’image OL9U5_x86_64-kvm-b259.qcow2, donc Oracle Linux 9.5 pour X86 (l’image existe aussi pour ARW)

Se créer une clé de connexion de type RSA

Lors de l’installation, demandera facultativement le renseignement d’une clé publique RSA. Faites le sinon vous ne pourrez pas vous connecter à votre VM. Si vous n’en n’avez pas, pour mémoire, la création des clés RSA se fait comme suit sur linux:

ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/olivier/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): MaPassPhraseQuiVaBien
Enter same passphrase again: MaPassPhraseQuiVaBien
Your identification has been saved in /home/olivier/.ssh/id_rsa
Your public key has been saved in /home/olivier/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:jwZ7qp/Rwezt8SdmJFU9Yxq1PfcvTxq5SS9/g3KnBSs olivier@monserveur
The key's randomart image is:
+---[RSA 3072]----+
| +..          .o |
|  o+=         .++|
|             .+o=|
|       o    .   +|
|      .    . .  .|
|       =  . . o..|
|      o * +E .*.o|
|       * . +  +%.|
|    .o+   .o++  *|
+----[SHA256]-----+

La chaine à fournir à OVH sera celle issue du fichier ~/.ssh/id_rsa.pub

Réaliser l’installation sur un serveur OVH

Dans votre console OVH choisir Système d’exploitation (OS)

. Un premier écran apparait pour valider le type d’installation souhaité, il faut choisir le type d’OS Personnalisé et le type CUSTOM Bring Your Own Image – byoi. Les autres options devront alors être grisées.

La pagesuivante décrit l’installation. Vous pouvez vous choisir un nom de serveur si vous en possédez le domaine. Il faudra absolument saisir votre clé SSH publique (éventuellement créée à l’étape précédente) puis saisir l’URL de l’image choisie, son type, son chekcsum (et le type de checksum) et enfin renseigner le chemi du bootloader EFI. Ce chemin est le suivant :

/boot/efi/EFI/redhat/shimx64.efi

.

Enregistrer tout ça et lancer l’installation.

Après un moment, OVH vous envoie un mail pour dire que c’est installé. Vous pouvez alors vous connecter à votre serveur avec l’utilisateur cloud-user qui connait votre clé et est capable de lancer la commande sudo su -.

Finaliser l’installation

Une fois connecté vous constaterez que tout votre disque n’a pas été alloué, l’image allour un peu plus de 40G, il va donc falloir utiliser le LVM pour allouer le reste du disque.

Allocation du disque

Diagnostique de c qui a été alloué :

[root@oralinux ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     4.0M     0  4.0M   0% /dev
tmpfs                         16G     0   16G   0% /dev/shm
tmpfs                        6.3G   17M  6.3G   1% /run
/dev/mapper/vg_main-lv_root   32G  1.5G   31G   5% /
/dev/sda3                    960M  114M  847M  12% /boot
/dev/sda2                    200M  6.3M  194M   4% /boot/efi
tmpfs                        3.2G     0  3.2G   0% /run/user/1000

Reste quasiment 80 Go non alloués sur mon disque de 120 Go.

[root@olivier-joly ~]# fdisk -l
Disk /dev/sda: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: INTEL SSDSA2CW12
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D7A34770-CD57-4695-A3BF-1009E0F81742

Device         Start       End  Sectors  Size Type
/dev/sda1       2048      4095     2048    1M BIOS boot
/dev/sda2       4096    413695   409600  200M EFI System
/dev/sda3     413696   2510847  2097152    1G Linux filesystem
/dev/sda4    2510848  77592575 75081728 35.8G Linux LVM
/dev/sda5  234438656 234441614     2959  1.4M Linux filesystem


Disk /dev/mapper/vg_main-lv_root: 31.8 GiB, 34145828864 bytes, 66691072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vg_main-lv_swap: 4 GiB, 4294967296 bytes, 8388608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@olivier-joly ~]# fdisk -x
Disk /dev/sda: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: INTEL SSDSA2CW12
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D7A34770-CD57-4695-A3BF-1009E0F81742
First LBA: 34
Last LBA: 234441614
Alternative LBA: 234441647
Partition entries LBA: 2
Allocated partition entries: 128

Device         Start       End  Sectors Type-UUID                            UUID                                 Name                 Attrs
/dev/sda1       2048      4095     2048 21686148-6449-6E6F-744E-656564454649 B56C6BE5-0756-47D6-9473-3AE8E2BBB1B3 biosboot
/dev/sda2       4096    413695   409600 C12A7328-F81F-11D2-BA4B-00A0C93EC93B 5DCFD669-E3C1-4825-8350-3A00AC0040FC EFI System Partition
/dev/sda3     413696   2510847  2097152 0FC63DAF-8483-4772-8E79-3D69D8477DE4 5AA41E19-C3E8-4D5A-A358-EDFC184E09EB boot
/dev/sda4    2510848  77592575 75081728 E6D6D379-F507-44C2-A23C-238F2A3DF928 B2C4E2DF-EAEB-4691-9517-AD56F0432013 pv_vol
/dev/sda5  234438656 234441614     2959 0FC63DAF-8483-4772-8E79-3D69D8477DE4 7B23E418-DE1A-4EB3-81A9-24F60A3846A6 config-drive


Disk /dev/mapper/vg_main-lv_root: 31.8 GiB, 34145828864 bytes, 66691072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vg_main-lv_swap: 4 GiB, 4294967296 bytes, 8388608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Mon disque est donc /dev/sda et 5 partition on été créées dessus. Je vais en créer une sixième avec l’espace restant (ce sera donc /dev/sda6 elle sera de type Linux LVM (30).

[root@oralinux ~]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.37.4).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.

Command (m for help): p

Disk /dev/sda: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: INTEL SSDSA2CW12
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D7A34770-CD57-4695-A3BF-1009E0F81742

Device         Start       End  Sectors  Size Type
/dev/sda1       2048      4095     2048    1M BIOS boot
/dev/sda2       4096    413695   409600  200M EFI System
/dev/sda3     413696   2510847  2097152    1G Linux filesystem
/dev/sda4    2510848  77592575 75081728 35.8G Linux LVM
/dev/sda5  234438656 234441614     2959  1.4M Linux filesystem

Command (m for help): d
Partition number (1-5, default 5):
Command (m for help): n
Partition number (6-128, default 6):
First sector (77592576-234438655, default 77592576): 77592576
Last sector, +/-sectors or +/-size{K,M,G,T,P} (77592576-234438655, default 234438655): 234438655

Created a new partition 6 of type 'Linux filesystem' and of size 74.8 GiB.

Command (m for help): t
Partition number (1-6, default 6): 6
Partition type or alias (type L to list all): 30

Changed type of partition 'Linux filesystem' to 'Linux LVM'.

Command (m for help): p
Disk /dev/sda: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: INTEL SSDSA2CW12
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D7A34770-CD57-4695-A3BF-1009E0F81742

Device         Start       End   Sectors  Size Type
/dev/sda1       2048      4095      2048    1M BIOS boot
/dev/sda2       4096    413695    409600  200M EFI System
/dev/sda3     413696   2510847   2097152    1G Linux filesystem
/dev/sda4    2510848  77592575  75081728 35.8G Linux LVM
/dev/sda5  234438656 234441614      2959  1.4M Linux filesystem
/dev/sda6   77592576 234438655 156846080 74.8G Linux LVM

Partition table entries are not in disk order.

Command (m for help): w
The partition table has been altered.
Syncing disks.

Je vais utiliser la partition de disque que je viens de créer afin de faire un nouveau file system que je monterai sous /data.

Création du volume group vg_data
[root@ooralinux ~]# vgs
  VG      #PV #LV #SN Attr   VSize  VFree
  vg_main   1   2   0 wz--n- 35.80g    0
[root@oralinux ~]# vgcreate vg_data /dev/sda6
  Physical volume "/dev/sda6" successfully created.
  Not creating system devices file due to existing VGs.
  Volume group "vg_data" successfully created
[root@oralinux ~]# vgs
  VG      #PV #LV #SN Attr   VSize   VFree
  vg_data   1   0   0 wz--n- <74.79g <74.79g
  vg_main   1   2   0 wz--n-  35.80g      0
Creation du volume logicque (logical volume ou LV) lv_data et du FS associé

On crée un FS de type xfs, c’est le type utilisé pour /.

[root@oralinux ~]# lvs
  LV      VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_data vg_data -wi-a----- <74.79g
  lv_root vg_main -wi-ao----  31.80g
[root@oralinux ~]# lvcreate -L 79G vg_data --name lv_data
  Volume group "vg_data" has insufficient free space (19146 extents): 20224 required.
[root@oralinux ~]# lvcreate -l 19146 vg_data --name lv_data
  Logical volume "lv_data" created.
[root@oralinux ~]# lvs
  LV      VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_data vg_data -wi-a----- <74.79g
  lv_root vg_main -wi-ao----  31.80g
  lv_swap vg_main -wi-ao----   4.00g
[root@oralinux ~]# mkfs.xfs /dev/vg_data/lv_data
meta-data=/dev/vg_data/lv_data   isize=512    agcount=4, agsize=4901376 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=1 inobtcount=1 nrext64=0
data     =                       bsize=4096   blocks=19605504, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=16384, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
Discarding blocks...Done.
On monte le FS de manière persistante sous /data

Premier montage

[root@oralinux ~]# mkdir /data
[root@oralinux ~]# mount /dev/vg_data/lv_data /data
[root@oralinux ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     4.0M     0  4.0M   0% /dev
tmpfs                         16G     0   16G   0% /dev/shm
tmpfs                        6.3G   17M  6.3G   1% /run
/dev/mapper/vg_main-lv_root   32G  1.5G   31G   5% /
/dev/sda3                    960M  114M  847M  12% /boot
/dev/sda2                    200M  6.3M  194M   4% /boot/efi
tmpfs                        3.2G     0  3.2G   0% /run/user/1000
/dev/mapper/vg_data-lv_data   75G  566M   75G   1% /data

On ajoute la ligne suivante à /etc/fstab avant la ligne dédiée au swap :

dev/mapper/vg_data-lv_data /data                   xfs     defaults        0 0

Ce qui donne le fichier suivant :

#
# /etc/fstab
# Created by anaconda on Sat Mar 15 19:12:00 2025
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/vg_main-lv_root /                       xfs     defaults        0 0
UUID=e3e4f9ba-1a7a-4cc4-9414-a15db8cd91ab /boot                   xfs     defaults        0 0
UUID=0FB6-C9F8          /boot/efi               vfat    defaults,uid=0,gid=0,umask=077,shortname=winnt 0 2
/dev/mapper/vg_data-lv_data /data                   xfs     defaults        0 0
/dev/mapper/vg_main-lv_swap none                    swap    defaults        0 0

On remonte recharge le fichier et on remonte tout.

[root@oralinux ~]# umount /data
[root@oralinux ~]# systemctl daemon-reload
[root@oralinux ~]# mount -a
[root@oralinux ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     4.0M     0  4.0M   0% /dev
tmpfs                         16G     0   16G   0% /dev/shm
tmpfs                        6.3G   17M  6.3G   1% /run
/dev/mapper/vg_main-lv_root   32G  1.5G   31G   5% /
/dev/sda3                    960M  114M  847M  12% /boot
/dev/sda2                    200M  6.3M  194M   4% /boot/efi
tmpfs                        3.2G     0  3.2G   0% /run/user/1000
/dev/mapper/vg_data-lv_data   75G  566M   75G   1% /data

Le système est prêt à l’utilisation.

Laisser un commentaire