# How do I use wget to download the latest stable version of RL?

**URL:** <https://forums.rockylinux.org/t/how-do-i-use-wget-to-download-the-latest-stable-version-of-rl/5021>\
**Category:** Rocky Linux Help & Support\
**Created:** [January 2, 2022, 9:22am UTC](https://forums.rockylinux.org/t/how-do-i-use-wget-to-download-the-latest-stable-version-of-rl/5021 "2022-01-02T09:22:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlamintegrator](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rlamintegrator](https://forums.rockylinux.org/u/rlamintegrator)\
**Post date:** [January 2, 2022, 9:22am UTC](https://forums.rockylinux.org/t/how-do-i-use-wget-to-download-the-latest-stable-version-of-rl/5021/1 "2022-01-02T09:22:53Z")

</div>

How do I use wget to download the latest stable version(minimal) of RL?  
I want to do this from a bash script only…

Serg

---

<div class="post-metadata">

**Author:** ![iwalker](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/iwalker/32/2599_2.png) [@iwalker](https://forums.rockylinux.org/u/iwalker)\
**Post date:** [January 2, 2022, 10:00am UTC](https://forums.rockylinux.org/t/how-do-i-use-wget-to-download-the-latest-stable-version-of-rl/5021/2 "2022-01-02T10:00:08Z")

</div>

Just did this now for you:

```auto
#!/bin/bash
#
# Get latest Rocky ISO

# Variables
URL=https://download.rockylinux.org/pub/rocky/8/isos/x86_64/
ISO=`curl -s ${URL} | grep -i minimal | egrep -iv "manifest|torrent" | cut -f2 -d ">" | sed 's/<\/a//'`

# Download file
wget ${URL}${ISO}

```

the URL must include the slash at the end so that the curl command used for the ISO variable gets the directory listing which comes in html format. We are then grepping that to filter for the minimal iso, and then removing manifest and torrent from the list. We then filter out the `a href=` field and remove the ending `</a>` to leave us with the filename.

We then combine the URL and ISO variables to download the file. I’m sure there are other ways also. Obviously this is based on the fact that the download URL only has one version of Rocky listed, which is how it is right now. This might or might not change in the future, but then you would just modify the code accordingly to deal with that. But for now it works fine.

---

<div class="post-metadata">

**Author:** ![Ritov](https://avatars.discourse-cdn.com/v4/letter/r/3ec8ea/32.png) [@Ritov](https://forums.rockylinux.org/u/Ritov)\
**Post date:** [January 5, 2022, 1:51pm UTC](https://forums.rockylinux.org/t/how-do-i-use-wget-to-download-the-latest-stable-version-of-rl/5021/3 "2022-01-05T13:51:36Z")

</div>

[@infrastructure](https://forums.rockylinux.org/groups/infrastructure) - I would suggest to put links into the iso directory:

Rocky-latest-x86\_64-minimal.iso → Rocky-8.5-x86\_64-minimal.iso

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [January 5, 2022, 2:12pm UTC](https://forums.rockylinux.org/t/how-do-i-use-wget-to-download-the-latest-stable-version-of-rl/5021/4 "2022-01-05T14:12:47Z")

</div>

However, if you had already downloaded a “Rocky-latest-x86\_64-minimal.iso”, then you could not tell from that filename whether it still is the latest.

---

<div class="post-metadata">

**Author:** ![brian](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/brian/32/5777_2.png) [@brian](https://forums.rockylinux.org/u/brian)\
**Post date:** [August 25, 2023, 3:58am UTC](https://forums.rockylinux.org/t/how-do-i-use-wget-to-download-the-latest-stable-version-of-rl/5021/5 "2023-08-25T03:58:08Z")

</div>


