Vai al contenuto

Importazione di Rocky Linux in WSL o WSL2

Images for other versions

If you are looking for WSL instructions for another version of Rocky Linux, select the version you want from the top menu and then refer to the WSL instructions under "Interoperability."

Prerequisiti

You must enable the Windows-Subsystem for Linux feature. Do this with one of these options:

Questa funzione dovrebbe essere disponibile su tutte le versioni di Windows 10 e 11 supportate.

WSL version

Assicurasi che la versione di WSL sia aggiornata, poiché alcune funzionalità sono state introdotte solo nelle ultime versioni. Se non si è sicuri, eseguire wsl --update.

Passi

Immagini WSL installabili (preferibile)

  1. Scaricare l'immagine WSL dal CDN o da un altro mirror più vicino:

  2. 9: x86_64 oppure aarch64

  3. Esistono diverse opzioni per l'installazione di un'immagine .wsl:

  4. Doppio clic sull'immagine per installarla con il nome predefinito dell'immagine.

  5. Installare l'immagine tramite riga di comando:
    ```sh
    wsl --install --from-file <path-to/Rocky-9-WSL-Base.latest.x86_64.wsl> --name <machine-name>
    ```
    

Immagini container convenzionali

  1. Ottenere il rootfs del container. Questo è possibile in diversi modi:

  2. Scaricare l'immagine dal CDN:

  3. Extract the image from either Docker Hub or Quay.io (ref.)

    ```sh
    <podman/docker> export rockylinux:10 > rocky-10-image.tar
    ```
    
  4. (optional) You will have to extract the .tar file from the .tar.xz file if you are using one of the latest WSL versions

  5. Creare la directory in cui il WSL memorizzerà i suoi file (per lo più da qualche parte nel profilo utente)

  6. Finally, import the image into WSL (ref.):

  7. WSL:

    ```sh
    wsl --import <machine-name> <path-to-vm-dir> <path-to/rocky-9-image.tar.xz> --version 1
    ```
    
  8. WSL 2:

    ```sh
    wsl --import <machine-name> <path-to-vm-dir> <path-to/rocky-9-image.tar.xz> --version 2
    ```
    

WSL vs. WSL 2

In generale, WSL 2 dovrebbe essere più veloce di WSL, anche se questo può variare a seconda del caso d'uso.

Windows Terminal

If you have Windows Terminal installed, the new WSL distro name will appear as an option on the pull-down menu, which is quite handy for launching in the future. You can then customize it with colors, fonts, and other elements.

systemd

The WSL image is systemd-enabled by default. If you want to use the container images or build your own, you will only need to add systemd=true to the boot section in the /etc/wsl.conf file. (ref.)

Author: Lukas Magauer