Tips For Keeping Your Miktex Installation Up-To-Date Without Internet Access
Downloading Updates Offline
If you need to keep your MiKTeX distribution current but lack an internet connection on the computer where it is installed, you can download updates on another computer that does have internet access and then transfer them over. Here are the steps:
- On an internet-connected computer, navigate to the MiKTeX download page and download the MiKTeX installer for your platform. This will be a .exe file for Windows. Also download multiple MiKTeX update packages (.cab files).
- Copy the downloaded installer and .cab update files to a USB flash drive or external hard drive.
- Plug the external drive into your offline MiKTeX computer. Run the installer first - this will update the core MiKTeX binaries and libraries if needed. Then double click on each .cab package to have MiKTeX update itself with the latest packages and fonts.
Following this process whenever there are new updates allows you to maintain an up-to-date MiKTeX distribution without internet access. Just remember to copy over all the update files in sequence each time. The offline computer will still need to rebuild its font caches and file name databases after updating, but will then have the latest packages.
Using a Local Package Repository
Setting up a local package repository is a more automated way to keep your offline MiKTeX updated. It works as follows:
- On a computer with an internet connection, install MiKTeX. Then set up a folder to host the local repository. This can be on a shared drive or server.
- Edit the MiKTeX
miktex.ini
config file on this online computer and point the PackageRepository entry to your local repository folder. Also set OtherRepositories to be empty. - Refresh the repository by running
MiKTeX Update
on the online computer. This will download all available packages and databases into your local folder. - On your offline MiKTeX computer, similarly edit
miktex.ini
to set the PackageRepository to point to the local repository computer/folder. Make sure OtherRepositories is blank. - Now when you run Updates on the offline computer, it will automatically fetch new packages and database files from the local repository without needing the internet!
The key things to remember are setting up that intermediary local repository installation, preventing it from accessing external repositories, and directing offline computer to look only at the local folder. Refreshing the local repository regularly will ensure latest MiKTEX versions get propagated. But this avoids needing to manually copy files each time.
Updating the Package Database
In addition to installer binaries and package files, MiKTeX also relies heavily on two database files to track what is available - the package database (.mdb
) and file name database. These must be kept current as well for your offline MiKTeX ability to know what packages exist when updating. The steps are:
- Periodically on the online repository computer, manually run
MiKTeX Update
. This will refresh themiktex.mdb
package database andpdftex.mdb
file name database. - Copy the updated
.mdb
files from the local repository over to your offline MiKTeX computer's MiKTeX folders. The default location isC:\ProgramData\MiKTeX\2.9
. - On the offline system, run
MiKTeX Update
again. The first operation will be refreshing the internal FNDB database from the copiedpdftex.fnbd
file. Subsequent operations will now see new package names.
This process essentially "seeds" the offline MiKTeX with the latest DB of available packages from the online repository so it knows what to look for. Automating the DB refresh itself still requires the manual transfer in lieu of an internet connection. But then you can update packages themselves.
Troubleshooting Issues
There are a number of potential errors or issues that can occur when trying to maintain an offline MiKTeX install as packages diverge between the systems:
- Unknown package files - This happens when the local package database has not been refreshed with info about new additions before transfers.
- Unresolved dependencies - Where a newer package relies on another package not yet copied over to offline system.
- Incomplete package installs - If transfers are interrupted, package extracts may fail. Requires force reinstall.
- Font cache corruption - Package additions/updates can sometimes corrupt old font data. Rebuild caches.
The simplest fix is to ensure local package and file databases are copied before transferring any new files and that transfers fully complete. Force refreshing the font cache (mkfntcache
) often clears other issues. Redoing a failed partial package upgrade resolves others. Most issues stem from databases and files being out of sync.
Example Configuration Code
To utilize an offline MiKTeX setup in your TeX documents, you need to point the \usepackage
and other commands to the MiKTeX installation:
\usepackage{amssymb} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[backend=bibtex]{biblatex} \addbibresource{references.bib}
This shows sample code for importing some commonly used packages like fonts, unicode handling, and references, assuming MiKTeX offline contains them. The configuration file settings described previously handle directing MiKTeX to the offline repositories.