Installing and updating software using the OSGeo4W/CYGWIN command line

See:

Installing QGIS using apt on windows (OSGeo4W)

Examples:

Install the package “apt” (at the moment only available on the 32bit version of OSGeo4W). Sample commands:

apt setup 
apt upgrade 
apt update 
apt install packagename

The above commands can be used also in a batch file to make automatic updates, for that a couple of system variables need to be set:

@echo off
set OSGEO4W_ROOT=C:/OSGeo4W
set PATH=%OSGEO4W_ROOT%bin;%PATH%
apt update
apt install qgis-dev
pause

Using the CYGWIN console, setting the system variables becomes:

export OSGEO4W_ROOT=C:/OSGeo4W
export PATH=$OSGEO4W_ROOT/bin:$PATH

Adding c:\cygwin\bin and/or c:\OSGeo4w\bin to the “path” environment variable also helps in executing useful commands from the command line, also remotely.

CygWin does not have out of the box an apt like application, but this can be easily added:

wget raw.github.com/transcode-open/apt-cyg/master/apt-cyg
chmod +x apt-cyg
mv apt-cyg /cygdrive/c/cygwin/bin
apt-cyg install packagename

A different method:

An alternative is to use directly the parameters that the osgeo4w installer has available. Example:

osgeo4w-setup --arch x86_64 --advanced --root d:\your-osgeo4w --local-package-dir %TEMP%\osgeo4w --site http://download.osgeo.org/osgeo4w --autoaccept --quiet-mode --packages qgis-dev

or even simply

osgeo4w-setup.exe -q -P packagename

The same will work also for installing cygwin packages

setup-x86.exe -q -P packagename
Advertisements
Installing and updating software using the OSGeo4W/CYGWIN command line