Install an Osgeo4w environment on a new system, from the command line

For more information see pkg-apt and pkg-apt/AptCommands.

Download the latest apt-rxx.exe from If you like rename to apt.exe. Open a CMD shell and:

apt setup
apt update
apt install shell

Example Session

D:\>set osgeo4w_root=d:\test-osgeo4w
D:\>apt setup
Root dir not found, creating d:/test-osgeo4w
creating d:/test-osgeo4w/etc/setup/
creating d:/test-osgeo4w/etc/setup//installed.db
getting d:/test-osgeo4w/etc/setup//setup.ini

D:\>apt install shell
to install:
shell msvcrt

...100% d:/test-osgeo4w/var/cache/setup/

a01e6dcdc9e2d2c49424585aa3e1b44f shell-1.0.0-5.tar.bz2 - remote
a01e6dcdc9e2d2c49424585aa3e1b44f shell-1.0.0-5.tar.bz2 - local

...100% d:/test-osgeo4w/var/cache/setup/

195c192b98b7333e2d3f9e04717c2eb5 msvcrt-1.0.1-2.tar.bz2 - remote
195c192b98b7333e2d3f9e04717c2eb5 msvcrt-1.0.1-2.tar.bz2 - local
installing shell 1.0.0-5

>mkdir "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OSGeo4W"
>xxmklink "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OSGeo4W\OSGeo4W.lnk" "d:\test-osgeo4w\OSGeo4W.bat" " " \ "OSGeo for Windows command shell" 1 "d:\test-osgeo4w\OSGeo4W.ico
>xxmklink "C:\ProgramData\Desktop\OSGeo4W.lnk" "d:\test-osgeo4w\OSGeo4W.bat" " " \ "OSGeo for Windows command shell" 1 "d:\test-osgeo4w\OSGeo4W.ico
Post_install complete, return code 0
installing msvcrt 1.0.1-2

>"d:\test-osgeo4w\bin\vcredist_x86.exe" /q
>del "d:\test-osgeo4w\bin\vcredist_x86.exe"
>textreplace -std -t bin/o4w_env.bat
Post_install complete, return code 0

D:\>apt list
msvcrt 1.0.1-2
shell 1.0.0-5

Shell is only a skeleton, there are no applications installed. So to get something actually useful:

>apt available

 Packages available to install (* = already installed)

agg-devel                       mapscript-dev-python
apache                          mapscript-java
apache-manual                   mapscript-python
...snipped >140 package names...
libxdr                          xerces-c
libxml2                         xerces-c-devel
mapfish_framework               zlib

>apt install gdal

>gdalinfo --version
GDAL 1.8.0, released 2011/01/12
Last modified 11 years ago Last modified on Sep 6, 2011, 12:21:38 AM
Note: See TracWiki for help on using the wiki.