MediaWiki is opensource and is available for download for free. You can use it for offline access to the Wikipedia database, or to set up a wiki of your own.
However, MediaWiki requires other software to be able to run. The prerequisite programs are Apache/IIS, MySQL4 or later (5 or later as of version 1.19) and PHP5. When bundled together, these are referred to as AMP. They are also open source and free.