Using LFTP to Mirror a Web Repo

While in the process of researching the best way to create my own local repository of Solaris packages, I ran across LFTP which is a ftp/http client with I built-in mirror command.

For more information on LFTP, look here or  here

The repo that I wanted to Mirror was, so the first thing that I did was mirror thir directory structure on my local server. I created a 100 gb mount on /v1, and then created the following directories (these are the only ones that I need). They pretty much match the structure that blastwave is using.


Here is an example of what I ran to create the initial x86 Solaris 10 repo.

lftp -c ‘open -e "mirror /csw/stable/i386/5.10/ /v1/repo/stable/5.10/"’

Which is based on the basic structure outlined below

lftp -c ‘open -e "mirror <remote_dir_path> <local_dir>/" <remote_site>’

Below are a couple of the options that you can use with LFTP

In the example below, LFTP removes any local packages that no longer exist on the source, and only downloads newer package versions from the host mirror.

lftp -e "mirror –delete –only-newer

You can also use the -f option to read your settings from a file.

lftp -f /scriptfile

Or you can log to a file.
–log=FILE      write lftp commands being executed to FILE

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.