Wiki Ubuntu-it

Indice
Partecipa
FAQ
Wiki Blog
------------------
Ubuntu-it.org
Forum
Chiedi
Chat
Cerca
Planet
  • Pagina non alterabile
  • Informazioni
  • Allegati
  • Differenze per "jeremie2/Prove14"
Differenze tra le versioni 8 e 26 (in 18 versioni)
Versione 8 del 22/09/2019 22.01.21
Dimensione: 1657
Autore: jeremie2
Commento:
Versione 26 del 29/09/2024 20.22.32
Dimensione: 5291
Autore: jeremie2
Commento:
Le cancellazioni sono segnalate in questo modo. Le aggiunte sono segnalate in questo modo.
Linea 1: Linea 1:
#acl GruppoAdmin:admin,read,write,revert GruppoEditori:read All:read Known:read
#format wiki
#language it
## PROCEDERE COME SEGUE PER AGGIORNARE QUESTA PAGINA:
## 1. creare la pagina Installazione/NomeVersioneTorrent (ad esempio Installazione/XenialXerusTorrent)
## 2. inserire al suo interno i riferimenti "## start" e "## end"
## 3. modificare questa pagina (DownloadTorrent) e inserire le righe:
## ## NUMERO_VERSIONE
## <<Include(Installazione/NOMEVERSIONETorrent, , from="^## start", to="## end")>>
## ----

<<Indice(depth=1)>>
<<Informazioni(forum="http://forum.ubuntu-it.org/viewtopic.php?f=46&t=597941")>>
## page was renamed from GruppoDocumentazione/NuovoRilascio/ScriptHashSHA256Sum
#page created by wilecoyote
<<Indice(depth=2)>>
<<BR>>
<<Informazioni(forum=http://forum.ubuntu-it.org/viewtopic.php?t=641900; rilasci="22.04 20.04 24.04 24.10")>>
Linea 17: Linea 9:
In questa pagina vengono elencati i collegamenti da cui è possibile scaricare le immagini `.iso` di Ubuntu e delle sue derivate tramite protocollo [[http://it.wikipedia.org/wiki/BitTorrent|BitTorrent]]. Nelle pagine di download di Ubuntu, oltre alle immagini '''iso''' del sistema operativo, è regolarmente presente il file '''SHA256SUM''' con l'elenco delle impronte SHA256Sum di ciascun file `iso`.
Linea 19: Linea 11:
Fare riferimento alla pagina [[Installazione/RequisitiDiSistema|requisti di sistema]] per scegliere la distribuzione più adatta alla propria configurazione hardware. In questa pagina viene mostrato l'utilizzo di uno '''script''' in grado di rilevare dalle pagine di download tutte le impronte SHA256Sum di Ubuntu e derivate a seconda del numero di versione (22.04, 24.04, ecc..).<<BR>>
Per ogni versione verrà creato un file con l'elenco delle hash per le `iso` di Ubuntu e derivate.
Linea 21: Linea 14:
Se si possiede un pc con processore a 64bit con architettura [[http://it.wikipedia.org/wiki/AMD64|x86-64]], si consiglia di installare la [[Hardware/Architettura64Bit|versione per amd64]]. = Script =
Linea 23: Linea 16:
## 19.10
<<Include(Installazione/EoanErmineTorrent, , from="^## start", to="## end")>>
Il seguente script richiede l'[[AmministrazioneSistema/InstallareProgrammi|installazione]] del pacchetto [[apt://aiohttp-wsgi-serve|aiohttp-wsgi-serve]]. In caso di problemi è possibile utilizzare uno script [[#alternativo|alternativo]].
Linea 26: Linea 18:
----
## 19.04
<<Include(Installazione/DiscoDingoTorrent, , from="^## start", to="## end")>>
----
{{{
import aiohttp
import asyncio
Linea 31: Linea 22:
## 18.04 LTS
<<Include(Installazione/BionicBeaverTorrent, , from="^## start", to="## end")>>
----
from sys import argv
script, ubu_version = argv
Linea 35: Linea 25:
## 16.04 LTS
<<Include(Installazione/XenialXerusTorrent, , from="^## start", to="## end")>>
ubuntu_flavours = ("kubuntu", "ubuntu-mate", "xubuntu", "lubuntu", "ubuntu-unity", "ubuntu-budgie", "ubuntustudio", "ubuntukylin", "ubuntucinnamon")


def create_versions_list():
    versions = []
    versions.append("UBUNTU")

    for version in ubuntu_flavours:
        versions.append(version.upper())

    versions.append("SERVER_POWERPC")
    return versions


def create_urls_collection():
    urls = []

    # Link hash Ubuntu
    link = f"https://releases.ubuntu.com/{ubu_version}/SHA256SUMS"
    urls.append(link)

    # Link hash derivate ufficiali di Ubuntu
    for flavour in ubuntu_flavours:
        link = f"https://cdimage.ubuntu.com/{flavour}/releases/{ubu_version}/release/SHA256SUMS"
        urls.append(link)

    # Link hash versioni server alternative, ecc..
    link = f"https://cdimage.ubuntu.com/releases/{ubu_version}/release/SHA256SUMS"
    urls.append(link)

    return urls


async def fetch_page(session, url):
    async with session.get(url) as response:
        if response.status == 200:
            return await response.text()
        else:
            return None


async def main():
    ubu_versions = create_versions_list()
    urls = create_urls_collection()
    async with aiohttp.ClientSession() as session:
        hash_pages = []

        for url in urls:
            hash_pages.append(fetch_page(session, url))

        htmls = await asyncio.gather(*hash_pages)

    for flavour_name, hash_text in zip(ubu_versions, htmls):
        if hash_text is None:
            print(f"{flavour_name}\nNon presente!\n")
        else:
            print(f"{flavour_name}\n{hash_text}")


asyncio.run(main())

}}}

= Utilizzo =

Aprire un [[Ufficio/EditorDiTesto|editor di testo]], incollare il testo dello script riportato nel paragrafo precedente e salvare il file nella propria '''Home''' con il nome `script.py`

Vengono elencati qui i comandi da [[AmministrazioneSistema/Terminale|terminale]] per ogni [[Rilasci|versione supportata]]. Ogni comando creerà nella propria '''Home''' un file con all'interno l'elenco delle impronte per una specifica versione di Ubuntu. Ad esempio il file '''hash_24-04.txt''' conterrà l'elenco delle hash SHA256Sum della versione '''24.04'''.

 * '''24.10''': digitare il comando:{{{
python3 script.py 24.10 > hash_24-10.txt
}}}
 * '''24.04''': digitare il comando:{{{
python3 script.py 24.04 > hash_24-04.txt
}}}
 * '''22.04''': digitare il comando:{{{
python3 script.py 22.04 > hash_22-04.txt
}}}
 * '''20.04''': digitare il comando:{{{
python3 script.py 20.04 > hash_20-04.txt
}}}

<<Anchor(alternativo)>>
= Script alternativo =

Lo script è meno veloce del precedente, potrebbe richiedere vari secondi per l'esecuzione, tuttavia non richiede pacchetti aggiuntivi in una installazione standard di Ubuntu.

{{{
import urllib.request
import requests

from sys import argv
script, ubu_version = argv

ubuntu_flavours = ("kubuntu", "ubuntu-mate", "xubuntu", "lubuntu", "ubuntu-unity", "ubuntu-budgie", "ubuntustudio", "ubuntukylin", "ubuntucinnamon")

def print_hash(web_page):
    request = requests.get(web_page)
    if request.status_code == 200:
        web = urllib.request.urlopen(web_page)
        text = web.read().decode('utf_8')
        print(text)
    else:
        print("Non presente!\n")

#STAMPA HASH UBUNTU PRESENTI IN https://releases.ubuntu.com/
print("UBUNTU")
link = f"https://releases.ubuntu.com/{ubu_version}/SHA256SUMS"
print_hash(link)

#STAMPA HASH VARIANTI *BUNTU PRESENTI IN http://cdimage.ubuntu.com/
for i in ubuntu_flavours:
    link = f"https://cdimage.ubuntu.com/{i}/releases/{ubu_version}/release/SHA256SUMS"
    print(i.upper())
    print_hash(link)

#STAMPA HASH VERSIONI SERVER PRESENTI IN https://cdimage.ubuntu.com/releases/
print("SERVER_POWERPC")
link = f"https://cdimage.ubuntu.com/releases/{ubu_version}/release/SHA256SUMS"
print_hash(link)

}}}

= Ulteriori risorse =

 * [[Installazione/SHA256Sum|Hash sha256]]
 * [[Installazione/SHA256Sum/Hash|Elenco delle hash sha256]]


Guida verificata con Ubuntu: 20.04 22.04 24.04 24.10

Problemi in questa pagina? Segnalali in questa discussione

Introduzione

Nelle pagine di download di Ubuntu, oltre alle immagini iso del sistema operativo, è regolarmente presente il file SHA256SUM con l'elenco delle impronte SHA256Sum di ciascun file iso.

In questa pagina viene mostrato l'utilizzo di uno script in grado di rilevare dalle pagine di download tutte le impronte SHA256Sum di Ubuntu e derivate a seconda del numero di versione (22.04, 24.04, ecc..).
Per ogni versione verrà creato un file con l'elenco delle hash per le iso di Ubuntu e derivate.

Script

Il seguente script richiede l'installazione del pacchetto aiohttp-wsgi-serve. In caso di problemi è possibile utilizzare uno script alternativo.

import aiohttp
import asyncio

from sys import argv
script, ubu_version = argv

ubuntu_flavours = ("kubuntu", "ubuntu-mate", "xubuntu", "lubuntu", "ubuntu-unity", "ubuntu-budgie", "ubuntustudio", "ubuntukylin", "ubuntucinnamon")


def create_versions_list():
    versions = []
    versions.append("UBUNTU")

    for version in ubuntu_flavours:
        versions.append(version.upper())

    versions.append("SERVER_POWERPC")
    return versions


def create_urls_collection():
    urls = []

    # Link hash Ubuntu
    link = f"https://releases.ubuntu.com/{ubu_version}/SHA256SUMS"
    urls.append(link)

    # Link hash derivate ufficiali di Ubuntu
    for flavour in ubuntu_flavours:
        link = f"https://cdimage.ubuntu.com/{flavour}/releases/{ubu_version}/release/SHA256SUMS"
        urls.append(link)

    # Link hash versioni server alternative, ecc..
    link = f"https://cdimage.ubuntu.com/releases/{ubu_version}/release/SHA256SUMS"
    urls.append(link)

    return urls


async def fetch_page(session, url):
    async with session.get(url) as response:
        if response.status == 200:
            return await response.text()
        else:
            return None


async def main():
    ubu_versions = create_versions_list()
    urls = create_urls_collection()
    async with aiohttp.ClientSession() as session:
        hash_pages = []

        for url in urls:
            hash_pages.append(fetch_page(session, url))

        htmls = await asyncio.gather(*hash_pages)

    for flavour_name, hash_text in zip(ubu_versions, htmls):
        if hash_text is None:
            print(f"{flavour_name}\nNon presente!\n")
        else:
            print(f"{flavour_name}\n{hash_text}")


asyncio.run(main())

Utilizzo

Aprire un editor di testo, incollare il testo dello script riportato nel paragrafo precedente e salvare il file nella propria Home con il nome script.py

Vengono elencati qui i comandi da terminale per ogni versione supportata. Ogni comando creerà nella propria Home un file con all'interno l'elenco delle impronte per una specifica versione di Ubuntu. Ad esempio il file hash_24-04.txt conterrà l'elenco delle hash SHA256Sum della versione 24.04.

  • 24.10: digitare il comando:

    python3 script.py 24.10 > hash_24-10.txt
  • 24.04: digitare il comando:

    python3 script.py 24.04 > hash_24-04.txt
  • 22.04: digitare il comando:

    python3 script.py 22.04 > hash_22-04.txt
  • 20.04: digitare il comando:

    python3 script.py 20.04 > hash_20-04.txt

Script alternativo

Lo script è meno veloce del precedente, potrebbe richiedere vari secondi per l'esecuzione, tuttavia non richiede pacchetti aggiuntivi in una installazione standard di Ubuntu.

import urllib.request
import requests

from sys import argv
script, ubu_version = argv

ubuntu_flavours = ("kubuntu", "ubuntu-mate", "xubuntu", "lubuntu", "ubuntu-unity", "ubuntu-budgie", "ubuntustudio", "ubuntukylin", "ubuntucinnamon")

def print_hash(web_page):
    request = requests.get(web_page)
    if request.status_code == 200:
        web = urllib.request.urlopen(web_page)
        text = web.read().decode('utf_8')
        print(text)
    else:
        print("Non presente!\n")

#STAMPA HASH UBUNTU PRESENTI IN https://releases.ubuntu.com/
print("UBUNTU")
link = f"https://releases.ubuntu.com/{ubu_version}/SHA256SUMS"
print_hash(link)

#STAMPA HASH VARIANTI *BUNTU PRESENTI IN http://cdimage.ubuntu.com/
for i in ubuntu_flavours:
    link = f"https://cdimage.ubuntu.com/{i}/releases/{ubu_version}/release/SHA256SUMS"
    print(i.upper())
    print_hash(link)

#STAMPA HASH VERSIONI SERVER PRESENTI IN https://cdimage.ubuntu.com/releases/
print("SERVER_POWERPC")
link = f"https://cdimage.ubuntu.com/releases/{ubu_version}/release/SHA256SUMS"
print_hash(link)

Ulteriori risorse


CategoryInstallazioneSistema