~/Blog

Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI studying Automated Reasoning in AI and Linux Enthusiast.

Mirror Download with wget

Published on

Updated on

Warning: This post has not been modified for over 2 years. For technical posts, make sure that it is still relevant.

This post will describe downloading a centos repo using wget. Though the ideas in this blog post can apply to any mirror with packages exposed via http.

wget \
  --accept rpm,bz2,gz,xml,asc \
  --recursive \
  --no-parent \
  --no-host-directories \
  --cut-dirs=4 \
  http://mirror.centos.org/centos/8/BaseOS/x86_64/os/ 

Here are what the options mean…

Option Meaning
--accept Comma separated by which extensions to allow downloading
--recursive Follow links
--no-parent Only follow links that are sub-directories of the current one
--no-host-directories Exclude creating a folder indicating the hostname
--cut-dirs=N Don’t make folders for a depth of N subdirectories. Notice in the example centos, 8, BaseOS, x86_64, os is a list of 5 subdirectories so N=5
Reply via Email Buy me a Coffee
Was this useful? Feel free to share: Hacker News Reddit Twitter

Published a response to this? :