CDNs are mostly about having large numbers of servers in convinent locations not software. The software is the easy part.
That said, wikipedia documents its CDN setup which is all open source at https://wikitech.wikimedia.org/wiki/Caching_overview which might be of interest to you.