[Tex/LaTex] Creating a local package repository for offline installation of MikTex

installingmiktexpackages

I'm trying to create a local package repository to be used during installing miktex on a system not connected to the internet. I want to install miktex and load the packages I need in one command (or at least, do it completely unattended by user).

As a start I have a directory, C:\MyRepo\ containing these 3 files:

  1. miktex-zzdb1-2.9.tar.lzma
  2. miktex-zzdbb-2.9.tar.lzma
  3. floatrow.zip ( package file)

I go to run my installer as follows:

basic-miktex-2.9.6643-x64.exe –auto-install=yes –unattended –install-from-local-repository –local-package-repository=C:\MyRepo

When I run this, I get "The specified local repository does not exist".
However, if I fully install miktex, and then in the package manager specify my local repo, it seems to accept it as a local repository.

Is there something I'm doing wrong on the command line args to specify the package repo, or perhaps something not quite right with my local repo directory contents?

Best Answer

These steps outline installing miktex itself, and then installing packages from a local repo. The local repo contains .tar.lzma files, as well as miktex-zzdb1-2.9.tar.lzma and miktex-zzdb2-2.9.tar.lzma. Packages to install are described as a comma separated list.

$appInstaller points to the basic-miktex-2.9.6643-x64.exe. $miktexPackageInstaller points to mpm.exe, which is located in hte miktex program file directory after install.

# install miktex unattended, for all users (requires admin). uses cmd args shown from -h option
Start-Process -Wait "$appInstaller" -ArgumentList "--auto-install=yes --unattended --shared"

Start-Process -Wait "$miktexPackageInstaller" -argumentList "--admin --repository=$localPackageRepo --install=package1,package2,package3"